mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
backend working
This commit is contained in:
@@ -1,7 +1,33 @@
|
||||
// backend/src/types/scheduling.ts
|
||||
// backend/src/models/scheduling.ts
|
||||
import { Employee } from './Employee.js';
|
||||
import { ShiftPlan } from './ShiftPlan.js';
|
||||
|
||||
// Add the missing type definitions
|
||||
export interface Availability {
|
||||
id: string;
|
||||
employeeId: string;
|
||||
planId: string;
|
||||
dayOfWeek: number; // 1=Monday, 7=Sunday
|
||||
timeSlotId: string;
|
||||
preferenceLevel: 1 | 2 | 3; // 1:preferred, 2:available, 3:unavailable
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface Constraint {
|
||||
type: string;
|
||||
severity: 'hard' | 'soft';
|
||||
parameters: {
|
||||
maxShiftsPerDay?: number;
|
||||
minEmployeesPerShift?: number;
|
||||
maxEmployeesPerShift?: number;
|
||||
enforceTraineeSupervision?: boolean;
|
||||
contractHoursLimit?: boolean;
|
||||
maxHoursPerWeek?: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
weight?: number; // For soft constraints
|
||||
}
|
||||
|
||||
export interface ScheduleRequest {
|
||||
shiftPlan: ShiftPlan;
|
||||
employees: Employee[];
|
||||
@@ -30,6 +56,7 @@ export interface Violation {
|
||||
message: string;
|
||||
involvedEmployees?: string[];
|
||||
shiftId?: string;
|
||||
details?: any;
|
||||
}
|
||||
|
||||
export interface SolverOptions {
|
||||
@@ -48,4 +75,48 @@ export interface Solution {
|
||||
variablesCreated: number;
|
||||
optimal: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
// Additional helper types for the scheduling system
|
||||
export interface SchedulingConfig {
|
||||
maxRepairAttempts: number;
|
||||
targetEmployeesPerShift: number;
|
||||
enforceNoTraineeAlone: boolean;
|
||||
enforceExperiencedWithChef: boolean;
|
||||
preferEmployeePreferences: boolean;
|
||||
}
|
||||
|
||||
export interface AssignmentResult {
|
||||
assignments: { [shiftId: string]: string[] }; // shiftId -> employeeIds
|
||||
violations: string[];
|
||||
resolutionReport: string[];
|
||||
success: boolean;
|
||||
statistics?: {
|
||||
totalAssignments: number;
|
||||
preferredAssignments: number;
|
||||
availableAssignments: number;
|
||||
coverageRate: number;
|
||||
violationCount: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface EmployeeAvailabilitySummary {
|
||||
employeeId: string;
|
||||
employeeName: string;
|
||||
preferredSlots: number;
|
||||
availableSlots: number;
|
||||
unavailableSlots: number;
|
||||
totalSlots: number;
|
||||
}
|
||||
|
||||
export interface ShiftRequirement {
|
||||
shiftId: string;
|
||||
timeSlotId: string;
|
||||
dayOfWeek: number;
|
||||
date?: string;
|
||||
requiredEmployees: number;
|
||||
minEmployees: number;
|
||||
maxEmployees: number;
|
||||
assignedEmployees: string[];
|
||||
isPriority: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user