This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content-collections.ts
210 lines (192 loc) · 5 KB
/
content-collections.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import { defineCollection, defineConfig } from "@content-collections/core";
import { Temporal } from "temporal-polyfill";
const stageEvent = defineCollection({
directory: "contents/stage_event",
include: "**/*.md",
name: "stageEvent",
schema: z => ({
endAt: z.string().refine((v) => {
try {
Temporal.ZonedDateTime.from(v);
return true;
}
catch {
return false;
}
}, { message: "Value of \"endAt\" must be a valid Temporal.ZonedDateTime." }),
overview: z.string().max(100, { message: "Value of \"overview\" must be less than 100 characters." }),
startAt: z.string().refine((v) => {
try {
Temporal.ZonedDateTime.from(v);
return true;
}
catch {
return false;
}
}, { message: "Value of \"startAt\" must be a valid Temporal.ZonedDateTime." }),
title: z.string(),
}),
});
const liveEvent = defineCollection({
directory: "contents/live_event",
include: "**/*.md",
name: "liveEvent",
schema: z => ({
endAt: z.string().refine((v) => {
try {
Temporal.ZonedDateTime.from(v);
return true;
}
catch {
return false;
}
}, { message: "Value of \"endAt\" must be a valid Temporal.ZonedDateTime." }),
name: z.string().max(20, { message: "Value of \"name\" must be less than 20 characters." }),
overview: z.string().max(100, { message: "Value of \"overview\" must be less than 100 characters." }),
press: z.string().refine((v) => {
if (/^\/images\/.*/.test(v))
return true;
else
return false;
}, { message: "Value of \"press\" must be a valid image URL." }),
stage: z.union([z.literal("main"), z.literal("sub")]),
startAt: z.string().refine((v) => {
try {
Temporal.ZonedDateTime.from(v);
return true;
}
catch {
return false;
}
}, { message: "Value of \"startAt\" must be a valid Temporal.ZonedDateTime." }),
}),
});
const gameEvent = defineCollection({
directory: "contents/game_event",
include: "**/*.md",
name: "gameEvent",
schema: z => ({
date: z.string().refine((v) => {
try {
Temporal.ZonedDateTime.from(v);
return true;
}
catch {
return false;
}
}, { message: "Value of \"date\" must be a valid Temporal.ZonedDateTime." }),
day: z.union([z.literal(1), z.literal(2)]),
form: z.string().url({ message: "Value of \"form\" must be a valid URL." }),
guideBook: z.string().url({ message: "Value of \"guideBook\" must be a valid URL." }),
title: z.string(),
venue: z.string(),
}),
});
const sponsor = defineCollection({
directory: "contents/sponsor",
include: "**/*.md",
name: "sponsor",
schema: z => ({
name: z.string(),
}),
});
const special_sponsor = defineCollection({
directory: "contents/special_sponsor",
include: "**/*.md",
name: "specialSponsor",
schema: z => ({
description: z.string(),
images: z.array(z.string().refine((v) => {
if (/^\/images\/.*/.test(v))
return true;
else
return false;
}, { message: "Value of \"img\" must be a valid image URL." })),
name: z.string(),
tel: z.string(),
}),
});
const personal_sponsor = defineCollection({
directory: "contents/personal_sponsor",
include: "**/*.md",
name: "personalSponsor",
schema: z => ({
name: z.string(),
}),
});
const departmentExhibition = defineCollection({
directory: "contents/department_exhibition",
include: "**/*.md",
name: "departmentExhibition",
schema: z => ({
department: z.union([z.literal("M"), z.literal("E"), z.literal("I"), z.literal("C"), z.literal("S")]),
overview: z.string().max(60, { message: "Value of \"overview\" must be less than 60 characters." }),
team: z.string(),
}),
});
const bazar = defineCollection({
directory: "contents/bazar",
include: "**/*.md",
name: "bazar",
schema: z => ({
img: z.string().refine((v) => {
if (/^\/images\/.*/.test(v))
return true;
else
return false;
}, { message: "Value of \"img\" must be a valid image URL." }),
name: z.string(),
overview: z.string(),
type: z.union([z.literal("food"), z.literal("recreation")]),
}),
});
const timeTable = defineCollection({
directory: "contents/time_table",
include: "**/*.md",
name: "timeTable",
schema: z => ({
day: z.union([z.literal(1), z.literal(2)]),
endAt: z.string().refine((v) => {
try {
Temporal.ZonedDateTime.from(v);
return true;
}
catch {
return false;
}
}, { message: "Value of \"endAt\" must be a valid Temporal.ZonedDateTime." }),
startAt: z.string().refine((v) => {
try {
Temporal.ZonedDateTime.from(v);
return true;
}
catch {
return false;
}
}, { message: "Value of \"startAt\" must be a valid Temporal.ZonedDateTime." }),
type: z.union([z.literal("game"), z.literal("live"), z.literal("main"), z.literal("sub")]),
}),
});
const endroll = defineCollection({
directory: "contents/endroll",
include: "**/*.md",
name: "endroll",
schema: z => ({
members: z.array(z.string()),
team: z.string(),
}),
});
export default defineConfig({
collections: [
stageEvent,
liveEvent,
gameEvent,
sponsor,
special_sponsor,
personal_sponsor,
departmentExhibition,
bazar,
timeTable,
endroll,
],
});