diff --git a/src/collections/Links.ts b/src/collections/Links.ts new file mode 100644 index 0000000..8979903 --- /dev/null +++ b/src/collections/Links.ts @@ -0,0 +1,35 @@ +import { isEvents } from '@/access/isEvents'; +import type { CollectionConfig } from 'payload'; + +export const Links: CollectionConfig = { + slug: 'links', + admin: { + useAsTitle: 'title', + }, + fields: [ + { + name: 'title', + type: 'text', + required: true, + }, + { + name: 'url', + type: 'text', + required: true, + }, + { + name: 'description', + type: 'textarea', + required: false, + }, + ], + access: { + create: isEvents, + update: isEvents, + delete: isEvents, + read: () => true, + }, + versions: { + drafts: true, + }, +}; diff --git a/src/payload-types.ts b/src/payload-types.ts index 7b061a1..0c39ce0 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -69,6 +69,7 @@ export interface Config { users: User; media: Media; events: Event; + links: Link; sponsors: Sponsor; 'tech-stack': TechStack; projects: Project; @@ -84,6 +85,7 @@ export interface Config { users: UsersSelect | UsersSelect; media: MediaSelect | MediaSelect; events: EventsSelect | EventsSelect; + links: LinksSelect | LinksSelect; sponsors: SponsorsSelect | SponsorsSelect; 'tech-stack': TechStackSelect | TechStackSelect; projects: ProjectsSelect | ProjectsSelect; @@ -135,10 +137,6 @@ export interface UserAuthOperations { /** This interface was referenced by `Config`'s JSON-Schema via the `definition` "users". */ export interface User { id: string; - email: string; - emailVerified?: string | null; - name?: string | null; - image?: string | null; /** Users can have one or many roles */ roles?: | ( @@ -152,16 +150,23 @@ export interface User { | 'exec' )[] | null; - accounts?: + updatedAt: string; + createdAt: string; + email: string; + resetPasswordToken?: string | null; + resetPasswordExpiration?: string | null; + salt?: string | null; + hash?: string | null; + loginAttempts?: number | null; + lockUntil?: string | null; + sessions?: | { - id?: string | null; - provider: string; - providerAccountId: string; - type: string; + id: string; + createdAt?: string | null; + expiresAt: string; }[] | null; - updatedAt: string; - createdAt: string; + password?: string | null; } /** This interface was referenced by `Config`'s JSON-Schema via the `definition` "media". */ export interface Media { @@ -216,6 +221,16 @@ export interface Event { createdAt: string; _status?: ('draft' | 'published') | null; } +/** This interface was referenced by `Config`'s JSON-Schema via the `definition` "links". */ +export interface Link { + id: string; + title: string; + url: string; + description?: string | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; +} /** * Please upload a banner image to media before filling in sponsor. * @@ -325,6 +340,10 @@ export interface PayloadLockedDocument { relationTo: 'events'; value: string | Event; } | null) + | ({ + relationTo: 'links'; + value: string | Link; + } | null) | ({ relationTo: 'sponsors'; value: string | Sponsor; @@ -393,22 +412,23 @@ export interface PayloadMigration { } /** This interface was referenced by `Config`'s JSON-Schema via the `definition` "users_select". */ export interface UsersSelect { - id?: T; - email?: T; - emailVerified?: T; - name?: T; - image?: T; roles?: T; - accounts?: + updatedAt?: T; + createdAt?: T; + email?: T; + resetPasswordToken?: T; + resetPasswordExpiration?: T; + salt?: T; + hash?: T; + loginAttempts?: T; + lockUntil?: T; + sessions?: | T | { id?: T; - provider?: T; - providerAccountId?: T; - type?: T; + createdAt?: T; + expiresAt?: T; }; - updatedAt?: T; - createdAt?: T; } /** This interface was referenced by `Config`'s JSON-Schema via the `definition` "media_select". */ export interface MediaSelect { @@ -450,6 +470,15 @@ export interface EventsSelect { createdAt?: T; _status?: T; } +/** This interface was referenced by `Config`'s JSON-Schema via the `definition` "links_select". */ +export interface LinksSelect { + title?: T; + url?: T; + description?: T; + updatedAt?: T; + createdAt?: T; + _status?: T; +} /** This interface was referenced by `Config`'s JSON-Schema via the `definition` "sponsors_select". */ export interface SponsorsSelect { 'Company name'?: T; diff --git a/src/payload.config.ts b/src/payload.config.ts index d6b9b5b..e554482 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -12,6 +12,7 @@ import { CommitteeMembers } from './collections/CommitteeMembers'; import { Events } from './collections/Events'; import { Gallery } from './collections/Gallery'; import { KnownSpamMessages } from './collections/KnownSpamMessages'; +import { Links } from './collections/Links'; import { Media } from './collections/Media'; import { Projects } from './collections/Projects'; import { Sponsors } from './collections/Sponsors'; @@ -91,6 +92,7 @@ export default buildConfig({ Users, Media, Events, + Links, Sponsors, Tech_Stack, Projects,