-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.ts
52 lines (49 loc) · 1.27 KB
/
schema.ts
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
import { list } from '@keystone-6/core'
import {
image,
json,
password,
relationship,
text,
} from '@keystone-6/core/fields'
import { Lists } from '.keystone/types'
export const lists: Lists = {
User: list({
// Here are the fields that `User` will have. We want an email and password so they can log in
// a name so we can refer to them, and a way to connect users to posts.
fields: {
name: text({ validation: { isRequired: true } }),
email: text({
validation: { isRequired: true },
isIndexed: 'unique',
isFilterable: true,
}),
password: password({ validation: { isRequired: true } }),
},
// Here we can configure the Admin UI. We want to show a user's name and posts in the Admin UI
}),
Product: list({
fields: {
images: json({
label: 'Images',
ui: {
views: require.resolve('./galleryComponent'),
createView: { fieldMode: 'edit' },
listView: { fieldMode: 'hidden' },
itemView: { fieldMode: 'edit' },
},
}),
},
}),
ProductImage: list({
fields: {
name: text({
validation: {
isRequired: true,
},
}),
altText: text(),
image: image({ storage: 'my_local_images' }),
},
}),
}