Skip to content

Instantly share code, notes, and snippets.

@DanRibbens
Created January 29, 2025 16:38
Show Gist options
  • Save DanRibbens/3c3974996932ea5cec59bc4ab275f4e2 to your computer and use it in GitHub Desktop.
Save DanRibbens/3c3974996932ea5cec59bc4ab275f4e2 to your computer and use it in GitHub Desktop.
Paylaod error /admin/create-first-user with join field
// storage-adapter-import-placeholder
import { postgresAdapter } from '@payloadcms/db-postgres'
import { payloadCloudPlugin } from '@payloadcms/payload-cloud'
import { lexicalEditor } from '@payloadcms/richtext-lexical'
import path from 'path'
import { buildConfig } from 'payload'
import { fileURLToPath } from 'url'
import sharp from 'sharp'
import { Users } from './collections/Users'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export default buildConfig({
admin: {
user: Users.slug,
importMap: {
baseDir: path.resolve(dirname),
},
},
collections: [
{
slug: 'users',
auth: true,
fields: [
{
name: 'connections',
type: 'join',
collection: 'connections',
on: 'user',
},
],
},
{
slug: 'connections',
fields: [
{
name: 'user',
type: 'relationship',
relationTo: 'users',
},
],
},
],
editor: lexicalEditor(),
secret: process.env.PAYLOAD_SECRET || '',
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
db: postgresAdapter({
idType: 'uuid',
pool: {
connectionString: process.env.DATABASE_URI || '',
},
}),
sharp,
plugins: [
payloadCloudPlugin(),
// storage-adapter-placeholder
],
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment