ein runtime error

This commit is contained in:
2025-10-16 00:17:30 +02:00
parent d60a6d9fae
commit 7b2256c0ed
10 changed files with 119 additions and 68 deletions

View File

@@ -1,4 +1,5 @@
// backend/src/models/helpers/shiftPlanHelpers.ts
import { shiftAssignmentService } from '../../services/shiftAssignmentService.js';
import { ShiftPlan, Shift, ScheduledShift, TimeSlot } from '../ShiftPlan.js';
// Validation helpers
@@ -78,15 +79,16 @@ export function calculateTotalRequiredEmployees(plan: ShiftPlan): number {
return plan.shifts.reduce((total, shift) => total + shift.requiredEmployees, 0);
}
export function getScheduledShiftByDateAndTime(
/*export async function getScheduledShiftByDateAndTime(
plan: ShiftPlan,
date: string,
timeSlotId: string
): ScheduledShift | undefined {
return plan.scheduledShifts?.find(shift =>
shift.date === date && shift.timeSlotId === timeSlotId
): Promise<ScheduledShift | undefined> {
const scheduledShifts = await shiftAssignmentService.getScheduledShiftsForPlan(plan.id);
return scheduledShifts.find(
shift => shift.date === date && shift.timeSlotId === timeSlotId
);
}
}*/
export function canPublishPlan(plan: ShiftPlan): { canPublish: boolean; errors: string[] } {
const errors: string[] = [];