Merge branch 'main' of git.targo.ca:Targo/targo_backend

This commit is contained in:
Matthieu Haineault 2025-12-12 13:35:39 -05:00
commit 9a8dcbccc3
3 changed files with 5 additions and 10 deletions

View File

@ -20,7 +20,6 @@ export class EmployeeTimesheetResolver {
const employee_id = await this.emailResolver.findIdByEmail(email);
if (!employee_id.success) return { success: false, error: employee_id.error }
const start_date = weekStartSunday(date);
console.log('start date: ', start_date);
const timesheet = await db.timesheets.findFirst({
where: { employee_id: employee_id.data, start_date: start_date },
select: { id: true },

View File

@ -14,17 +14,14 @@ export class SchedulePresetDeleteService {
});
if (!preset) return { success: false, error: `SCHEDULE_PRESET_NOT_FOUND` };
const employee_with_preset = await this.prisma.employees.findMany({
await this.prisma.employees.updateMany({
where: { schedule_preset_id: preset.id },
select: {
schedule_preset_id: true,
data: {
schedule_preset_id: null,
},
});
if(employee_with_preset.length > 0) {
for(const employee of employee_with_preset) {
employee.schedule_preset_id = null;
}
}
await this.prisma.$transaction(async (tx) => {
await tx.schedulePresetShifts.deleteMany({ where: { preset_id: preset_id } });
await tx.schedulePresets.delete({ where: { id: preset_id } });

View File

@ -64,7 +64,6 @@ export class ShiftsUpdateService {
if (!timesheet.success) return { success: false, error: timesheet.error }
//finds original shift
console.log('timesheet id found: ', timesheet.data.id);
const original = await this.prisma.shifts.findFirst({
where: { id: dto.id, timesheet_id: timesheet.data.id },
select: shift_select,