Add public profiles and cosmetic shop
All checks were successful
Deploy MineGeo to Dokploy / deploy (push) Successful in 7m10s

This commit is contained in:
2026-10-15 17:30:10 +05:00
parent 44e62cff2f
commit c541cc09b4
28 changed files with 1359 additions and 45 deletions

View File

@@ -0,0 +1,41 @@
import { z } from "zod";
import { profileCosmeticIds } from "./profile-cosmetic-ids";
export const profileCosmeticIdSchema = z.enum(profileCosmeticIds);
export type { ProfileCosmeticId } from "./profile-cosmetic-ids";
export const profileCosmeticActionSchema = z.discriminatedUnion("action", [
z
.object({
action: z.literal("purchase"),
cosmeticId: profileCosmeticIdSchema,
})
.strict(),
z
.object({
action: z.literal("equip"),
cosmeticId: profileCosmeticIdSchema.nullable(),
})
.strict(),
]);
export const cosmeticShopStateSchema = z
.object({
balance: z.number().int().nonnegative(),
owned: z.array(profileCosmeticIdSchema),
equipped: profileCosmeticIdSchema.nullable(),
catalog: z.array(
z
.object({
id: profileCosmeticIdSchema,
name: z.string().min(1).max(48),
description: z.string().min(1).max(160),
price: z.number().int().positive(),
rarity: z.enum(["common", "rare", "epic", "legendary"]),
})
.strict(),
),
})
.strict();
export type CosmeticShopState = z.infer<typeof cosmeticShopStateSchema>;