forked from keystonejs/keystone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
45 lines (42 loc) · 1.25 KB
/
Copy pathutils.ts
File metadata and controls
45 lines (42 loc) · 1.25 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
import { timestamp } from '@keystone-6/core/fields';
import { BaseKeystoneTypeInfo, DatabaseConfig, StorageConfig } from '@keystone-6/core/types';
export const localStorageConfig: Record<string, StorageConfig> = {
images: {
kind: 'local',
type: 'image',
generateUrl: path => `/images${path}`,
serverRoute: { path: '/images' },
storagePath: 'public/images',
},
files: {
kind: 'local',
type: 'file',
generateUrl: path => `/files${path}`,
serverRoute: { path: '/files' },
storagePath: 'public/files',
},
};
export const dbConfig: DatabaseConfig<BaseKeystoneTypeInfo> = {
provider: 'sqlite',
url: process.env.DATABASE_URL || 'file:./dev.db',
};
export const trackingFields = {
createdAt: timestamp({
access: { read: () => true, create: () => false, update: () => false },
validation: { isRequired: true },
defaultValue: { kind: 'now' },
ui: {
createView: { fieldMode: 'hidden' },
itemView: { fieldMode: 'read' },
},
}),
updatedAt: timestamp({
access: { read: () => true, create: () => false, update: () => false },
db: { updatedAt: true },
validation: { isRequired: true },
ui: {
createView: { fieldMode: 'hidden' },
itemView: { fieldMode: 'read' },
},
}),
};