changed email creation

This commit is contained in:
2025-10-20 01:50:12 +02:00
parent 9393de5239
commit e80bb81b5d
9 changed files with 308 additions and 98 deletions

View File

@@ -2,15 +2,20 @@
import { Employee } from './Employee.js';
import { ShiftPlan } from './ShiftPlan.js';
// Add the missing type definitions
// Updated Availability interface to match new schema
export interface Availability {
id: string;
employeeId: string;
planId: string;
dayOfWeek: number; // 1=Monday, 7=Sunday
timeSlotId: string;
shiftId: string; // Now references shift_id instead of time_slot_id + day_of_week
preferenceLevel: 1 | 2 | 3; // 1:preferred, 2:available, 3:unavailable
notes?: string;
// Optional convenience fields (can be joined from shifts and time_slots tables)
dayOfWeek?: number;
timeSlotId?: string;
timeSlotName?: string;
startTime?: string;
endTime?: string;
}
export interface Constraint {
@@ -75,6 +80,7 @@ export interface Solution {
variablesCreated: number;
optimal: boolean;
};
variables?: { [key: string]: number };
}
// Additional helper types for the scheduling system
@@ -119,4 +125,77 @@ export interface ShiftRequirement {
maxEmployees: number;
assignedEmployees: string[];
isPriority: boolean;
}
// New types for the updated schema
export interface EmployeeWithRoles extends Employee {
roles: string[];
}
export interface ShiftWithDetails {
id: string;
planId: string;
timeSlotId: string;
dayOfWeek: number;
requiredEmployees: number;
color?: string;
timeSlot: {
id: string;
name: string;
startTime: string;
endTime: string;
description?: string;
};
}
export interface AvailabilityWithDetails extends Availability {
employee?: {
id: string;
firstname: string;
lastname: string;
employeeType: 'manager' | 'trainee' | 'experienced';
canWorkAlone: boolean;
};
shift?: {
dayOfWeek: number;
timeSlotId: string;
timeSlot?: {
name: string;
startTime: string;
endTime: string;
};
};
}
// Types for scheduling algorithm input
export interface SchedulingInput {
planId: string;
startDate: string;
endDate: string;
constraints: Constraint[];
options?: SolverOptions;
}
// Types for scheduling results with enhanced information
export interface EnhancedAssignment extends Assignment {
employeeName: string;
shiftDetails: {
date: string;
dayOfWeek: number;
timeSlotName: string;
startTime: string;
endTime: string;
};
preferenceLevel: number;
}
export interface SchedulingStatistics {
totalShifts: number;
totalAssignments: number;
coverageRate: number;
preferenceSatisfaction: number;
constraintViolations: number;
hardConstraintViolations: number;
softConstraintViolations: number;
processingTime: number;
}