feat(blog): category and tag data structure

This commit is contained in:
RizqiSyahrendra 2025-02-12 16:58:51 +07:00
parent 27f9c83e8e
commit a16f9d0ca8
3 changed files with 17 additions and 2 deletions

View File

@ -17,12 +17,23 @@ export const BlogCategories: CollectionConfig = {
position: "sidebar",
},
hooks: {
beforeValidate: [formatSlug("title")],
beforeValidate: [formatSlug("name")],
},
},
{
name: "parent_category",
label: "Parent Category",
type: "relationship",
relationTo: "blogCategories",
},
{
name: "description",
type: "textarea",
},
],
admin: {
hideAPIURL: true,
group: "Blogs",
useAsTitle: "name",
},
};

View File

@ -17,7 +17,7 @@ export const BlogTags: CollectionConfig = {
position: "sidebar",
},
hooks: {
beforeValidate: [formatSlug("title")],
beforeValidate: [formatSlug("name")],
},
},
{

View File

@ -204,6 +204,8 @@ export interface BlogCategory {
id: number;
name: string;
slug?: string | null;
parent_category?: (number | null) | BlogCategory;
description?: string | null;
updatedAt: string;
createdAt: string;
}
@ -725,6 +727,8 @@ export interface TeamsSelect<T extends boolean = true> {
export interface BlogCategoriesSelect<T extends boolean = true> {
name?: T;
slug?: T;
parent_category?: T;
description?: T;
updatedAt?: T;
createdAt?: T;
}