-
Notifications
You must be signed in to change notification settings - Fork 6
/
keystone.ts
114 lines (109 loc) · 2.51 KB
/
keystone.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { config, list } from "@keystone-6/core"
import {
text,
checkbox,
timestamp,
image,
relationship,
select,
} from "@keystone-6/core/fields"
import { document } from "@keystone-6/fields-document"
import { componentBlocks } from "./lib/component-blocks"
const Post = list({
fields: {
title: text({ validation: { isRequired: true } }),
subtitle: text({ validation: { isRequired: true } }),
slug: text({ isIndexed: "unique", isFilterable: true }),
publishDate: timestamp(),
isPublished: checkbox({ defaultValue: false }),
content: document({
formatting: true,
dividers: true,
links: true,
layouts: [
[1, 1],
[1, 1, 1],
],
ui: {
views: require.resolve("./lib/component-blocks"),
},
componentBlocks,
relationships: {
inlineImage: {
kind: "prop",
listKey: "Image",
selection: "id alt image { url }",
},
},
}),
},
})
const Project = list({
fields: {
title: text({ validation: { isRequired: true } }),
subtitle: text({ validation: { isRequired: true } }),
projectType: select({
type: "string",
options: [
{ label: "Personal", value: "personal" },
{ label: "Work", value: "work" },
],
defaultValue: "work",
ui: { displayMode: "segmented-control" },
}),
timeline: text(),
company: text(),
slug: text({ isIndexed: "unique", isFilterable: true }),
isPublished: checkbox({ defaultValue: false }),
bgColor: text(),
hasDarkBg: checkbox({ defaultValue: true }),
featuredImage: relationship({ ref: "Image" }),
content: document({
formatting: true,
dividers: true,
links: true,
layouts: [
[1, 1],
[1, 1, 1],
],
ui: {
views: require.resolve("./lib/component-blocks"),
},
relationships: {
inlineImage: {
kind: "prop",
listKey: "Image",
selection: "id alt image { url }",
},
},
componentBlocks,
}),
},
})
const Image = list({
fields: {
name: text(),
alt: text(),
image: image(),
publishDate: timestamp(),
},
})
export default config({
db: { provider: "sqlite", url: "file:./app.db" },
experimental: {
generateNextGraphqlAPI: true,
generateNodeAPI: true,
},
lists: {
Post,
Project,
Image,
},
images: {
upload: "local",
local: {
storagePath: "public/img/uploaded",
baseUrl: "/img/uploaded",
},
},
})