-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
36 lines (30 loc) · 780 Bytes
/
types.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
import { z } from "zod";
const DifficultyLevel = z.enum(["easy", "medium", "hard"]);
const Topic = z.enum([
"HTML",
"CSS",
"JavaScript",
"TypeScript",
"Node.js",
"React.js",
"Next.js",
]);
export const QuestionSchema = z.object({
id: z.number().optional(),
poziom: DifficultyLevel,
temat: Topic,
pytanie: z.string().min(3).max(500),
odp_a: z.string().min(1).max(255),
odp_b: z.string().min(1).max(255),
odp_c: z.string().min(1).max(255),
odp_d: z.string().min(1).max(255),
odp_poprawna: z.string().min(1).max(255),
});
export type Question = z.infer<typeof QuestionSchema>;
export const QuestionsArraySchema = z.array(QuestionSchema);
export type AnswerState =
| "default"
| "selected"
| "correct"
| "wrong"
| "wrong-with-correct";