Files
OpenFrontIO/src/core/CosmeticSchemas.ts
Aotumuri 4dd6c9bac3 custom flag (2) (#1303)
## Description:

This PR implements the permission check logic.

Other related parts will be handled in a separate UI update.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors
2025-07-03 00:24:52 +00:00

37 lines
1.0 KiB
TypeScript

import { z } from "zod/v4";
import cosmetics_json from "../../resources/cosmetics/cosmetics.json" with { type: "json" };
import { RequiredPatternSchema } from "./Schemas";
// Schema for resources/cosmetics/cosmetics.json
export const CosmeticsSchema = z.object({
role_groups: z.record(z.string(), z.string().array().min(1)),
patterns: z.record(
RequiredPatternSchema,
z.object({
name: z.string(),
role_group: z.string().optional(),
}),
),
flag: z.object({
layers: z.record(
z.string(),
z.object({
name: z.string(),
role_group: z.string().optional(),
flares: z.array(z.string()).optional(),
}),
),
color: z.record(
z.string(),
z.object({
color: z.string(),
name: z.string(),
role_group: z.string().optional(),
flares: z.array(z.string()).optional(),
}),
),
}),
});
export type Cosmetics = z.infer<typeof CosmeticsSchema>;
export const COSMETICS: Cosmetics = CosmeticsSchema.parse(cosmetics_json);