fix: remove as-any casts, type Dashboard data properly

- Route handlers: add exhaustive return after error checks so TypeScript
  narrows the union and result properties are accessible without casts
- attendance.service: use Prisma.attendanceGetPayload for included relations
- projects.service: remove unnecessary cast on orders relation
- Dashboard.tsx: replace Record<string,any> with proper DashData interface

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-03-24 20:20:43 +01:00
parent 106606f3fa
commit 87dbde5c59
6 changed files with 74 additions and 17 deletions

View File

@@ -173,7 +173,7 @@ export default async function projectsRoutes(
const body = request.body as Record<string, unknown>;
const deleteFiles = !!body?.delete_files;
const result = await deleteProject(id, deleteFiles);
if (result && "error" in result) {
if ("error" in result) {
if (result.error === "not_found")
return error(reply, "Projekt nenalezen", 404);
if (result.error === "has_order")
@@ -182,6 +182,7 @@ export default async function projectsRoutes(
"Nelze smazat projekt propojený s objednávkou. Nejdříve smažte objednávku.",
400,
);
return error(reply, "Neznámá chyba", 500);
}
await logAudit({
@@ -190,7 +191,7 @@ export default async function projectsRoutes(
action: "delete",
entityType: "project",
entityId: id,
description: `Smazán projekt ${(result as any).name}`,
description: `Smazán projekt ${result.name}`,
});
return success(reply, null, 200, "Projekt smazán");
},