26 lines
823 B
TypeScript
26 lines
823 B
TypeScript
import { z } from "zod";
|
|
|
|
const programExerciseSchema = z.object({
|
|
exerciseId: z.string().min(1),
|
|
sets: z.number().int().min(1),
|
|
reps: z.number().int().min(1).optional(),
|
|
durationSec: z.number().int().min(1).optional(),
|
|
order: z.number().int().min(0).default(0),
|
|
});
|
|
|
|
export const createProgramSchema = z.object({
|
|
name: z.string().min(2).max(50),
|
|
description: z.string().max(300).optional(),
|
|
isPublic: z.boolean().default(false),
|
|
exercises: z.array(programExerciseSchema).min(1),
|
|
});
|
|
|
|
export const updateProgramSchema = z.object({
|
|
name: z.string().min(2).max(50).optional(),
|
|
description: z.string().max(300).optional(),
|
|
isPublic: z.boolean().optional(),
|
|
});
|
|
|
|
export type CreateProgramInput = z.infer<typeof createProgramSchema>;
|
|
export type UpdateProgramInput = z.infer<typeof updateProgramSchema>;
|