diff --git a/apps/cms/src/collections/Challenges.ts b/apps/cms/src/collections/Challenges.ts new file mode 100644 index 000000000..c992494a1 --- /dev/null +++ b/apps/cms/src/collections/Challenges.ts @@ -0,0 +1,34 @@ +import type { CollectionConfig } from 'payload'; + +export const Challenges: CollectionConfig = { + slug: 'challenges', + fields: [ + { + name: 'title', + type: 'text', + required: true, + }, + { + name: 'description', + type: 'textarea', + }, + { + name: 'prizes', + type: 'textarea', + }, + { + name: 'judgingRubric', + type: 'textarea', + }, + { + name: 'sponsor', + type: 'relationship', + relationTo: 'sponsors', + }, + { + name: 'hackathon', + type: 'relationship', + relationTo: 'hackathons', + }, + ], +}; diff --git a/apps/cms/src/collections/Events.ts b/apps/cms/src/collections/Events.ts new file mode 100644 index 000000000..f4c699f1e --- /dev/null +++ b/apps/cms/src/collections/Events.ts @@ -0,0 +1,30 @@ +import type { CollectionConfig } from 'payload'; + +export const Events: CollectionConfig = { + slug: 'events', + fields: [ + { + name: 'title', + type: 'text', + required: true, + }, + { + name: 'description', + type: 'textarea', + }, + { + name: 'room', + type: 'text', + }, + { + name: 'type', + type: 'select', + options: ['workshop', 'networking', 'social', 'food', 'other'], + }, + { + name: 'hackathon', + type: 'relationship', + relationTo: 'hackathons', + }, + ], +}; diff --git a/apps/cms/src/collections/Hackathons.ts b/apps/cms/src/collections/Hackathons.ts new file mode 100644 index 000000000..f50b4b7f4 --- /dev/null +++ b/apps/cms/src/collections/Hackathons.ts @@ -0,0 +1,33 @@ +import type { CollectionConfig } from 'payload'; + +export const Hackathons: CollectionConfig = { + slug: 'hackathons', + fields: [ + { + name: 'year', + type: 'number', + required: true, + unique: true, + }, + { + name: 'theme', + type: 'text', + }, + { + name: 'sponsors', + type: 'relationship', + relationTo: 'sponsors', + hasMany: true, + }, + { + name: 'description', + type: 'richText', + }, + { + name: 'participants', + type: 'relationship', + relationTo: 'participants', + hasMany: true, + }, + ], +}; diff --git a/apps/cms/src/collections/Participants.ts b/apps/cms/src/collections/Participants.ts new file mode 100644 index 000000000..b955dd6ce --- /dev/null +++ b/apps/cms/src/collections/Participants.ts @@ -0,0 +1,23 @@ +import type { CollectionConfig } from 'payload'; + +export const Participants: CollectionConfig = { + slug: 'participants', + fields: [ + { + name: 'name', + type: 'text', + required: true, + }, + { + name: 'role', + type: 'select', + options: ['organizer', 'volunteer', 'mentor', 'judge', 'sponsor-representative'], + required: true, + }, + { + name: 'company', + type: 'relationship', + relationTo: 'sponsors', + }, + ], +}; diff --git a/apps/cms/src/collections/Schedule.ts b/apps/cms/src/collections/Schedule.ts new file mode 100644 index 000000000..8ac0ec61b --- /dev/null +++ b/apps/cms/src/collections/Schedule.ts @@ -0,0 +1,24 @@ +import type { CollectionConfig } from 'payload'; + +export const Schedule: CollectionConfig = { + slug: 'schedule', + fields: [ + { + name: 'event', + type: 'relationship', + relationTo: 'events', + required: true, + }, + { + name: 'time', + type: 'text', + required: true, + }, + { + name: 'day', + type: 'select', + options: ['Friday', 'Saturday', 'Sunday'], + required: true, + }, + ], +}; diff --git a/apps/cms/src/collections/Sponsors.ts b/apps/cms/src/collections/Sponsors.ts new file mode 100644 index 000000000..a40c76a51 --- /dev/null +++ b/apps/cms/src/collections/Sponsors.ts @@ -0,0 +1,30 @@ +import type { CollectionConfig } from 'payload'; + +export const Sponsors: CollectionConfig = { + slug: 'sponsors', + fields: [ + { + name: 'name', + type: 'text', + required: true, + }, + { + name: 'logo', + type: 'upload', + relationTo: 'media', // Assuming a media collection exists for file uploads + }, + { + name: 'link', + type: 'text', + required: true, + validate: (value) => { + try { + new URL(value); + return true; + } catch { + return 'Invalid URL format'; + } + }, + }, + ], +}; diff --git a/apps/cms/src/payload-types.ts b/apps/cms/src/payload-types.ts index bdfa0ab72..327a4a90c 100644 --- a/apps/cms/src/payload-types.ts +++ b/apps/cms/src/payload-types.ts @@ -11,16 +11,30 @@ export interface Config { users: UserAuthOperations; }; collections: { + hackathons: Hackathon; users: User; media: Media; + 'social-links': SocialLink; + sponsors: Sponsor; + participants: Participant; + events: Event; + challenges: Challenge; + schedule: Schedule; 'payload-locked-documents': PayloadLockedDocument; 'payload-preferences': PayloadPreference; 'payload-migrations': PayloadMigration; }; collectionsJoins: {}; collectionsSelect: { + hackathons: HackathonsSelect | HackathonsSelect; users: UsersSelect | UsersSelect; media: MediaSelect | MediaSelect; + 'social-links': SocialLinksSelect | SocialLinksSelect; + sponsors: SponsorsSelect | SponsorsSelect; + participants: ParticipantsSelect | ParticipantsSelect; + events: EventsSelect | EventsSelect; + challenges: ChallengesSelect | ChallengesSelect; + schedule: ScheduleSelect | ScheduleSelect; 'payload-locked-documents': PayloadLockedDocumentsSelect | PayloadLockedDocumentsSelect; 'payload-preferences': PayloadPreferencesSelect | PayloadPreferencesSelect; 'payload-migrations': PayloadMigrationsSelect | PayloadMigrationsSelect; @@ -59,20 +73,43 @@ export interface UserAuthOperations { } /** * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "users". + * via the `definition` "hackathons". */ -export interface User { +export interface Hackathon { id: number; + year: number; + theme?: string | null; + sponsors?: (number | Sponsor)[] | null; + 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; + participants?: (number | Participant)[] | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "sponsors". + */ +export interface Sponsor { + id: number; + name: string; + logo?: (number | null) | Media; + link: string; updatedAt: string; createdAt: string; - email: string; - resetPasswordToken?: string | null; - resetPasswordExpiration?: string | null; - salt?: string | null; - hash?: string | null; - loginAttempts?: number | null; - lockUntil?: string | null; - password?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema @@ -93,6 +130,99 @@ export interface Media { focalX?: number | null; focalY?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "participants". + */ +export interface Participant { + id: number; + name: string; + role: 'organizer' | 'volunteer' | 'mentor' | 'judge' | 'sponsor-representative'; + company?: (number | null) | Sponsor; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: number; + updatedAt: string; + createdAt: string; + email: string; + resetPasswordToken?: string | null; + resetPasswordExpiration?: string | null; + salt?: string | null; + hash?: string | null; + loginAttempts?: number | null; + lockUntil?: string | null; + password?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "social-links". + */ +export interface SocialLink { + id: number; + platform: + | 'website' + | 'portal' + | 'design' + | 'architecture' + | 'ESLint' + | 'discord' + | 'instagram' + | 'linkedin' + | 'linktree' + | 'figma' + | 'github-project' + | 'github-repo'; + url: string; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "events". + */ +export interface Event { + id: number; + title: string; + description?: string | null; + room?: string | null; + type?: ('workshop' | 'networking' | 'social' | 'food' | 'other') | null; + hackathon?: (number | null) | Hackathon; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "challenges". + */ +export interface Challenge { + id: number; + title: string; + description?: string | null; + prizes?: string | null; + judgingRubric?: string | null; + sponsor?: (number | null) | Sponsor; + hackathon?: (number | null) | Hackathon; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "schedule". + */ +export interface Schedule { + id: number; + event: number | Event; + time: string; + day: 'Friday' | 'Saturday' | 'Sunday'; + updatedAt: string; + createdAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-locked-documents". @@ -100,6 +230,10 @@ export interface Media { export interface PayloadLockedDocument { id: number; document?: + | ({ + relationTo: 'hackathons'; + value: number | Hackathon; + } | null) | ({ relationTo: 'users'; value: number | User; @@ -107,6 +241,30 @@ export interface PayloadLockedDocument { | ({ relationTo: 'media'; value: number | Media; + } | null) + | ({ + relationTo: 'social-links'; + value: number | SocialLink; + } | null) + | ({ + relationTo: 'sponsors'; + value: number | Sponsor; + } | null) + | ({ + relationTo: 'participants'; + value: number | Participant; + } | null) + | ({ + relationTo: 'events'; + value: number | Event; + } | null) + | ({ + relationTo: 'challenges'; + value: number | Challenge; + } | null) + | ({ + relationTo: 'schedule'; + value: number | Schedule; } | null); globalSlug?: string | null; user: { @@ -150,6 +308,19 @@ export interface PayloadMigration { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "hackathons_select". + */ +export interface HackathonsSelect { + year?: T; + theme?: T; + sponsors?: T; + description?: T; + participants?: T; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users_select". @@ -183,6 +354,76 @@ export interface MediaSelect { focalX?: T; focalY?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "social-links_select". + */ +export interface SocialLinksSelect { + platform?: T; + url?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "sponsors_select". + */ +export interface SponsorsSelect { + name?: T; + logo?: T; + link?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "participants_select". + */ +export interface ParticipantsSelect { + name?: T; + role?: T; + company?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "events_select". + */ +export interface EventsSelect { + title?: T; + description?: T; + room?: T; + type?: T; + hackathon?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "challenges_select". + */ +export interface ChallengesSelect { + title?: T; + description?: T; + prizes?: T; + judgingRubric?: T; + sponsor?: T; + hackathon?: T; + updatedAt?: T; + createdAt?: T; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "schedule_select". + */ +export interface ScheduleSelect { + event?: T; + time?: T; + day?: T; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-locked-documents_select". diff --git a/apps/cms/src/payload.config.ts b/apps/cms/src/payload.config.ts index 67eed92ec..33b2482fc 100644 --- a/apps/cms/src/payload.config.ts +++ b/apps/cms/src/payload.config.ts @@ -10,6 +10,12 @@ import sharp from 'sharp' import { Users } from './collections/Users' import { Media } from './collections/Media' import { SocialLinks } from './collections/SocialLinks' +import { Sponsors } from './collections/Sponsors' +import { Hackathons } from './collections/Hackathons' +import { Participants } from './collections/Participants' +import { Events } from './collections/Events' +import { Challenges } from './collections/Challenges' +import { Schedule } from './collections/Schedule' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) @@ -22,9 +28,15 @@ export default buildConfig({ }, }, collections: [ + Hackathons, Users, Media, SocialLinks, + Sponsors, + Participants, + Events, + Challenges, + Schedule ], editor: lexicalEditor(), secret: process.env.PAYLOAD_SECRET || '',