diff --git a/.gitignore b/.gitignore index 3d53a40..3a96d9e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ next-env.d.ts .env /media + +/types/payload-types.ts \ No newline at end of file diff --git a/payload-types.ts b/payload-types.ts deleted file mode 100644 index ddbc8a3..0000000 --- a/payload-types.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * This file was automatically generated by Payload. - * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, - * and re-run `payload generate:types` to regenerate this file. - */ - -export interface Config { - collections: { - users: User; - pages: Page; - media: Media; - 'payload-preferences': PayloadPreference; - 'payload-migrations': PayloadMigration; - }; - globals: {}; - locale: null; - user: User & { - collection: 'users'; - }; -} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "users". - */ -export interface User { - id: string; - updatedAt: string; - createdAt: string; - email: string; - resetPasswordToken?: string | null; - resetPasswordExpiration?: string | null; - salt?: string | null; - hash?: string | null; - loginAttempts?: number | null; - lockUntil?: string | null; - password?: string | null; -} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "pages". - */ -export interface Page { - id: string; - title?: string | null; - content?: { - 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` "media". - */ -export interface Media { - id: string; - text?: string | null; - updatedAt: string; - createdAt: string; - url?: string | null; - thumbnailURL?: string | null; - filename?: string | null; - mimeType?: string | null; - filesize?: number | null; - width?: number | null; - height?: number | null; -} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "payload-preferences". - */ -export interface PayloadPreference { - id: string; - user: { - relationTo: 'users'; - value: string | User; - }; - key?: string | null; - value?: - | { - [k: string]: unknown; - } - | unknown[] - | string - | number - | boolean - | null; - updatedAt: string; - createdAt: string; -} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "payload-migrations". - */ -export interface PayloadMigration { - id: string; - name?: string | null; - batch?: number | null; - updatedAt: string; - createdAt: string; -} - - -declare module 'payload' { - export interface GeneratedTypes extends Config {} -} \ No newline at end of file diff --git a/payload.config.ts b/payload.config.ts index 340f540..55cca99 100644 --- a/payload.config.ts +++ b/payload.config.ts @@ -1,5 +1,4 @@ import path from 'path' -// import { postgresAdapter } from '@payloadcms/db-postgres' import { en } from 'payload/i18n/en' import { AlignFeature, @@ -19,28 +18,33 @@ import { UnorderedListFeature, UploadFeature, } from '@payloadcms/richtext-lexical' -//import { slateEditor } from '@payloadcms/richtext-slate' import { mongooseAdapter } from '@payloadcms/db-mongodb' import { buildConfig } from 'payload/config' import sharp from 'sharp' import { fileURLToPath } from 'url' +import Media from '@payload/collections/Media' +import Authors from '@payload/collections/Authors' +import Posts from '@payload/collections/Posts' +import Users from '@payload/collections/Users' + const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) export default buildConfig({ - //editor: slateEditor({}), + admin: { + autoLogin: { + email: 'dev@payloadcms.com', + password: 'test', + prefillOnly: true, + }, + }, editor: lexicalEditor(), collections: [ - { - slug: 'users', - auth: true, - access: { - delete: () => false, - update: () => false, - }, - fields: [], - }, + Users, + Posts, + Authors, + Media, { slug: 'pages', admin: { @@ -57,45 +61,14 @@ export default buildConfig({ }, ], }, - { - slug: 'media', - upload: true, - fields: [ - { - name: 'text', - type: 'text', - }, - ], - }, ], secret: process.env.PAYLOAD_SECRET || '', typescript: { - outputFile: path.resolve(dirname, 'payload-types.ts'), + outputFile: path.resolve(dirname, 'types/payload-types.ts'), }, - // db: postgresAdapter({ - // pool: { - // connectionString: process.env.POSTGRES_URI || '' - // } - // }), db: mongooseAdapter({ url: process.env.MONGODB_URI || '', }), - - /** - * Payload can now accept specific translations from 'payload/i18n/en' - * This is completely optional and will default to English if not provided - */ - i18n: { - supportedLanguages: { en }, - }, - - admin: { - autoLogin: { - email: 'dev@payloadcms.com', - password: 'test', - prefillOnly: true, - }, - }, async onInit(payload) { const existingUsers = await payload.find({ collection: 'users', diff --git a/tsconfig.json b/tsconfig.json index 323d697..c31d9dc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "baseUrl": ".", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -23,22 +19,13 @@ } ], "paths": { - "@/*": [ - "./src/*" - ], - "@payload-config": [ - "./payload.config.ts" - ] + "@/*": ["./src/*"], + "@payload/*": ["./src/app/(payload)/*"], + "@app/*": ["./src/app/(app)/*"], + "@payload-config": ["./payload.config.ts"] }, "target": "ES2017" }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] }