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", position: "sidebar",
}, },
hooks: { hooks: {
beforeValidate: [formatSlug("title")], beforeValidate: [formatSlug("name")],
}, },
}, },
{
name: "parent_category",
label: "Parent Category",
type: "relationship",
relationTo: "blogCategories",
},
{
name: "description",
type: "textarea",
},
], ],
admin: { admin: {
hideAPIURL: true, hideAPIURL: true,
group: "Blogs", group: "Blogs",
useAsTitle: "name",
}, },
}; };

View File

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

View File

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