Files
diplomarbeitsportal/src/collections/Technologies.ts
2025-03-26 20:56:56 +01:00

54 lines
1.2 KiB
TypeScript

import type { CollectionConfig } from 'payload'
import path from 'path'
import { fileURLToPath } from 'url'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export const Technologies: CollectionConfig = {
slug: 'technologies',
labels: {
singular: 'Technologie',
plural: 'Technologien',
},
admin: {
useAsTitle: 'name',
},
access: {
read: () => true,
create: ({ req: { user } }) => Boolean(user),
update: ({ req: { user } }) => Boolean(user?.type === "admin"),
delete: ({ req: { user } }) => Boolean(user?.type === "admin"),
},
fields: [
{
name: 'name',
type: 'text',
required: true,
},
{
name: 'description',
type: 'textarea',
required: true,
},
],
upload: {
// Upload to the public/media directory in Next.js making them publicly accessible even outside of Payload
staticDir: path.resolve(dirname, '../../public/technology-icons'),
adminThumbnail: 'thumbnail',
focalPoint: true,
imageSizes: [
{
name: 'thumbnail',
width: 300,
},
{
name: 'square',
width: 500,
height: 500,
},
],
},
}