diff --git a/src/collections/Concerts.ts b/src/collections/Concerts.ts new file mode 100644 index 0000000..cf4bd4f --- /dev/null +++ b/src/collections/Concerts.ts @@ -0,0 +1,62 @@ +import type { CollectionConfig } from 'payload' + +export const Concerts: CollectionConfig = { + slug: 'concerts', + fields: [ + { + name: 'title', + type: 'text', + required: true + }, + { + name: 'description', + type: 'richText', + required: true + }, + { + name: 'photo', + type: 'upload', + relationTo: 'media', + required: true + }, + { + name: 'pdf', + type: 'text' + }, + { + name: 'repertoire', + type: 'array', + fields: [ + {name: 'composer', type: 'text', required: true}, + {name: 'workTitle', type: 'text', required: true}, + {name: 'soloist', type: 'text'}, + {name: 'movements', type: 'text'} + ], + // minimum of one array item + required: true + }, + { + name: 'performances', + type: 'array', + fields: [ + {name: 'dateTime', type: 'date', required: true}, + {name: 'venue', type: 'text'}, + {name: 'venueAddress', type: 'text', required: true}, + {name: 'bookingUrl', type: 'text', required: true}, + {name: 'price', type: 'text', required: true} + ], + // minimum of one array item + required: true + }, + { + name: 'photo_links', + type: 'array', + fields: [{name: 'link', type: 'text'}] + }, + { + name: 'video_links', + type: 'array', + fields: [{name: 'link', type: 'text'}] + } + ] +} diff --git a/src/payload-types.ts b/src/payload-types.ts index 14f4e43..cc849c6 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -70,6 +70,7 @@ export interface Config { users: User; media: Media; partners: Partner; + concerts: Concert; pages: Page; passwords: Password; links: Link; @@ -83,6 +84,7 @@ export interface Config { users: UsersSelect | UsersSelect; media: MediaSelect | MediaSelect; partners: PartnersSelect | PartnersSelect; + concerts: ConcertsSelect | ConcertsSelect; pages: PagesSelect | PagesSelect; passwords: PasswordsSelect | PasswordsSelect; links: LinksSelect | LinksSelect; @@ -183,6 +185,60 @@ export interface Partner { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "concerts". + */ +export interface Concert { + id: string; + title: string; + description: { + root: { + type: string; + children: { + type: any; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + }; + photo: string | Media; + pdf?: string | null; + repertoire: { + composer: string; + workTitle: string; + soloist?: string | null; + movements?: string | null; + id?: string | null; + }[]; + performances: { + dateTime: string; + venue?: string | null; + venueAddress: string; + bookingUrl: string; + price: string; + id?: string | null; + }[]; + photo_links?: + | { + link?: string | null; + id?: string | null; + }[] + | null; + video_links?: + | { + link?: string | null; + id?: string | null; + }[] + | null; + updatedAt: string; + createdAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "pages". @@ -312,7 +368,7 @@ export interface PayloadKv { export interface PayloadLockedDocument { id: string; document?: - | ({ + | ({ relationTo: 'users'; value: string | User; } | null) @@ -324,6 +380,10 @@ export interface PayloadLockedDocument { relationTo: 'partners'; value: string | Partner; } | null) + | ({ + relationTo: 'concerts'; + value: string | Concert; + } | null) | ({ relationTo: 'pages'; value: string | Page; @@ -431,6 +491,49 @@ export interface PartnersSelect { updatedAt?: T; createdAt?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "concerts_select". + */ +export interface ConcertsSelect { + title?: T; + description?: T; + photo?: T; + pdf?: T; + repertoire?: + | T + | { + composer?: T; + workTitle?: T; + soloist?: T; + movements?: T; + id?: T; + }; + performances?: + | T + | { + dateTime?: T; + venue?: T; + venueAddress?: T; + bookingUrl?: T; + price?: T; + id?: T; + }; + photo_links?: + | T + | { + link?: T; + id?: T; + }; + video_links?: + | T + | { + link?: T; + id?: T; + }; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "pages_select". diff --git a/src/payload.config.ts b/src/payload.config.ts index fe6914c..788de56 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -8,6 +8,7 @@ import sharp from 'sharp' import { Users } from './collections/Users' import { Media } from './collections/Media' import { Partners } from './collections/Partners' +import { Concerts } from './collections/Concerts' import { Pages } from './collections/Pages' import { Passwords } from './collections/Passwords' import { CalendarLink } from './collections/CalendarLink' @@ -22,7 +23,7 @@ export default buildConfig({ baseDir: path.resolve(dirname), }, }, - collections: [Users, Media, Partners, Pages, Passwords, CalendarLink], + collections: [Users, Media, Partners, Pages, Passwords, CalendarLink, Concerts], editor: lexicalEditor(), secret: process.env.PAYLOAD_SECRET || '', typescript: {