add: Layout, working permissions for papers
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
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: {
|
||||
@@ -11,7 +16,10 @@ export const Technologies: CollectionConfig = {
|
||||
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: [
|
||||
{
|
||||
@@ -24,11 +32,22 @@ export const Technologies: CollectionConfig = {
|
||||
type: 'textarea',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'icon',
|
||||
type: 'upload',
|
||||
relationTo: 'media',
|
||||
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,
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user