fix(plan): correct admin role check (roleName not role) + drop stale category casts

isAdminLike read authData.role, which doesn't exist on AuthData (it's roleName; role is on JwtPayload), so admins were always self-scoped on /entries and /overrides. Typed the param (no more any). Also removed 4 'category: input.category as any' casts now that category is a String column.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-06 02:16:23 +02:00
parent 05596642bc
commit 379725a096
2 changed files with 11 additions and 6 deletions

View File

@@ -448,7 +448,7 @@ export async function createEntry(
date_from: toDateOnly(input.date_from),
date_to: toDateOnly(input.date_to),
project_id: input.project_id ?? null,
category: input.category as any,
category: input.category,
note: input.note,
created_by: actorUserId,
},
@@ -515,7 +515,7 @@ export async function updateEntry(
date_from: input.date_from ? toDateOnly(input.date_from) : undefined,
date_to: input.date_to ? toDateOnly(input.date_to) : undefined,
project_id: input.project_id === undefined ? undefined : input.project_id,
category: input.category as any,
category: input.category,
note: input.note,
},
});
@@ -636,7 +636,7 @@ export async function createOverride(
user_id: input.user_id,
shift_date: date,
project_id: input.project_id ?? null,
category: input.category as any,
category: input.category,
note: input.note,
created_by: actorUserId,
},
@@ -707,7 +707,7 @@ export async function updateOverride(
where: { id },
data: {
project_id: input.project_id === undefined ? undefined : input.project_id,
category: input.category as any,
category: input.category,
note: input.note,
},
});