diff --git a/src/collections/Teams.ts b/src/collections/Teams.ts index f3748eb..65dea1c 100644 --- a/src/collections/Teams.ts +++ b/src/collections/Teams.ts @@ -1,5 +1,6 @@ import type { CollectionConfig } from "payload"; import { lexicalEditor } from "@payloadcms/richtext-lexical"; +import formatSlug from "@/utils/payload/formatSlug"; export const Teams: CollectionConfig = { slug: "teams", @@ -9,6 +10,13 @@ export const Teams: CollectionConfig = { type: "text", required: true, }, + { + name: "slug", + type: "text", + hooks: { + beforeValidate: [formatSlug("name")], + }, + }, { name: "role", type: "text", diff --git a/src/payload-types.ts b/src/payload-types.ts index 9987a52..036a1c9 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -319,6 +319,7 @@ export interface Page { export interface Team { id: number; name: string; + slug?: string | null; role: string; img: number | Media; biography?: { @@ -762,6 +763,7 @@ export interface PagesSelect { */ export interface TeamsSelect { name?: T; + slug?: T; role?: T; img?: T; biography?: T;