Files
plex-playlist/frontend/src/validation.ts
Cliff Hill 2c8f424a81
Some checks failed
Tests / Frontend Tests (TypeScript + Vue + Yarn Berry) (push) Failing after 7m49s
Tests / Backend Tests (Python 3.13 + uv) (push) Failing after 14m36s
Fixing everything, making the project structure ready for real code.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
2025-10-23 12:58:32 -04:00

31 lines
818 B
TypeScript

/**
* Zod validation setup with automatic test hooks
* Schemas are automatically validated during test runs via test-setup.ts
*/
import { z } from 'zod';
// Global schemas for automatic validation
export const PlaylistSchema = z.object({
id: z.string().uuid(),
name: z.string().min(1),
description: z.string().optional(),
tracks: z.array(z.string()).default([]),
});
export const UserSchema = z.object({
id: z.number(),
username: z.string().min(1),
email: z.string().email(),
preferences: z
.object({
theme: z.enum(['light', 'dark']).default('light'),
notifications: z.boolean().default(true),
})
.default({}),
});
// Inferred types (no manual type definitions needed)
export type Playlist = z.infer<typeof PlaylistSchema>;
export type User = z.infer<typeof UserSchema>;