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

@@ -1,7 +1,7 @@
import { FastifyInstance } from "fastify";
import prisma from "../../config/database";
import { requireAuth } from "../../middleware/auth";
import { success, error } from "../../utils/response";
import { success, error, parseId } from "../../utils/response";
import { hashToken } from "../../services/auth";
/** Parse user-agent string into browser, OS, and device icon */
@@ -81,8 +81,8 @@ export default async function sessionsRoutes(
"/:id",
{ preHandler: requireAuth },
async (request, reply) => {
const id = parseInt(request.params.id, 10);
if (Number.isNaN(id)) return error(reply, "Neplatné ID relace", 400);
const id = parseId((request.params as any).id, reply);
if (id === null) return;
const authData = request.authData!;
const session = await prisma.refresh_tokens.findFirst({