fix(ui): проверять данные загрузки Filters

This commit is contained in:
Denozordec committed 2026-09-30 11:50:36 +07:00
1 parent 1fba16e1f2
commit 1c7ffa07a8
6 files changed
+143 -44

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { z } from "zod"
const ruleSchema = z.object({
id: z.string().min(1), community: z.string(), communityName: z.string().optional(),
action: z.enum(["route", "blackhole"]).optional(), gateway: z.string(), gatewayTunnelId: z.string(), description: z.string(),
})
export const filterRulesSchema = z.array(ruleSchema).refine(rows => new Set(rows.map(r => r.id)).size === rows.length)
export const filtersResponseSchema = z.object({
rulesets: z.array(z.object({ serverId: z.string().min(1), rules: filterRulesSchema }))
.refine(rows => new Set(rows.map(r => r.serverId)).size === rows.length),
live: z.boolean().optional(), stale: z.boolean().optional(), error: z.string().optional(),
})
export const filtersMutationSchema = z.object({ ok: z.literal(true), rules: filterRulesSchema.optional() })