fix: teams add slug

This commit is contained in:
RizqiSyahrendra 2025-03-05 20:08:52 +07:00
parent 89c40f6a98
commit b330c5296f
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import type { CollectionConfig } from "payload"; import type { CollectionConfig } from "payload";
import { lexicalEditor } from "@payloadcms/richtext-lexical"; import { lexicalEditor } from "@payloadcms/richtext-lexical";
import formatSlug from "@/utils/payload/formatSlug";
export const Teams: CollectionConfig = { export const Teams: CollectionConfig = {
slug: "teams", slug: "teams",
@ -9,6 +10,13 @@ export const Teams: CollectionConfig = {
type: "text", type: "text",
required: true, required: true,
}, },
{
name: "slug",
type: "text",
hooks: {
beforeValidate: [formatSlug("name")],
},
},
{ {
name: "role", name: "role",
type: "text", type: "text",

View File

@ -319,6 +319,7 @@ export interface Page {
export interface Team { export interface Team {
id: number; id: number;
name: string; name: string;
slug?: string | null;
role: string; role: string;
img: number | Media; img: number | Media;
biography?: { biography?: {
@ -762,6 +763,7 @@ export interface PagesSelect<T extends boolean = true> {
*/ */
export interface TeamsSelect<T extends boolean = true> { export interface TeamsSelect<T extends boolean = true> {
name?: T; name?: T;
slug?: T;
role?: T; role?: T;
img?: T; img?: T;
biography?: T; biography?: T;