Files
payload/test/joins/collections/Uploads.ts
Dan Ribbens 3f375cc6ee feat: join field on upload fields (#8379)
This PR makes it possible to use the new `join` field in connection with
an `upload` field. Previously `join` was reserved only for
relationships.
2024-09-30 13:12:30 -04:00

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'),
},
}