Move domain models into domain package with schemas and validate with zod + elysia. Some maintenence as well
This commit is contained in:
@@ -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>;
|
||||
Reference in New Issue
Block a user