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

@@ -0,0 +1,23 @@
import { NextResponse } from 'next/server';
import { z } from 'zod';
import { withAuth, withPermission } from '@/lib/api/helpers';
import { parseQuery } from '@/lib/api/route-helpers';
import { findDuplicates } from '@/lib/services/clients.service';
import { errorResponse } from '@/lib/errors';
const duplicateQuerySchema = z.object({
name: z.string().min(1),
});
export const GET = withAuth(
withPermission('clients', 'view', async (req, ctx) => {
try {
const { name } = parseQuery(req, duplicateQuerySchema);
const data = await findDuplicates(ctx.portId, name);
return NextResponse.json({ data });
} catch (error) {
return errorResponse(error);
}
}),
);