Initial release of Moniki paid services site and CMS (v1.0.0).
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
import { postgresAdapter } from '@payloadcms/db-postgres'
|
||||
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
||||
import { ru } from '@payloadcms/translations/languages/ru'
|
||||
import path from 'path'
|
||||
import { buildConfig } from 'payload'
|
||||
import { fileURLToPath } from 'url'
|
||||
import sharp from 'sharp'
|
||||
|
||||
import { Users } from './collections/Users'
|
||||
import { Media } from './collections/Media'
|
||||
import { Banners } from './collections/Banners'
|
||||
import { Promotions } from './collections/Promotions'
|
||||
import { Branches } from './collections/Branches'
|
||||
import { Specialties } from './collections/Specialties'
|
||||
import { Doctors } from './collections/Doctors'
|
||||
import { Services } from './collections/Services'
|
||||
import { Schedules } from './collections/Schedules'
|
||||
import { Bookings } from './collections/Bookings'
|
||||
import { Reviews } from './collections/Reviews'
|
||||
import { Posts } from './collections/Posts'
|
||||
import { Pages } from './collections/Pages'
|
||||
import { Gallery } from './collections/Gallery'
|
||||
import { Documents } from './collections/Documents'
|
||||
import { Favorites } from './collections/Favorites'
|
||||
import { Notifications } from './collections/Notifications'
|
||||
import { Invoices } from './collections/Invoices'
|
||||
import { Settings } from './globals/Settings'
|
||||
import { settingsResendAdapter } from './lib/email'
|
||||
import { ensureSettingsSchema } from './lib/ensure-settings-schema'
|
||||
import { ensurePagesSchema } from './lib/ensure-pages-schema'
|
||||
import { ensureDocumentsSchema } from './lib/ensure-documents-schema'
|
||||
import { ensureServicesSchema } from './lib/ensure-services-schema'
|
||||
import { ensureBannersSchema } from './lib/ensure-banners-schema'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
|
||||
const allowedOrigins = [
|
||||
process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3001',
|
||||
...(process.env.CORS_ORIGINS || 'http://localhost:3000').split(','),
|
||||
]
|
||||
.map((origin) => origin.trim())
|
||||
.filter(Boolean)
|
||||
|
||||
export default buildConfig({
|
||||
admin: {
|
||||
user: Users.slug,
|
||||
importMap: {
|
||||
baseDir: path.resolve(dirname),
|
||||
},
|
||||
meta: {
|
||||
titleSuffix: ' — МОНИКИ Платные услуги',
|
||||
},
|
||||
},
|
||||
collections: [
|
||||
Branches,
|
||||
Specialties,
|
||||
Doctors,
|
||||
Services,
|
||||
Schedules,
|
||||
Bookings,
|
||||
Invoices,
|
||||
Reviews,
|
||||
Pages,
|
||||
Banners,
|
||||
Promotions,
|
||||
Posts,
|
||||
Gallery,
|
||||
Media,
|
||||
Users,
|
||||
Documents,
|
||||
Favorites,
|
||||
Notifications,
|
||||
],
|
||||
globals: [Settings],
|
||||
email: settingsResendAdapter,
|
||||
onInit: async (payload) => {
|
||||
await ensureSettingsSchema(payload)
|
||||
await ensurePagesSchema(payload)
|
||||
await ensureDocumentsSchema(payload)
|
||||
await ensureServicesSchema(payload)
|
||||
await ensureBannersSchema(payload)
|
||||
try {
|
||||
const { seedSitePages } = await import('./seed/site-pages')
|
||||
await seedSitePages(payload)
|
||||
} catch (err) {
|
||||
payload.logger.error({ err }, 'Failed to seed footer pages')
|
||||
}
|
||||
try {
|
||||
const { seedPublicDocuments } = await import('./seed/public-documents')
|
||||
await seedPublicDocuments(payload)
|
||||
} catch (err) {
|
||||
payload.logger.error({ err }, 'Failed to seed public documents')
|
||||
}
|
||||
},
|
||||
editor: lexicalEditor(),
|
||||
i18n: {
|
||||
fallbackLanguage: 'ru',
|
||||
supportedLanguages: { ru },
|
||||
},
|
||||
secret: process.env.PAYLOAD_SECRET || 'change-me',
|
||||
typescript: {
|
||||
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
||||
},
|
||||
db: postgresAdapter({
|
||||
push: false,
|
||||
pool: {
|
||||
connectionString: process.env.DATABASE_URI || '',
|
||||
},
|
||||
}),
|
||||
sharp,
|
||||
cors: allowedOrigins,
|
||||
csrf: allowedOrigins,
|
||||
localization: {
|
||||
locales: [
|
||||
{ code: 'ru', label: 'Русский' },
|
||||
{ code: 'en', label: 'English' },
|
||||
{ code: 'be', label: 'Беларуская' },
|
||||
{ code: 'tg', label: 'Тоҷикӣ' },
|
||||
{ code: 'ky', label: 'Кыргызча' },
|
||||
{ code: 'zh', label: '中文' },
|
||||
],
|
||||
defaultLocale: 'ru',
|
||||
fallback: true,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user