From af7c5ee5a0a9613db497f47129acffbc7b685cf3 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:41:58 +0200 Subject: [PATCH] Added audio and video collections --- src/accesses/collections/shownOnlyToAdmin.ts | 11 + src/collections/Audios/Audios.ts | 71 +++++ src/collections/Collectibles/Collectibles.ts | 8 +- src/collections/Currencies/Currencies.ts | 4 +- src/collections/Folders/Folders.ts | 8 +- .../Folders/endpoints/getBySlugEndpoint.ts | 9 +- src/collections/Images/Images.ts | 23 +- src/collections/Languages/Languages.ts | 5 +- src/collections/Scans/Scans.ts | 6 +- src/collections/Videos/Videos.ts | 109 ++++++- .../VideosChannels/VideosChannels.ts | 41 +++ .../VideosSubtitles/VideosSubtitles.ts | 15 + .../VideosThumbnails/VideosThumbnails.ts | 33 ++ src/constants.ts | 5 +- src/payload.config.ts | 26 +- src/types/collections.ts | 285 ++++++++++++++---- 16 files changed, 572 insertions(+), 87 deletions(-) create mode 100644 src/accesses/collections/shownOnlyToAdmin.ts create mode 100644 src/collections/Audios/Audios.ts create mode 100644 src/collections/VideosChannels/VideosChannels.ts create mode 100644 src/collections/VideosSubtitles/VideosSubtitles.ts create mode 100644 src/collections/VideosThumbnails/VideosThumbnails.ts diff --git a/src/accesses/collections/shownOnlyToAdmin.ts b/src/accesses/collections/shownOnlyToAdmin.ts new file mode 100644 index 0000000..632b98e --- /dev/null +++ b/src/accesses/collections/shownOnlyToAdmin.ts @@ -0,0 +1,11 @@ +import { User } from "payload/auth"; +import { RecordersRoles } from "../../constants"; +import { Recorder } from "../../types/collections"; +import { isDefined, isUndefined } from "../../utils/asserts"; + +export const shownOnlyToAdmin = ({ user }: { user: User }): boolean => { + if (isUndefined(user)) return false; + const recorder = user as unknown as Recorder; + const isAdmin = isDefined(recorder.role) && recorder.role.includes(RecordersRoles.Admin); + return !isAdmin; +}; diff --git a/src/collections/Audios/Audios.ts b/src/collections/Audios/Audios.ts new file mode 100644 index 0000000..d2d944d --- /dev/null +++ b/src/collections/Audios/Audios.ts @@ -0,0 +1,71 @@ +import { CollectionGroups, Collections } from "../../constants"; +import { imageField } from "../../fields/imageField/imageField"; +import { rowField } from "../../fields/rowField/rowField"; +import { tagsField } from "../../fields/tagsField/tagsField"; +import { translatedFields } from "../../fields/translatedFields/translatedFields"; +import { buildCollectionConfig } from "../../utils/collectionConfig"; +import { createEditor } from "../../utils/editor"; + +const fields = { + filename: "filename", + mimeType: "mimeType", + filesize: "filesize", + updatedAt: "updatedAt", + translations: "translations", + translationsTitle: "title", + translationsDescription: "description", + translationsSubfile: "subfile", + thumbnail: "thumbnail", + duration: "duration", + tags: "tags", +}; + +export const Audios = buildCollectionConfig({ + slug: Collections.Audios, + labels: { singular: "Audio", plural: "Audios" }, + defaultSort: fields.updatedAt, + admin: { + group: CollectionGroups.Media, + defaultColumns: [ + fields.filename, + fields.mimeType, + fields.filesize, + fields.translations, + fields.updatedAt, + ], + }, + upload: { + mimeTypes: ["audio/*"], + disableLocalStorage: true, + }, + fields: [ + rowField([ + { name: fields.duration, type: "number", min: 0, required: true }, + imageField({ + name: fields.thumbnail, + relationTo: Collections.MediaThumbnails, + }), + ]), + translatedFields({ + name: fields.translations, + admin: { useAsTitle: fields.translationsTitle }, + required: true, + minRows: 1, + fields: [ + { name: fields.translationsTitle, type: "text", required: true }, + { + name: fields.translationsDescription, + type: "richText", + editor: createEditor({ inlines: true, lists: true, links: true }), + }, + { + name: fields.translationsSubfile, + type: "upload", + relationTo: Collections.VideosSubtitles, + admin: { description: "The subtitle file needs to follow the WebVTT file format (.vtt)" }, + }, + ], + }), + tagsField({ name: fields.tags }), + ], +}); diff --git a/src/collections/Collectibles/Collectibles.ts b/src/collections/Collectibles/Collectibles.ts index f0a4f8c..9b314cb 100644 --- a/src/collections/Collectibles/Collectibles.ts +++ b/src/collections/Collectibles/Collectibles.ts @@ -611,8 +611,12 @@ export const Collectibles = buildVersionedCollectionConfig({ { name: fields.contentsContent, type: "relationship", - // TODO: Add audio and video files - relationTo: [Collections.Pages, Collections.GenericContents], + relationTo: [ + Collections.Pages, + Collections.GenericContents, + Collections.Audios, + Collections.Videos, + ], admin: { allowCreate: false, }, diff --git a/src/collections/Currencies/Currencies.ts b/src/collections/Currencies/Currencies.ts index 41b3692..755b248 100644 --- a/src/collections/Currencies/Currencies.ts +++ b/src/collections/Currencies/Currencies.ts @@ -1,5 +1,6 @@ import { text } from "payload/dist/fields/validations"; import { mustBeAdmin } from "../../accesses/collections/mustBeAdmin"; +import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; import { CollectionGroups, Collections } from "../../constants"; import { afterOperationWebhook } from "../../hooks/afterOperationWebhook"; import { buildCollectionConfig } from "../../utils/collectionConfig"; @@ -23,8 +24,9 @@ export const Currencies = buildCollectionConfig({ defaultColumns: [fields.id], disableDuplicate: true, group: CollectionGroups.Meta, + hidden: shownOnlyToAdmin, }, - access: { create: mustBeAdmin, update: mustBeAdmin }, + access: { create: mustBeAdmin, update: mustBeAdmin, delete: mustBeAdmin }, hooks: { afterOperation: [afterOperationWebhook], }, diff --git a/src/collections/Folders/Folders.ts b/src/collections/Folders/Folders.ts index 99c1a48..46bb259 100644 --- a/src/collections/Folders/Folders.ts +++ b/src/collections/Folders/Folders.ts @@ -99,7 +99,13 @@ export const Folders = buildCollectionConfig({ { type: "relationship", name: fields.files, - relationTo: [Collections.Collectibles, Collections.Pages], + relationTo: [ + Collections.Collectibles, + Collections.Pages, + Collections.Videos, + Collections.Images, + Collections.Audios, + ], hasMany: true, }, ], diff --git a/src/collections/Folders/endpoints/getBySlugEndpoint.ts b/src/collections/Folders/endpoints/getBySlugEndpoint.ts index 4935170..ecb568a 100644 --- a/src/collections/Folders/endpoints/getBySlugEndpoint.ts +++ b/src/collections/Folders/endpoints/getBySlugEndpoint.ts @@ -35,7 +35,7 @@ export const getBySlugEndpoint = createGetByEndpoint({ }, files: files?.flatMap(({ relationTo, value }) => { - if (!isPayloadType(value) || !isPublished(value)) { + if (!isPayloadType(value) || ("_status" in value && !isPublished(value))) { return []; } @@ -44,6 +44,13 @@ export const getBySlugEndpoint = createGetByEndpoint({ return [{ relationTo, value: convertCollectibleToPreview(value) }]; case "pages": return [{ relationTo, value: convertPageToPreview(value) }]; + // TODO: handle media type files + case "images": + return []; + case "audios": + return []; + case "videos": + return []; } }) ?? [], parentPages: handleParentPages({ folders: parentFolders }), diff --git a/src/collections/Images/Images.ts b/src/collections/Images/Images.ts index be9b3d7..fce321c 100644 --- a/src/collections/Images/Images.ts +++ b/src/collections/Images/Images.ts @@ -1,4 +1,7 @@ import { Collections } from "../../constants"; +import { tagsField } from "../../fields/tagsField/tagsField"; +import { translatedFields } from "../../fields/translatedFields/translatedFields"; +import { createEditor } from "../../utils/editor"; import { buildImageCollectionConfig } from "../../utils/imageCollectionConfig"; const fields = { @@ -7,6 +10,10 @@ const fields = { filesize: "filesize", posts: "posts", updatedAt: "updatedAt", + translations: "translations", + translationsTitle: "title", + translationsDescription: "description", + tags: "tags", } as const satisfies Record; export const Images = buildImageCollectionConfig({ @@ -29,5 +36,19 @@ export const Images = buildImageCollectionConfig({ }, ], }, - fields: [], + fields: [ + translatedFields({ + name: fields.translations, + admin: { useAsTitle: fields.translationsTitle }, + fields: [ + { name: fields.translationsTitle, type: "text", required: true }, + { + name: fields.translationsDescription, + type: "richText", + editor: createEditor({ inlines: true, lists: true, links: true }), + }, + ], + }), + tagsField({ name: fields.tags }), + ], }); diff --git a/src/collections/Languages/Languages.ts b/src/collections/Languages/Languages.ts index 9d94b37..bc2fad2 100644 --- a/src/collections/Languages/Languages.ts +++ b/src/collections/Languages/Languages.ts @@ -1,6 +1,6 @@ import { text } from "payload/dist/fields/validations"; import { mustBeAdmin } from "../../accesses/collections/mustBeAdmin"; -import { publicAccess } from "../../accesses/publicAccess"; +import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; import { CollectionGroups, Collections } from "../../constants"; import { afterOperationWebhook } from "../../hooks/afterOperationWebhook"; import { buildCollectionConfig } from "../../utils/collectionConfig"; @@ -25,8 +25,9 @@ export const Languages = buildCollectionConfig({ disableDuplicate: true, group: CollectionGroups.Meta, pagination: { defaultLimit: 100 }, + hidden: shownOnlyToAdmin, }, - access: { create: mustBeAdmin, update: mustBeAdmin, read: publicAccess }, + access: { create: mustBeAdmin, update: mustBeAdmin, delete: mustBeAdmin }, hooks: { afterOperation: [afterOperationWebhook], }, diff --git a/src/collections/Scans/Scans.ts b/src/collections/Scans/Scans.ts index 8e31a8d..470f06f 100644 --- a/src/collections/Scans/Scans.ts +++ b/src/collections/Scans/Scans.ts @@ -1,3 +1,4 @@ +import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; import { Collections } from "../../constants"; import { buildImageCollectionConfig } from "../../utils/imageCollectionConfig"; @@ -14,7 +15,10 @@ export const Scans = buildImageCollectionConfig({ singular: "Scan", plural: "Scans", }, - admin: { defaultColumns: [fields.filename, fields.updatedAt], hidden: true }, + admin: { + defaultColumns: [fields.filename, fields.updatedAt], + hidden: shownOnlyToAdmin, + }, upload: { imageSizes: [ { diff --git a/src/collections/Videos/Videos.ts b/src/collections/Videos/Videos.ts index 685b441..4fbb28d 100644 --- a/src/collections/Videos/Videos.ts +++ b/src/collections/Videos/Videos.ts @@ -1,13 +1,118 @@ import { CollectionGroups, Collections } from "../../constants"; +import { componentField } from "../../fields/componentField/componentField"; +import { imageField } from "../../fields/imageField/imageField"; +import { rowField } from "../../fields/rowField/rowField"; +import { tagsField } from "../../fields/tagsField/tagsField"; +import { translatedFields } from "../../fields/translatedFields/translatedFields"; import { buildCollectionConfig } from "../../utils/collectionConfig"; +import { createEditor } from "../../utils/editor"; + +const fields = { + filename: "filename", + mimeType: "mimeType", + filesize: "filesize", + updatedAt: "updatedAt", + translations: "translations", + translationsTitle: "title", + translationsDescription: "description", + translationsSubfile: "subfile", + thumbnail: "thumbnail", + duration: "duration", + tags: "tags", + platform: "platform", + platformChannel: "channel", + platformViews: "views", + platformPublishedDate: "publishedDate", + platformUrl: "url", + platformLikes: "likes", + platformDislikes: "dislikes", +}; export const Videos = buildCollectionConfig({ slug: Collections.Videos, labels: { singular: "Video", plural: "Videos" }, - admin: { group: CollectionGroups.Media }, + defaultSort: fields.updatedAt, + admin: { + group: CollectionGroups.Media, + defaultColumns: [ + fields.filename, + fields.mimeType, + fields.filesize, + fields.translations, + fields.updatedAt, + ], + }, upload: { mimeTypes: ["video/*"], disableLocalStorage: true, }, - fields: [], + fields: [ + rowField([ + { name: fields.duration, type: "number", min: 0, required: true }, + imageField({ + name: fields.thumbnail, + relationTo: Collections.MediaThumbnails, + required: true, + }), + ]), + translatedFields({ + name: fields.translations, + admin: { useAsTitle: fields.translationsTitle }, + required: true, + minRows: 1, + fields: [ + { name: fields.translationsTitle, type: "text", required: true }, + { + name: fields.translationsDescription, + type: "richText", + editor: createEditor({ inlines: true, lists: true, links: true }), + }, + { + name: fields.translationsSubfile, + type: "upload", + relationTo: Collections.VideosSubtitles, + admin: { description: "The subtitle file needs to follow the WebVTT file format (.vtt)" }, + }, + ], + }), + tagsField({ name: fields.tags }), + componentField({ + name: fields.platform, + admin: { + description: + "If the video comes from a platform (e.g: YouTube, NicoNico, Tumblr...),\ + add additional informations here.", + }, + fields: [ + { + name: fields.platformChannel, + type: "relationship", + relationTo: Collections.VideosChannels, + required: true, + }, + rowField([ + { name: fields.platformViews, type: "number", min: 0 }, + { name: fields.platformLikes, type: "number", min: 0 }, + { name: fields.platformDislikes, type: "number", min: 0 }, + ]), + { + name: fields.platformUrl, + type: "text", + required: true, + admin: { + description: + "If the video comes from a platform (e.g: YouTube, NicoNico, Tumblr...), paste the URL here.", + }, + }, + { + name: fields.platformPublishedDate, + required: true, + type: "date", + admin: { + date: { pickerAppearance: "dayOnly", displayFormat: "yyyy-MM-dd" }, + }, + }, + ], + }), + ], }); diff --git a/src/collections/VideosChannels/VideosChannels.ts b/src/collections/VideosChannels/VideosChannels.ts new file mode 100644 index 0000000..227f2b0 --- /dev/null +++ b/src/collections/VideosChannels/VideosChannels.ts @@ -0,0 +1,41 @@ +import { CollectionConfig } from "payload/types"; +import { CollectionGroups, Collections } from "../../constants"; +import { backPropagationField } from "../../fields/backPropagationField/backPropagationField"; +import { rowField } from "../../fields/rowField/rowField"; +import { buildCollectionConfig } from "../../utils/collectionConfig"; + +const fields = { + url: "url", + title: "title", + subscribers: "subscribers", + videos: "videos", +} as const satisfies Record; + +export const VideosChannels: CollectionConfig = buildCollectionConfig({ + slug: Collections.VideosChannels, + labels: { + singular: "Videos Channel", + plural: "Videos Channels", + }, + defaultSort: fields.title, + admin: { + useAsTitle: fields.title, + defaultColumns: [fields.url, fields.title, fields.subscribers, fields.videos], + group: CollectionGroups.Media, + disableDuplicate: true, + }, + timestamps: false, + fields: [ + { name: fields.url, type: "text", required: true, unique: true }, + rowField([ + { name: fields.title, type: "text", required: true }, + { name: fields.subscribers, type: "number" }, + ]), + backPropagationField({ + name: fields.videos, + relationTo: Collections.Videos, + hasMany: true, + where: ({ id }) => ({ "platform.channel": { equals: id } }), + }), + ], +}); diff --git a/src/collections/VideosSubtitles/VideosSubtitles.ts b/src/collections/VideosSubtitles/VideosSubtitles.ts new file mode 100644 index 0000000..70a805d --- /dev/null +++ b/src/collections/VideosSubtitles/VideosSubtitles.ts @@ -0,0 +1,15 @@ +import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; +import { CollectionGroups, Collections } from "../../constants"; +import { buildCollectionConfig } from "../../utils/collectionConfig"; + +export const VideosSubtitles = buildCollectionConfig({ + slug: Collections.VideosSubtitles, + labels: { singular: "Video Subtitle", plural: "Videos Subtitles" }, + admin: { group: CollectionGroups.Media, disableDuplicate: true, hidden: shownOnlyToAdmin }, + upload: { + staticDir: `../uploads/${Collections.VideosSubtitles}`, + mimeTypes: ["text/*"], + }, + timestamps: false, + fields: [], +}); diff --git a/src/collections/VideosThumbnails/VideosThumbnails.ts b/src/collections/VideosThumbnails/VideosThumbnails.ts new file mode 100644 index 0000000..e0caba0 --- /dev/null +++ b/src/collections/VideosThumbnails/VideosThumbnails.ts @@ -0,0 +1,33 @@ +import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; +import { Collections } from "../../constants"; +import { buildImageCollectionConfig } from "../../utils/imageCollectionConfig"; + +const fields = { + filename: "filename", + mimeType: "mimeType", + filesize: "filesize", + updatedAt: "updatedAt", +} as const satisfies Record; + +export const MediaThumbnails = buildImageCollectionConfig({ + slug: Collections.MediaThumbnails, + labels: { + singular: "Media Thumbnail", + plural: "Media Thumbnails", + }, + admin: { defaultColumns: [fields.filename, fields.updatedAt], hidden: shownOnlyToAdmin }, + upload: { + imageSizes: [ + { + name: "og", + height: 750, + width: 1125, + formatOptions: { + format: "jpg", + options: { progressive: true, mozjpeg: true, compressionLevel: 9, quality: 60 }, + }, + }, + ], + }, + fields: [], +}); diff --git a/src/constants.ts b/src/constants.ts index d2fb4a8..370b181 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -3,11 +3,11 @@ import type { BreakBlock, Image, SectionBlock, TranscriptBlock } from "./types/c // END MOCKING SECTION export enum Collections { + Audios = "audios", ChronologyEvents = "chronology-events", Currencies = "currencies", Languages = "languages", Pages = "pages", - PagesThumbnails = "pages-thumbnails", Recorders = "recorders", Folders = "folders", Tags = "tags", @@ -18,6 +18,9 @@ export enum Collections { GenericContents = "generic-contents", HomeFolders = "home-folders", Videos = "videos", + VideosSubtitles = "videos-subtitles", + VideosChannels = "videos-channels", + MediaThumbnails = "media-thumbnails", Scans = "scans", } diff --git a/src/payload.config.ts b/src/payload.config.ts index ad40933..408fa55 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -3,6 +3,7 @@ import { mongooseAdapter } from "@payloadcms/db-mongodb"; import { cloudStorage } from "@payloadcms/plugin-cloud-storage"; import path from "path"; import { buildConfig } from "payload/config"; +import { Audios } from "./collections/Audios/Audios"; import { ChronologyEvents } from "./collections/ChronologyEvents/ChronologyEvents"; import { Collectibles } from "./collections/Collectibles/Collectibles"; import { Currencies } from "./collections/Currencies/Currencies"; @@ -11,7 +12,6 @@ import { GenericContents } from "./collections/GenericContents/GenericContents"; import { HomeFolders } from "./collections/HomeFolders/HomeFolders"; import { Images } from "./collections/Images/Images"; 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"; @@ -20,6 +20,7 @@ import { TagsGroups } from "./collections/TagsGroups/TagsGroups"; import { Videos } from "./collections/Videos/Videos"; import { VideosChannels } from "./collections/VideosChannels/VideosChannels"; import { VideosSubtitles } from "./collections/VideosSubtitles/VideosSubtitles"; +import { MediaThumbnails } from "./collections/VideosThumbnails/VideosThumbnails"; import { Wordings } from "./collections/Wordings/Wordings"; import { Icon } from "./components/Icon"; import { Logo } from "./components/Logo"; @@ -27,6 +28,14 @@ import { Collections } from "./constants"; import { ftpAdapter } from "./plugins/ftpAdapter"; import { createEditor } from "./utils/editor"; +const configuredFtpAdapter = ftpAdapter({ + host: process.env.FTP_HOST ?? "", + user: process.env.FTP_USER ?? "", + password: process.env.FTP_PASSWORD ?? "", + secure: false, + endpoint: process.env.FTP_BASE_URL ?? "", +}); + export default buildConfig({ serverURL: process.env.PAYLOAD_URI, admin: { @@ -48,6 +57,8 @@ export default buildConfig({ ChronologyEvents, Images, + Audios, + MediaThumbnails, Videos, VideosSubtitles, VideosChannels, @@ -76,13 +87,12 @@ export default buildConfig({ cloudStorage({ collections: { [Collections.Videos]: { - adapter: ftpAdapter({ - host: process.env.FTP_HOST ?? "", - user: process.env.FTP_USER ?? "", - password: process.env.FTP_PASSWORD ?? "", - secure: false, - endpoint: process.env.FTP_BASE_URL ?? "", - }), + adapter: configuredFtpAdapter, + disableLocalStorage: true, + disablePayloadAccessControl: true, + }, + [Collections.Audios]: { + adapter: configuredFtpAdapter, disableLocalStorage: true, disablePayloadAccessControl: true, }, diff --git a/src/types/collections.ts b/src/types/collections.ts index 0cd1f5a..bb7aa18 100644 --- a/src/types/collections.ts +++ b/src/types/collections.ts @@ -22,9 +22,12 @@ export interface Config { collectibles: Collectible; folders: Folder; "chronology-events": ChronologyEvent; - notes: Note; images: Image; + audios: Audio; + "media-thumbnails": MediaThumbnail; videos: Video; + "videos-subtitles": VideoSubtitle; + "videos-channels": VideosChannel; scans: Scan; tags: Tag; "tags-groups": TagsGroup; @@ -37,7 +40,7 @@ export interface Config { "payload-migrations": PayloadMigration; }; globals: { - "home-folders": HomeFolder; + config: Config1; }; } /** @@ -106,6 +109,29 @@ export interface Page { */ export interface Image { id: string; + translations?: + | { + language: string | Language; + title: string; + description?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ("ltr" | "rtl") | null; + format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + id?: string | null; + }[] + | null; + tags?: (string | Tag)[] | null; updatedAt: string; createdAt: string; url?: string | null; @@ -133,6 +159,14 @@ export interface Image { }; }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "languages". + */ +export interface Language { + id: string; + name: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "tags". @@ -150,14 +184,6 @@ export interface Tag { updatedAt: string; createdAt: string; } -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "languages". - */ -export interface Language { - id: string; - name: string; -} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "tags-groups". @@ -246,6 +272,18 @@ export interface Folder { relationTo: "pages"; value: string | Page; } + | { + relationTo: "videos"; + value: string | Video; + } + | { + relationTo: "images"; + value: string | Image; + } + | { + relationTo: "audios"; + value: string | Audio; + } )[] | null; updatedAt: string; @@ -383,6 +421,14 @@ export interface Collectible { | { relationTo: "generic-contents"; value: string | GenericContent; + } + | { + relationTo: "audios"; + value: string | Audio; + } + | { + relationTo: "videos"; + value: string | Video; }; range?: | ( @@ -402,23 +448,23 @@ export interface Collectible { } | { translations: { - language: string | Language; - note: { - root: { - type: string; - children: { - type: string; - version: number; - [k: string]: unknown; - }[]; - direction: ("ltr" | "rtl") | null; - format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; - indent: number; - version: number; - }; + language: string | Language; + note: { + root: { + type: string; + children: { + type: string; + version: number; [k: string]: unknown; - }; - id?: string | null; + }[]; + direction: ("ltr" | "rtl") | null; + format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; + indent: number; + version: number; + }; + [k: string]: unknown; + }; + id?: string | null; }[]; id?: string | null; blockName?: string | null; @@ -489,6 +535,150 @@ export interface GenericContent { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "audios". + */ +export interface Audio { + id: string; + duration: number; + thumbnail?: string | MediaThumbnail | null; + translations: { + language: string | Language; + title: string; + description?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ("ltr" | "rtl") | null; + format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + subfile?: string | VideoSubtitle | null; + id?: string | null; + }[]; + tags?: (string | Tag)[] | null; + updatedAt: string; + createdAt: string; + url?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media-thumbnails". + */ +export interface MediaThumbnail { + 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` "videos-subtitles". + */ +export interface VideoSubtitle { + id: string; + url?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "videos". + */ +export interface Video { + id: string; + duration: number; + thumbnail: string | MediaThumbnail; + translations: { + language: string | Language; + title: string; + description?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ("ltr" | "rtl") | null; + format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + subfile?: string | VideoSubtitle | null; + id?: string | null; + }[]; + tags?: (string | Tag)[] | null; + platformEnabled?: boolean | null; + platform?: { + channel: string | VideosChannel; + views?: number | null; + likes?: number | null; + dislikes?: number | null; + url: string; + publishedDate: string; + }; + updatedAt: string; + createdAt: string; + url?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "videos-channels". + */ +export interface VideosChannel { + id: string; + url: string; + title: string; + subscribers?: number | null; + videos?: (string | Video)[] | null; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "chronology-events". @@ -605,45 +795,6 @@ export interface PageBlock { blockName?: string | null; blockType: "pageBlock"; } -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "notes". - */ -export interface Note { - id: string; - note: { - root: { - type: string; - children: { - type: string; - version: number; - [k: string]: unknown; - }[]; - direction: ("ltr" | "rtl") | null; - format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; - indent: number; - version: number; - }; - [k: string]: unknown; - }; - updatedAt: string; - createdAt: string; -} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "videos". - */ -export interface Video { - id: string; - updatedAt: string; - createdAt: string; - url?: string | null; - filename?: string | null; - mimeType?: string | null; - filesize?: number | null; - width?: number | null; - height?: number | null; -} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "wordings". @@ -691,9 +842,9 @@ export interface PayloadMigration { } /** * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "home-folders". + * via the `definition` "config". */ -export interface HomeFolder { +export interface Config1 { id: string; folders?: | {