refactor: route/schema consistency (parseId, broad invalidation, Czech messages, Zod 4 strictObject)

- OfferDetail: invalidate broad ["offers"] not ["offers","list"] (CLAUDE.md convention)
- trips.ts/sessions.ts: use parseId helper (validated 400) instead of raw parseInt for route ids
- audit-log.ts: z.object().strict() -> z.strictObject() (Zod 4 idiom)
- attendance.ts, orders/offers schemas: English user-facing strings -> Czech
- project-files.ts: unify 'not found' phrasing to the codebase-dominant 'nenalezen' form

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-06 02:29:04 +02:00
parent 522afefc80
commit 9ae49c0d6a
8 changed files with 43 additions and 45 deletions

View File

@@ -185,7 +185,7 @@ export default async function attendanceRoutes(
return error(reply, "Nedostatečná oprávnění", 403);
}
const attendanceId = Number(query.attendance_id);
if (!attendanceId) return error(reply, "Missing attendance_id", 400);
if (!attendanceId) return error(reply, "Chybí attendance_id", 400);
const data = await attendanceService.getProjectLogs(attendanceId);
return reply.send({ success: true, data });
}
@@ -193,7 +193,7 @@ export default async function attendanceRoutes(
// --- action=location: single record with GPS data ---
if (action === "location") {
const id = Number(query.id);
if (!id) return error(reply, "Missing id", 400);
if (!id) return error(reply, "Chybí id záznamu", 400);
const record = await attendanceService.getLocationRecord(id);
if (!record) return error(reply, "Záznam nenalezen", 404);
const isAdmin = authData.permissions.includes("attendance.manage");