This PR makes it possible to use the new `join` field in connection with an `upload` field. Previously `join` was reserved only for relationships.
24 lines
501 B
TypeScript
24 lines
501 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import path from 'path'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
import { uploadsSlug } from '../shared.js'
|
|
const filename = fileURLToPath(import.meta.url)
|
|
const dirname = path.dirname(filename)
|
|
|
|
export const Uploads: CollectionConfig = {
|
|
slug: uploadsSlug,
|
|
fields: [
|
|
{
|
|
name: 'relatedPosts',
|
|
type: 'join',
|
|
collection: 'posts',
|
|
on: 'upload',
|
|
},
|
|
],
|
|
upload: {
|
|
staticDir: path.resolve(dirname, '../uploads'),
|
|
},
|
|
}
|