Moved scans to their own Collection

This commit is contained in:
DrMint 2024-04-05 12:53:59 +02:00
parent a62709e66e
commit fc921703cf
5 changed files with 129 additions and 60 deletions

View File

@ -260,43 +260,43 @@ export const Collectibles = buildVersionedCollectionConfig({
rowField([
imageField({
name: fields.scansCoverFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansCoverSpine,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansCoverBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
rowField([
imageField({
name: fields.scansCoverInsideFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansCoverInsideBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
rowField([
imageField({
name: fields.scansCoverFlapFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansCoverFlapBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansCoverInsideFlapFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansCoverInsideFlapBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
],
@ -313,47 +313,47 @@ export const Collectibles = buildVersionedCollectionConfig({
rowField([
imageField({
name: fields.scansDustjacketFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansDustjacketSpine,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansDustjacketBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
rowField([
imageField({
name: fields.scansDustjacketInsideFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansDustjacketInsideSpine,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansDustjacketInsideBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
rowField([
imageField({
name: fields.scansDustjacketFlapFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansDustjacketFlapBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansDustjacketInsideFlapFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansDustjacketInsideFlapBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
],
@ -370,47 +370,47 @@ export const Collectibles = buildVersionedCollectionConfig({
rowField([
imageField({
name: fields.scansObiFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansObiSpine,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansObiBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
rowField([
imageField({
name: fields.scansObiInsideFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansObiInsideSpine,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansObiInsideBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
rowField([
imageField({
name: fields.scansObiFlapFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansObiFlapBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansObiInsideFlapFront,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
imageField({
name: fields.scansObiInsideFlapBack,
relationTo: Collections.Images,
relationTo: Collections.Scans,
}),
]),
],
@ -436,7 +436,7 @@ export const Collectibles = buildVersionedCollectionConfig({
},
imageField({
name: fields.scansPagesImage,
relationTo: Collections.Images,
relationTo: Collections.Scans,
required: true,
}),
]),

View File

@ -0,0 +1,32 @@
import { Collections } from "../../constants";
import { buildImageCollectionConfig } from "../../utils/imageCollectionConfig";
const fields = {
filename: "filename",
mimeType: "mimeType",
filesize: "filesize",
updatedAt: "updatedAt",
} as const satisfies Record<string, string>;
export const Scans = buildImageCollectionConfig({
slug: Collections.Scans,
labels: {
singular: "Scan",
plural: "Scans",
},
admin: { defaultColumns: [fields.filename, fields.updatedAt], hidden: true },
upload: {
imageSizes: [
{
name: "og",
height: 750,
width: 1125,
formatOptions: {
format: "jpg",
options: { progressive: true, mozjpeg: true, compressionLevel: 9, quality: 60 },
},
},
],
},
fields: [],
});

View File

@ -20,6 +20,7 @@ export enum Collections {
GenericContents = "generic-contents",
HomeFolders = "home-folders",
Videos = "videos",
Scans = "scans",
}
export enum CollectionGroups {

View File

@ -14,6 +14,7 @@ import { Languages } from "./collections/Languages/Languages";
import { Notes } from "./collections/Notes/Notes";
import { Pages } from "./collections/Pages/Pages";
import { Recorders } from "./collections/Recorders/Recorders";
import { Scans } from "./collections/Scans/Scans";
import { Tags } from "./collections/Tags/Tags";
import { TagsGroups } from "./collections/TagsGroups/TagsGroups";
import { Videos } from "./collections/Videos/Videos";
@ -51,6 +52,7 @@ export default buildConfig({
Videos,
VideosSubtitles,
VideosChannels,
Scans,
Tags,
TagsGroups,

View File

@ -25,6 +25,7 @@ export interface Config {
notes: Note;
images: Image;
videos: Video;
scans: Scan;
tags: Tag;
"tags-groups": TagsGroup;
recorders: Recorder;
@ -297,46 +298,46 @@ export interface Collectible {
typesetters?: (string | Recorder)[] | null;
coverEnabled?: boolean | null;
cover?: {
front?: string | Image | null;
spine?: string | Image | null;
back?: string | Image | null;
insideFront?: string | Image | null;
insideBack?: string | Image | null;
flapFront?: string | Image | null;
flapBack?: string | Image | null;
insideFlapFront?: string | Image | null;
insideFlapBack?: string | Image | null;
front?: string | Scan | null;
spine?: string | Scan | null;
back?: string | Scan | null;
insideFront?: string | Scan | null;
insideBack?: string | Scan | null;
flapFront?: string | Scan | null;
flapBack?: string | Scan | null;
insideFlapFront?: string | Scan | null;
insideFlapBack?: string | Scan | null;
};
dustjacketEnabled?: boolean | null;
dustjacket?: {
front?: string | Image | null;
spine?: string | Image | null;
back?: string | Image | null;
insideFront?: string | Image | null;
insideSpine?: string | Image | null;
insideBack?: string | Image | null;
flapFront?: string | Image | null;
flapBack?: string | Image | null;
insideFlapFront?: string | Image | null;
insideFlapBack?: string | Image | null;
front?: string | Scan | null;
spine?: string | Scan | null;
back?: string | Scan | null;
insideFront?: string | Scan | null;
insideSpine?: string | Scan | null;
insideBack?: string | Scan | null;
flapFront?: string | Scan | null;
flapBack?: string | Scan | null;
insideFlapFront?: string | Scan | null;
insideFlapBack?: string | Scan | null;
};
obiEnabled?: boolean | null;
obi?: {
front?: string | Image | null;
spine?: string | Image | null;
back?: string | Image | null;
insideFront?: string | Image | null;
insideSpine?: string | Image | null;
insideBack?: string | Image | null;
flapFront?: string | Image | null;
flapBack?: string | Image | null;
insideFlapFront?: string | Image | null;
insideFlapBack?: string | Image | null;
front?: string | Scan | null;
spine?: string | Scan | null;
back?: string | Scan | null;
insideFront?: string | Scan | null;
insideSpine?: string | Scan | null;
insideBack?: string | Scan | null;
flapFront?: string | Scan | null;
flapBack?: string | Scan | null;
insideFlapFront?: string | Scan | null;
insideFlapBack?: string | Scan | null;
};
pages?:
| {
page: number;
image: string | Image;
image: string | Scan;
id?: string | null;
}[]
| null;
@ -433,6 +434,39 @@ export interface Collectible {
createdAt: string;
_status?: ("draft" | "published") | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "scans".
*/
export interface Scan {
id: string;
updatedAt: string;
createdAt: string;
url?: string | null;
filename?: string | null;
mimeType?: string | null;
filesize?: number | null;
width?: number | null;
height?: number | null;
sizes?: {
thumb?: {
url?: string | null;
width?: number | null;
height?: number | null;
mimeType?: string | null;
filesize?: number | null;
filename?: string | null;
};
og?: {
url?: string | null;
width?: number | null;
height?: number | null;
mimeType?: string | null;
filesize?: number | null;
filename?: string | null;
};
};
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "currencies".