-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpayload.config.ts
More file actions
72 lines (67 loc) · 2.05 KB
/
payload.config.ts
File metadata and controls
72 lines (67 loc) · 2.05 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* eslint-disable node/prefer-global/process */
import sharp from 'sharp';
import path from 'node:path';
import { buildConfig } from 'payload';
import { fileURLToPath } from 'node:url';
import { media } from 'collections/Media.js';
import { users } from 'collections/Users.js';
// import { auditorPlugin } from 'payload-auditor';
import { mongooseAdapter } from '@payloadcms/db-mongodb';
import { lexicalEditor } from '@payloadcms/richtext-lexical';
// import { auditorPlugin } from './../dist/index.js';
import { auditorPlugin } from '../src/index.js';
import { testEmailAdapter } from './helpers/testEmailAdapter.js';
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
if (!process.env.ROOT_DIR) {
process.env.ROOT_DIR = dirname;
}
export default buildConfig({
admin: { importMap: { baseDir: path.resolve(dirname) } },
collections: [media, users],
db: mongooseAdapter({ url: process.env.DATABASE_URI || '' }),
editor: lexicalEditor(),
email: testEmailAdapter,
// plugins
plugins: [
auditorPlugin({
automation: { logCleanup: { cronTime: '*/1 * * * *', queueName: 'test', olderThan: 30000 } },
collection: {
configureRootCollection(defaults) {
return {
...defaults,
slug: 'some-name',
labels: {
singular: 'some-name',
plural: 'some-names',
},
};
},
trackCollections: [
{
slug: 'media',
hooks: {
afterOperation: {
updateByID: { enabled: true },
},
},
},
],
},
}),
],
secret: process.env.PAYLOAD_SECRET || 'test-secret_key',
sharp,
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
jobs: {
jobsCollectionOverrides: ({ defaultJobsCollection }) => {
if (!defaultJobsCollection.admin) {
defaultJobsCollection.admin = {};
}
defaultJobsCollection.admin.hidden = false;
return defaultJobsCollection;
},
},
});