Move domain models into domain package with schemas and validate with zod + elysia. Some maintenence as well

This commit is contained in:
Dominic Ferrando
2026-06-22 13:59:04 -04:00
parent ed5abac209
commit 6fa3d78571
16 changed files with 220 additions and 166 deletions
+44
View File
@@ -0,0 +1,44 @@
import { z } from "zod";
export enum Attribute {
Strength = "Strength",
Power = "Power",
Endurance = "Endurance",
Agility = "Agility",
}
export enum Activity {
BackSquat = "BackSquat",
Deadlift = "Deadlift",
BenchPress = "BenchPress",
Run = "Run",
BroadJump = "BroadJump",
ConeDrill = "ConeDrill",
}
export enum Gender {
Male = "Male",
Female = "Female",
}
export const MetricsSchema = z.object({
age: z.number(),
weight: z.number(),
gender: z.enum(Gender),
});
export const PlayerSchema = z.object({
name: z.string().optional(),
metrics: MetricsSchema,
});
export const ActivityPerformanceSchema = z.object({
activity: z.enum(Activity),
performance: z.number(),
});
export type StandardUnit = "ms" | "cm" | "kg";
export type Metrics = z.infer<typeof MetricsSchema>;
export type Player = z.infer<typeof PlayerSchema>;
export type ActivityPerformance = z.infer<typeof ActivityPerformanceSchema>;