Files
motovaultpro/backend/src/features/ownership-costs/api/ownership-costs.validation.ts
Eric Gullickson 81b1c3dd70 feat: create ownership_costs backend feature capsule (refs #29)
Milestone 1: Complete backend feature with:
- Migration with CHECK (amount > 0) constraint
- Repository with mapRow() for snake_case -> camelCase
- Service with CRUD and vehicle authorization
- Controller with HTTP handlers
- Routes registered at /api/ownership-costs
- Validation with Zod schemas
- README with endpoint documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 21:28:43 -06:00

19 lines
754 B
TypeScript

import { z } from 'zod';
import { CreateOwnershipCostSchema, UpdateOwnershipCostSchema, OwnershipCostTypeSchema } from '../domain/ownership-costs.types';
export const ListQuerySchema = z.object({
vehicleId: z.string().uuid().optional(),
costType: OwnershipCostTypeSchema.optional(),
documentId: z.string().uuid().optional(),
});
export const IdParamsSchema = z.object({ id: z.string().uuid() });
export const CreateBodySchema = CreateOwnershipCostSchema;
export const UpdateBodySchema = UpdateOwnershipCostSchema;
export type ListQuery = z.infer<typeof ListQuerySchema>;
export type IdParams = z.infer<typeof IdParamsSchema>;
export type CreateBody = z.infer<typeof CreateBodySchema>;
export type UpdateBody = z.infer<typeof UpdateBodySchema>;