first commit
This commit is contained in:
25
apps/server/src/utils/validators.ts
Normal file
25
apps/server/src/utils/validators.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const allowIpSchema = z
|
||||
.string()
|
||||
.ip({ version: "v4" })
|
||||
.or(z.string().ip({ version: "v6" }));
|
||||
|
||||
export const loopStartSchema = z.object({
|
||||
hash: z.string().min(1),
|
||||
allowIp: allowIpSchema,
|
||||
targetLoops: z.number().int().min(1).max(1000),
|
||||
delayMs: z.number().int().min(0).max(86_400_000),
|
||||
});
|
||||
|
||||
export const dryRunSchema = z.object({
|
||||
hash: z.string().min(1),
|
||||
allowIp: allowIpSchema,
|
||||
});
|
||||
|
||||
export const profileSchema = z.object({
|
||||
name: z.string().min(1).max(64),
|
||||
allowIp: allowIpSchema,
|
||||
delayMs: z.number().int().min(0).max(86_400_000),
|
||||
targetLoops: z.number().int().min(1).max(1000),
|
||||
});
|
||||
Reference in New Issue
Block a user