fix: resolve TypeScript compilation errors from service extraction
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,7 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
const body = parsed.data;
|
||||
|
||||
const result = await attendanceService.saveNotes(authData.userId, body.notes ? String(body.notes) : null);
|
||||
if ('error' in result) return error(reply, result.error, 400);
|
||||
if ('error' in result) return error(reply, result.error!, 400);
|
||||
return success(reply, null, 200, 'Poznámka uložena');
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
const body = parsed.data;
|
||||
|
||||
const result = await attendanceService.updateAddress(authData.userId, body.address ?? null, body.punch_action);
|
||||
if ('error' in result) return error(reply, result.error, 404);
|
||||
if ('error' in result) return error(reply, result.error!, 404);
|
||||
return success(reply, null, 200, 'Adresa aktualizována');
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
|
||||
const newProjectId = body.project_id ? Number(body.project_id) : null;
|
||||
const result = await attendanceService.switchProject(authData.userId, newProjectId);
|
||||
if ('error' in result) return error(reply, result.error, 400);
|
||||
if ('error' in result) return error(reply, result.error!, 400);
|
||||
return success(reply, null, 200, 'Projekt přepnut');
|
||||
});
|
||||
|
||||
@@ -169,7 +169,7 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
sick_used: balBody.sick_used,
|
||||
});
|
||||
|
||||
if ('error' in result) return error(reply, result.error, 400);
|
||||
if ('error' in result) return error(reply, result.error!, 400);
|
||||
|
||||
await logAudit({
|
||||
request, authData, action: 'update', entityType: 'leave_balance',
|
||||
@@ -220,10 +220,10 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
date_to: leaveBody.date_to,
|
||||
leave_type: leaveBody.leave_type,
|
||||
leave_hours: leaveBody.leave_hours,
|
||||
notes: leaveBody.notes,
|
||||
notes: leaveBody.notes ?? undefined,
|
||||
}, authData.userId);
|
||||
|
||||
if ('error' in result) return error(reply, result.error, 400);
|
||||
if ('error' in result) return error(reply, result.error!, 400);
|
||||
return success(reply, { created: result.created }, 200, result.message!);
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
address: punchBody.address,
|
||||
});
|
||||
|
||||
if ('error' in result) return error(reply, result.error, 400);
|
||||
if ('error' in result) return error(reply, result.error!, 400);
|
||||
|
||||
await logAudit({
|
||||
request, authData, action: result.auditAction, entityType: 'attendance',
|
||||
@@ -303,14 +303,14 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
departure_time: body.departure_time,
|
||||
break_start: body.break_start,
|
||||
break_end: body.break_end,
|
||||
notes: body.notes,
|
||||
project_id: body.project_id,
|
||||
notes: body.notes ?? undefined,
|
||||
project_id: body.project_id != null ? Number(body.project_id) : (body.project_id as number | null | undefined),
|
||||
leave_type: body.leave_type,
|
||||
leave_hours: body.leave_hours,
|
||||
leave_hours: body.leave_hours != null ? Number(body.leave_hours) : (body.leave_hours as number | null | undefined),
|
||||
project_logs: body.project_logs,
|
||||
}, authData.userId, isAdmin);
|
||||
|
||||
if ('error' in result) return error(reply, result.error, result.status!);
|
||||
if ('error' in result) return error(reply, result.error!, result.status!);
|
||||
|
||||
await logAudit({
|
||||
request,
|
||||
@@ -330,7 +330,7 @@ export default async function attendanceRoutes(fastify: FastifyInstance): Promis
|
||||
if (id === null) return;
|
||||
|
||||
const result = await attendanceService.deleteAttendance(id);
|
||||
if ('error' in result) return error(reply, result.error, 404);
|
||||
if ('error' in result) return error(reply, result.error!, 404);
|
||||
|
||||
await logAudit({
|
||||
request,
|
||||
|
||||
Reference in New Issue
Block a user