fix(expense): fix issue where timesheet id is not updated properly when expense changes week on update.

This commit is contained in:
Nic D. 2026-03-11 16:42:18 -04:00
parent daf35d0e40
commit aa68b5384b

View File

@ -57,16 +57,19 @@ export class ExpenseUpdateService {
if (!timesheet) return { success: false, error: `TIMESHEET_NOT_FOUND` } if (!timesheet) return { success: false, error: `TIMESHEET_NOT_FOUND` }
const data = { const data = {
...normed_expense.data, ...normed_expense.data,
bank_code_id: type.data, bank_code_id: type.data,
is_approved: dto.is_approved, is_approved: dto.is_approved,
timesheet_id: timesheet.id,
}; };
if (!data) return { success: false, error: `INVALID_EXPENSE` } if (!data) return { success: false, error: `INVALID_EXPENSE` }
const expense = await this.prisma.expenses.update({ const expense = await this.prisma.expenses.update({
where: { id: dto.id, timesheet_id: timesheet.id }, where: { id: dto.id },
data, data,
select: expense_select, select: expense_select,
}); });