diff --git a/src/modules/timesheets/services/timesheets-query.service.ts b/src/modules/timesheets/services/timesheets-query.service.ts index b7cde71..77fbd1b 100644 --- a/src/modules/timesheets/services/timesheets-query.service.ts +++ b/src/modules/timesheets/services/timesheets-query.service.ts @@ -74,7 +74,11 @@ export class TimesheetsQueryService { bank_code: { select: { type: true } }, }, orderBy: { date: 'asc' }, - }); + }); + + const to_num = (value: any) => value && typeof (value as any).toNumber === 'function' + ? (value as any).toNumber() + : Number(value); // data mapping const shifts: ShiftRow[] = raw_shifts.map(shift => ({ @@ -87,8 +91,7 @@ export class TimesheetsQueryService { const expenses: ExpenseRow[] = raw_expenses.map(expense => ({ date: expense.date, - amount: typeof (expense.amount as any)?.to_num === 'function' ? - (expense.amount as any).to_num() : Number(expense.amount), + amount: to_num(expense.amount), type: String(expense.bank_code?.type ?? '').toUpperCase(), is_approved: expense.is_approved ?? true, }));