mirror of
https://git.moonleay.net/Websites/liljudd-website.git
synced 2025-07-27 03:32:03 +02:00
Fix: Finished Backend
This commit is contained in:
parent
6b388729d9
commit
ffaf8d989e
30 changed files with 1478 additions and 873 deletions
37
src/lib/zod.ts
Normal file
37
src/lib/zod.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import moment from "moment-timezone";
|
||||
import { z } from "zod";
|
||||
|
||||
export const zodId = z
|
||||
.string()
|
||||
.refine((value) => /^\d{7,20}$/.test(value), "Invalid ID supplied");
|
||||
|
||||
export const zodTpMessages = z.object({
|
||||
channelId: zodId,
|
||||
messageIds: z.object({
|
||||
"0": zodId.nullable(),
|
||||
"1": zodId.nullable(),
|
||||
"2": zodId.nullable(),
|
||||
"3": zodId.nullable(),
|
||||
"4": zodId.nullable(),
|
||||
"5": zodId.nullable(),
|
||||
"6": zodId.nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const zodMatch = z.object({
|
||||
match: z.object({
|
||||
channelId: zodId,
|
||||
createrId: zodId,
|
||||
messageId: zodId,
|
||||
roleId: zodId,
|
||||
matchType: z.string(),
|
||||
opponentName: z.string(),
|
||||
utc_ts: z.string().datetime(),
|
||||
}),
|
||||
timezone: z
|
||||
.string()
|
||||
.refine(
|
||||
(value) => moment.tz.names().includes(value),
|
||||
"Unknown timezone supplied",
|
||||
),
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue