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>
This commit is contained in:
Eric Gullickson
2026-01-13 21:28:43 -06:00
parent 5f07123646
commit 81b1c3dd70
10 changed files with 618 additions and 801 deletions

View File

@@ -0,0 +1,18 @@
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>;