Add user settings, audit log, berth CRUD, and missing endpoints

- PATCH /api/v1/me: self-service profile update (name, phone, timezone)
- User settings page with profile editor + notification preferences
- Audit log API with filtering (entity, action, user, date range)
- Audit log page with search, entity type, and action filters
- Berth create/delete: POST /api/v1/berths + DELETE /api/v1/berths/[id]
- Client duplicates endpoint: GET /api/v1/clients/duplicates?name=
- Replace settings and audit stub pages with real implementations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-08 19:45:56 -04:00
parent 4fdd9e3207
commit 8df8ded46c
12 changed files with 779 additions and 53 deletions

View File

@@ -2,6 +2,31 @@ import { z } from 'zod';
import { BERTH_STATUSES } from '@/lib/constants';
import { baseListQuerySchema } from '@/lib/api/route-helpers';
// ─── Create Berth ────────────────────────────────────────────────────────────
export const createBerthSchema = z.object({
mooringNumber: z.string().min(1),
area: z.string().min(1),
lengthFt: z.coerce.number().optional(),
lengthM: z.coerce.number().optional(),
widthFt: z.coerce.number().optional(),
widthM: z.coerce.number().optional(),
draftFt: z.coerce.number().optional(),
draftM: z.coerce.number().optional(),
price: z.coerce.number().optional(),
priceCurrency: z.string().optional(),
status: z.enum(BERTH_STATUSES).default('available'),
tenureType: z.enum(['permanent', 'fixed_term']).optional(),
mooringType: z.string().optional(),
powerCapacity: z.string().optional(),
voltage: z.string().optional(),
access: z.string().optional(),
bowFacing: z.string().optional(),
sidePontoon: z.string().optional(),
});
export type CreateBerthInput = z.infer<typeof createBerthSchema>;
// ─── Update Berth ─────────────────────────────────────────────────────────────
export const updateBerthSchema = z.object({