open up access for api import
This commit is contained in:
parent
797054a550
commit
13e716e91f
@ -12,9 +12,11 @@
|
||||
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
|
||||
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
|
||||
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
|
||||
"start": "cross-env NODE_OPTIONS=--no-deprecation next start"
|
||||
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
|
||||
"import": "cd ./import/ && tsc ./parseLibraryThingExport.ts --module esnext && node ./parseLibraryThingExport.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@payloadcms/db-postgres": "3.31.0",
|
||||
"@payloadcms/next": "3.31.0",
|
||||
"@payloadcms/payload-cloud": "3.31.0",
|
||||
"@payloadcms/richtext-lexical": "3.31.0",
|
||||
@ -24,8 +26,7 @@
|
||||
"payload": "3.31.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0",
|
||||
"sharp": "0.32.6",
|
||||
"@payloadcms/db-postgres": "3.31.0"
|
||||
"sharp": "0.32.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.2.0",
|
||||
|
@ -1,11 +1,20 @@
|
||||
import { access } from 'node:fs/promises'
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
export const Authors: CollectionConfig = {
|
||||
slug: 'authors',
|
||||
admin: {
|
||||
useAsTitle: 'lf'
|
||||
useAsTitle: 'lf',
|
||||
pagination: {
|
||||
limits: [10, 20, 50, 100, 250],
|
||||
}
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
update: () => true,
|
||||
create: () => true,
|
||||
admin: () => true,
|
||||
},
|
||||
|
||||
fields: [
|
||||
{
|
||||
name: 'lf',
|
||||
@ -31,6 +40,10 @@ export const Authors: CollectionConfig = {
|
||||
label: 'Translator',
|
||||
value: 'Translator'
|
||||
},
|
||||
{
|
||||
label: 'Editor',
|
||||
value: 'Editor'
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -5,6 +5,12 @@ export const Books: CollectionConfig = {
|
||||
admin: {
|
||||
useAsTitle: 'title'
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
update: () => true,
|
||||
create: () => true,
|
||||
admin: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: "books_id", // This is from the import
|
||||
@ -24,6 +30,7 @@ export const Books: CollectionConfig = {
|
||||
type: "relationship",
|
||||
relationTo: "authors",
|
||||
hasMany: true,
|
||||
maxDepth: 3,
|
||||
},
|
||||
{
|
||||
name: 'pages',
|
||||
@ -32,7 +39,6 @@ export const Books: CollectionConfig = {
|
||||
{
|
||||
name: 'lcc',
|
||||
type: 'text',
|
||||
unique: true,
|
||||
},
|
||||
{
|
||||
name: 'publication',
|
||||
@ -41,12 +47,7 @@ export const Books: CollectionConfig = {
|
||||
{
|
||||
label: 'Publication Date',
|
||||
name: 'date',
|
||||
type: 'date',
|
||||
admin: {
|
||||
date: {
|
||||
pickerAppearance: 'dayOnly'
|
||||
}
|
||||
},
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
name: 'genre',
|
||||
@ -58,6 +59,10 @@ export const Books: CollectionConfig = {
|
||||
allowCreate: true
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'textarea',
|
||||
name: 'summary',
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
type: 'richText'
|
||||
|
@ -2,6 +2,15 @@ import { CollectionConfig } from "payload";
|
||||
|
||||
export const Genre: CollectionConfig = {
|
||||
slug: 'genre',
|
||||
admin: {
|
||||
useAsTitle: 'name',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
update: () => true,
|
||||
create: () => true,
|
||||
admin: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
|
@ -9,5 +9,11 @@ export const Users: CollectionConfig = {
|
||||
fields: [
|
||||
// Email added by default
|
||||
// Add more fields as needed
|
||||
{
|
||||
name: 'role',
|
||||
type: 'select',
|
||||
options: ['admin', 'user'],
|
||||
saveToJWT: true
|
||||
}
|
||||
],
|
||||
}
|
||||
|
@ -129,6 +129,7 @@ export interface UserAuthOperations {
|
||||
*/
|
||||
export interface User {
|
||||
id: number;
|
||||
role?: ('admin' | 'user') | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
email: string;
|
||||
@ -171,8 +172,8 @@ export interface Book {
|
||||
pages?: number | null;
|
||||
lcc?: string | null;
|
||||
publication?: string | null;
|
||||
date?: string | null;
|
||||
genre?: (number | Genre)[] | null;
|
||||
summary?: string | null;
|
||||
description?: {
|
||||
root: {
|
||||
type: string;
|
||||
@ -199,7 +200,7 @@ export interface Author {
|
||||
id: number;
|
||||
lf: string;
|
||||
fl?: string | null;
|
||||
role?: ('Author' | 'Translator') | null;
|
||||
role?: ('Author' | 'Translator' | 'Editor') | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
@ -338,6 +339,7 @@ export interface PayloadMigration {
|
||||
* via the `definition` "users_select".
|
||||
*/
|
||||
export interface UsersSelect<T extends boolean = true> {
|
||||
role?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
email?: T;
|
||||
@ -379,6 +381,7 @@ export interface BooksSelect<T extends boolean = true> {
|
||||
publication?: T;
|
||||
date?: T;
|
||||
genre?: T;
|
||||
summary?: T;
|
||||
description?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
|
@ -25,8 +25,8 @@ export default buildConfig({
|
||||
},
|
||||
dateFormat: 'MM/dd/yyyy',
|
||||
},
|
||||
cors: [process.env.DOMAIN_NAME || ''],
|
||||
csrf: [process.env.DOMAIN_NAME || ''],
|
||||
//cors: [process.env.DOMAIN_NAME || ''],
|
||||
//csrf: [process.env.DOMAIN_NAME || ''],
|
||||
upload: {
|
||||
limits: {
|
||||
fileSize: 5000000, // in bytes
|
||||
|
89705
testData.json
89705
testData.json
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user