feat: created core collections
This commit is contained in:
parent
828ec41a8b
commit
797054a550
@ -1,5 +1,47 @@
|
||||
|
||||
import { RscEntryLexicalCell as RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
|
||||
import { RscEntryLexicalField as RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
|
||||
import { InlineToolbarFeatureClient as InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { HorizontalRuleFeatureClient as HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { UploadFeatureClient as UploadFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { BlockquoteFeatureClient as BlockquoteFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { RelationshipFeatureClient as RelationshipFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { LinkFeatureClient as LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { ChecklistFeatureClient as ChecklistFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { OrderedListFeatureClient as OrderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { UnorderedListFeatureClient as UnorderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { IndentFeatureClient as IndentFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { AlignFeatureClient as AlignFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { HeadingFeatureClient as HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { ParagraphFeatureClient as ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { InlineCodeFeatureClient as InlineCodeFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { SuperscriptFeatureClient as SuperscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { SubscriptFeatureClient as SubscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { StrikethroughFeatureClient as StrikethroughFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { UnderlineFeatureClient as UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { BoldFeatureClient as BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
import { ItalicFeatureClient as ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||
|
||||
export const importMap = {
|
||||
|
||||
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell": RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e,
|
||||
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalField": RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e,
|
||||
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient": HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#UploadFeatureClient": UploadFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#BlockquoteFeatureClient": BlockquoteFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#RelationshipFeatureClient": RelationshipFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#ChecklistFeatureClient": ChecklistFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#OrderedListFeatureClient": OrderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#UnorderedListFeatureClient": UnorderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#IndentFeatureClient": IndentFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#AlignFeatureClient": AlignFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#HeadingFeatureClient": HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#ParagraphFeatureClient": ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#InlineCodeFeatureClient": InlineCodeFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#SuperscriptFeatureClient": SuperscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#SubscriptFeatureClient": SubscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#StrikethroughFeatureClient": StrikethroughFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ export const Authors: CollectionConfig = {
|
||||
label: 'last, first name',
|
||||
type: 'text',
|
||||
required: true,
|
||||
unique: true,
|
||||
index: true,
|
||||
},
|
||||
{
|
||||
@ -33,6 +32,6 @@ export const Authors: CollectionConfig = {
|
||||
value: 'Translator'
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@ -2,6 +2,9 @@ import { CollectionConfig } from "payload";
|
||||
|
||||
export const Books: CollectionConfig = {
|
||||
slug: "books",
|
||||
admin: {
|
||||
useAsTitle: 'title'
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: "books_id", // This is from the import
|
||||
@ -21,7 +24,43 @@ export const Books: CollectionConfig = {
|
||||
type: "relationship",
|
||||
relationTo: "authors",
|
||||
hasMany: true,
|
||||
maxDepth: 200,
|
||||
},
|
||||
{
|
||||
name: 'pages',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
name: 'lcc',
|
||||
type: 'text',
|
||||
unique: true,
|
||||
},
|
||||
{
|
||||
name: 'publication',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
label: 'Publication Date',
|
||||
name: 'date',
|
||||
type: 'date',
|
||||
admin: {
|
||||
date: {
|
||||
pickerAppearance: 'dayOnly'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'genre',
|
||||
type: 'relationship',
|
||||
relationTo: 'genre',
|
||||
hasMany: true,
|
||||
admin: {
|
||||
allowEdit: true,
|
||||
allowCreate: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
type: 'richText'
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
13
src/collections/Books/Genre.ts
Normal file
13
src/collections/Books/Genre.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { CollectionConfig } from "payload";
|
||||
|
||||
export const Genre: CollectionConfig = {
|
||||
slug: 'genre',
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'text',
|
||||
unique: true,
|
||||
required: true,
|
||||
}
|
||||
]
|
||||
}
|
||||
30
src/collections/Copies/Copies.ts
Normal file
30
src/collections/Copies/Copies.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { CollectionConfig } from "payload";
|
||||
|
||||
export const Copies: CollectionConfig = {
|
||||
slug: 'copies',
|
||||
fields: [
|
||||
{
|
||||
name: 'condition',
|
||||
label: 'Condition out of 5',
|
||||
type: 'number',
|
||||
min: 1,
|
||||
max: 5,
|
||||
},
|
||||
{
|
||||
name: 'book',
|
||||
type: 'relationship',
|
||||
relationTo: 'books',
|
||||
hasMany: false,
|
||||
},
|
||||
{
|
||||
name: 'repository',
|
||||
type: 'relationship',
|
||||
relationTo: 'repositories',
|
||||
hasMany: false,
|
||||
},
|
||||
{
|
||||
name: 'notes',
|
||||
type: 'richText'
|
||||
}
|
||||
]
|
||||
}
|
||||
35
src/collections/Repositories/Repositories.ts
Normal file
35
src/collections/Repositories/Repositories.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { CollectionConfig } from "payload";
|
||||
|
||||
export const Repositories: CollectionConfig = {
|
||||
slug: 'repositories', admin: {
|
||||
useAsTitle: 'name'
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'text',
|
||||
required: true,
|
||||
unique: true
|
||||
},
|
||||
{
|
||||
name: 'abbreviation',
|
||||
type: 'text',
|
||||
required: true,
|
||||
unique: true,
|
||||
admin: {
|
||||
description: 'This is used to help identify which copies belong to this repo.'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'owner',
|
||||
type: 'relationship',
|
||||
relationTo: 'users',
|
||||
hasMany: true,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'dateOpenToPublic',
|
||||
type: 'date'
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -71,6 +71,9 @@ export interface Config {
|
||||
media: Media;
|
||||
books: Book;
|
||||
authors: Author;
|
||||
repositories: Repository;
|
||||
copies: Copy;
|
||||
genre: Genre;
|
||||
'payload-locked-documents': PayloadLockedDocument;
|
||||
'payload-preferences': PayloadPreference;
|
||||
'payload-migrations': PayloadMigration;
|
||||
@ -81,6 +84,9 @@ export interface Config {
|
||||
media: MediaSelect<false> | MediaSelect<true>;
|
||||
books: BooksSelect<false> | BooksSelect<true>;
|
||||
authors: AuthorsSelect<false> | AuthorsSelect<true>;
|
||||
repositories: RepositoriesSelect<false> | RepositoriesSelect<true>;
|
||||
copies: CopiesSelect<false> | CopiesSelect<true>;
|
||||
genre: GenreSelect<false> | GenreSelect<true>;
|
||||
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
||||
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
|
||||
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
|
||||
@ -162,6 +168,26 @@ export interface Book {
|
||||
books_id?: string | null;
|
||||
title?: string | null;
|
||||
authors?: (number | Author)[] | null;
|
||||
pages?: number | null;
|
||||
lcc?: string | null;
|
||||
publication?: string | null;
|
||||
date?: string | null;
|
||||
genre?: (number | Genre)[] | null;
|
||||
description?: {
|
||||
root: {
|
||||
type: string;
|
||||
children: {
|
||||
type: string;
|
||||
version: number;
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
direction: ('ltr' | 'rtl') | null;
|
||||
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
||||
indent: number;
|
||||
version: number;
|
||||
};
|
||||
[k: string]: unknown;
|
||||
} | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
@ -177,6 +203,59 @@ export interface Author {
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "genre".
|
||||
*/
|
||||
export interface Genre {
|
||||
id: number;
|
||||
name: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "repositories".
|
||||
*/
|
||||
export interface Repository {
|
||||
id: number;
|
||||
name: string;
|
||||
/**
|
||||
* This is used to help identify which copies belong to this repo.
|
||||
*/
|
||||
abbreviation: string;
|
||||
owner: (number | User)[];
|
||||
dateOpenToPublic?: string | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "copies".
|
||||
*/
|
||||
export interface Copy {
|
||||
id: number;
|
||||
condition?: number | null;
|
||||
book?: (number | null) | Book;
|
||||
repository?: (number | null) | Repository;
|
||||
notes?: {
|
||||
root: {
|
||||
type: string;
|
||||
children: {
|
||||
type: string;
|
||||
version: number;
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
direction: ('ltr' | 'rtl') | null;
|
||||
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
||||
indent: number;
|
||||
version: number;
|
||||
};
|
||||
[k: string]: unknown;
|
||||
} | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "payload-locked-documents".
|
||||
@ -199,6 +278,18 @@ export interface PayloadLockedDocument {
|
||||
| ({
|
||||
relationTo: 'authors';
|
||||
value: number | Author;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'repositories';
|
||||
value: number | Repository;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'copies';
|
||||
value: number | Copy;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'genre';
|
||||
value: number | Genre;
|
||||
} | null);
|
||||
globalSlug?: string | null;
|
||||
user: {
|
||||
@ -283,6 +374,12 @@ export interface BooksSelect<T extends boolean = true> {
|
||||
books_id?: T;
|
||||
title?: T;
|
||||
authors?: T;
|
||||
pages?: T;
|
||||
lcc?: T;
|
||||
publication?: T;
|
||||
date?: T;
|
||||
genre?: T;
|
||||
description?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
@ -297,6 +394,39 @@ export interface AuthorsSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "repositories_select".
|
||||
*/
|
||||
export interface RepositoriesSelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
abbreviation?: T;
|
||||
owner?: T;
|
||||
dateOpenToPublic?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "copies_select".
|
||||
*/
|
||||
export interface CopiesSelect<T extends boolean = true> {
|
||||
condition?: T;
|
||||
book?: T;
|
||||
repository?: T;
|
||||
notes?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "genre_select".
|
||||
*/
|
||||
export interface GenreSelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "payload-locked-documents_select".
|
||||
|
||||
@ -10,6 +10,9 @@ import { Users } from './collections/Users'
|
||||
import { Media } from './collections/Media'
|
||||
import { Books } from './collections/Books/Books'
|
||||
import { Authors } from './collections/Authors/Authors'
|
||||
import { Repositories } from './collections/Repositories/Repositories'
|
||||
import { Copies } from './collections/Copies/Copies'
|
||||
import { Genre } from './collections/Books/Genre'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
@ -29,7 +32,7 @@ export default buildConfig({
|
||||
fileSize: 5000000, // in bytes
|
||||
},
|
||||
},
|
||||
collections: [Users, Media, Books, Authors],
|
||||
collections: [Users, Media, Books, Authors, Repositories, Copies, Genre],
|
||||
editor: lexicalEditor(),
|
||||
secret: process.env.PAYLOAD_SECRET || '',
|
||||
typescript: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user