forked from keystonejs/keystone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.ts
28 lines (27 loc) · 838 Bytes
/
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
import { list } from '@keystone-6/core';
import { checkbox, relationship, text, timestamp } from '@keystone-6/core/fields';
import { select } from '@keystone-6/core/fields';
export const lists = {
Task: list({
fields: {
label: text({ validation: { isRequired: true } }),
priority: select({
type: 'enum',
options: [
{ label: 'Low', value: 'low' },
{ label: 'Medium', value: 'medium' },
{ label: 'High', value: 'high' },
],
}),
isComplete: checkbox(),
assignedTo: relationship({ ref: 'Person.tasks', many: false }),
finishBy: timestamp(),
},
}),
Person: list({
fields: {
name: text({ validation: { isRequired: true }, isIndexed: 'unique' }),
tasks: relationship({ ref: 'Task.assignedTo', many: true }),
},
}),
};