added categories to projects
This commit is contained in:
@@ -49,7 +49,12 @@ export const Projects: CollectionConfig = {
|
||||
{
|
||||
label: 'Settings',
|
||||
fields: [
|
||||
|
||||
{
|
||||
name: 'categories',
|
||||
type: 'relationship',
|
||||
hasMany: true,
|
||||
relationTo: 'categories'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -69,6 +69,7 @@ export interface Config {
|
||||
collections: {
|
||||
pages: Page;
|
||||
projects: Project;
|
||||
categories: Category;
|
||||
users: User;
|
||||
media: Media;
|
||||
'payload-locked-documents': PayloadLockedDocument;
|
||||
@@ -79,6 +80,7 @@ export interface Config {
|
||||
collectionsSelect: {
|
||||
pages: PagesSelect<false> | PagesSelect<true>;
|
||||
projects: ProjectsSelect<false> | ProjectsSelect<true>;
|
||||
categories: CategoriesSelect<false> | CategoriesSelect<true>;
|
||||
users: UsersSelect<false> | UsersSelect<true>;
|
||||
media: MediaSelect<false> | MediaSelect<true>;
|
||||
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
||||
@@ -172,6 +174,7 @@ export interface Project {
|
||||
} | null;
|
||||
link?: string | null;
|
||||
github?: string | null;
|
||||
categories?: (number | Category)[] | null;
|
||||
/**
|
||||
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
||||
*/
|
||||
@@ -182,6 +185,21 @@ export interface Project {
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "categories".
|
||||
*/
|
||||
export interface Category {
|
||||
id: number;
|
||||
title: string;
|
||||
/**
|
||||
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
||||
*/
|
||||
generateSlug?: boolean | null;
|
||||
slug: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
@@ -242,6 +260,10 @@ export interface PayloadLockedDocument {
|
||||
relationTo: 'projects';
|
||||
value: number | Project;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'categories';
|
||||
value: number | Category;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'users';
|
||||
value: number | User;
|
||||
@@ -314,6 +336,7 @@ export interface ProjectsSelect<T extends boolean = true> {
|
||||
richText?: T;
|
||||
link?: T;
|
||||
github?: T;
|
||||
categories?: T;
|
||||
generateSlug?: T;
|
||||
slug?: T;
|
||||
featuredProject?: T;
|
||||
@@ -321,6 +344,17 @@ export interface ProjectsSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "categories_select".
|
||||
*/
|
||||
export interface CategoriesSelect<T extends boolean = true> {
|
||||
title?: T;
|
||||
generateSlug?: T;
|
||||
slug?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users_select".
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Users } from './collections/Users'
|
||||
import { Media } from './collections/Media'
|
||||
import { Page } from './collections/Page'
|
||||
import { Projects } from './collections/Projects'
|
||||
import { Categories } from './collections/Categories'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
@@ -22,7 +23,7 @@ export default buildConfig({
|
||||
baseDir: path.resolve(dirname),
|
||||
},
|
||||
},
|
||||
collections: [Page, Projects, Users, Media],
|
||||
collections: [Page, Projects, Categories, Users, Media],
|
||||
editor: lexicalEditor({
|
||||
features: ({ defaultFeatures, rootFeatures }) => [
|
||||
...defaultFeatures,
|
||||
|
||||
Reference in New Issue
Block a user