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([ rowField([
imageField({ imageField({
name: fields.scansCoverFront, name: fields.scansCoverFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansCoverSpine, name: fields.scansCoverSpine,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansCoverBack, name: fields.scansCoverBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
rowField([ rowField([
imageField({ imageField({
name: fields.scansCoverInsideFront, name: fields.scansCoverInsideFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansCoverInsideBack, name: fields.scansCoverInsideBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
rowField([ rowField([
imageField({ imageField({
name: fields.scansCoverFlapFront, name: fields.scansCoverFlapFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansCoverFlapBack, name: fields.scansCoverFlapBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansCoverInsideFlapFront, name: fields.scansCoverInsideFlapFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansCoverInsideFlapBack, name: fields.scansCoverInsideFlapBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
], ],
@ -313,47 +313,47 @@ export const Collectibles = buildVersionedCollectionConfig({
rowField([ rowField([
imageField({ imageField({
name: fields.scansDustjacketFront, name: fields.scansDustjacketFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansDustjacketSpine, name: fields.scansDustjacketSpine,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansDustjacketBack, name: fields.scansDustjacketBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
rowField([ rowField([
imageField({ imageField({
name: fields.scansDustjacketInsideFront, name: fields.scansDustjacketInsideFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansDustjacketInsideSpine, name: fields.scansDustjacketInsideSpine,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansDustjacketInsideBack, name: fields.scansDustjacketInsideBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
rowField([ rowField([
imageField({ imageField({
name: fields.scansDustjacketFlapFront, name: fields.scansDustjacketFlapFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansDustjacketFlapBack, name: fields.scansDustjacketFlapBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansDustjacketInsideFlapFront, name: fields.scansDustjacketInsideFlapFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansDustjacketInsideFlapBack, name: fields.scansDustjacketInsideFlapBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
], ],
@ -370,47 +370,47 @@ export const Collectibles = buildVersionedCollectionConfig({
rowField([ rowField([
imageField({ imageField({
name: fields.scansObiFront, name: fields.scansObiFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansObiSpine, name: fields.scansObiSpine,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansObiBack, name: fields.scansObiBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
rowField([ rowField([
imageField({ imageField({
name: fields.scansObiInsideFront, name: fields.scansObiInsideFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansObiInsideSpine, name: fields.scansObiInsideSpine,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansObiInsideBack, name: fields.scansObiInsideBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
rowField([ rowField([
imageField({ imageField({
name: fields.scansObiFlapFront, name: fields.scansObiFlapFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansObiFlapBack, name: fields.scansObiFlapBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansObiInsideFlapFront, name: fields.scansObiInsideFlapFront,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
imageField({ imageField({
name: fields.scansObiInsideFlapBack, name: fields.scansObiInsideFlapBack,
relationTo: Collections.Images, relationTo: Collections.Scans,
}), }),
]), ]),
], ],
@ -436,7 +436,7 @@ export const Collectibles = buildVersionedCollectionConfig({
}, },
imageField({ imageField({
name: fields.scansPagesImage, name: fields.scansPagesImage,
relationTo: Collections.Images, relationTo: Collections.Scans,
required: true, 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", GenericContents = "generic-contents",
HomeFolders = "home-folders", HomeFolders = "home-folders",
Videos = "videos", Videos = "videos",
Scans = "scans",
} }
export enum CollectionGroups { export enum CollectionGroups {

View File

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

View File

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