-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMedia.ts
More file actions
32 lines (31 loc) · 739 Bytes
/
Media.ts
File metadata and controls
32 lines (31 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import type { CollectionConfig } from 'payload';
import { anyone } from 'helpers/access/anyone.js';
import { authenticated } from 'helpers/access/authenticated.js';
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
export const media: CollectionConfig = {
slug: 'media',
access: {
create: authenticated,
delete: authenticated,
read: anyone,
update: anyone,
},
fields: [
{
name: 'altText',
type: 'text',
label: 'Alt Text',
},
{
name: 'caption',
type: 'text',
label: 'Caption',
},
],
upload: {
staticDir: path.resolve(dirname, 'media'),
},
};