-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathschema.ts
More file actions
49 lines (44 loc) · 1.26 KB
/
schema.ts
File metadata and controls
49 lines (44 loc) · 1.26 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
46
47
48
49
import { type } from "arktype";
const timetableScope = type.scope({
Subject: {
"+": "reject",
name: "string",
shortName: "string",
code: /^\d{2}[A-Z]{2,3}\d{3}$/,
"faculty": "string[]"
},
ConfigValue: { label: "string", id: "string" },
ConfigOption: {
label: "string",
values: "ConfigValue[] >= 1"
},
SimpleSlot: {
match: "string",
"choices": "Record<string, string>"
},
ComplexChoice: {
"pattern": "string[] >= 1",
value: "string",
},
ComplexSlot: {
"match": "string[] >= 1",
"choices": "ComplexChoice[] >= 1",
},
Slot: "SimpleSlot | ComplexSlot",
Timetable: {
subjects: "Record<string, Subject>",
config: "Record<string, ConfigOption>",
slots: "Record<string, SimpleSlot | ComplexSlot>",
schedule: {
"+": "reject",
"Monday?": "string[] == 7",
"Tuesday?": "string[] == 7",
"Wednesday?": "string[] == 7",
"Thursday?": "string[] == 7",
"Friday?": "string[] == 7",
"Saturday?": "string[] == 7",
"Sunday?": "string[] == 7"
}
}
}).export()
export const TimetableSchema = timetableScope.Timetable