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,7 +2,8 @@
export interface Employee {
id: string;
email: string;
name: string;
firstname: string;
lastname: string;
role: 'admin' | 'maintenance' | 'user';
employeeType: 'manager' | 'trainee' | 'experienced';
contractType: 'small' | 'large';
@@ -13,9 +14,9 @@ export interface Employee {
}
export interface CreateEmployeeRequest {
email: string;
password: string;
name: string;
firstname: string;
lastname: string;
role: 'admin' | 'maintenance' | 'user';
employeeType: 'manager' | 'trainee' | 'experienced';
contractType: 'small' | 'large';
@@ -23,7 +24,8 @@ export interface CreateEmployeeRequest {
}
export interface UpdateEmployeeRequest {
name?: string;
firstname?: string;
lastname?: string;
role?: 'admin' | 'maintenance' | 'user';
employeeType?: 'manager' | 'trainee' | 'experienced';
contractType?: 'small' | 'large';
@@ -39,8 +41,7 @@ export interface EmployeeAvailability {
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;
}
@@ -72,4 +73,14 @@ export interface ManagerSelfAssignmentRequest {
export interface EmployeeWithAvailabilities extends Employee {
availabilities: EmployeeAvailability[];
}
// Additional types for the new roles system
export interface Role {
role: 'admin' | 'user' | 'maintenance';
}
export interface EmployeeRole {
employeeId: string;
role: 'admin' | 'user' | 'maintenance';
}

View File

@@ -3,14 +3,15 @@ export interface ShiftPlan {
id: string;
name: string;
description?: string;
startDate?: string; // Optional for templates
endDate?: string; // Optional for templates
startDate?: string;
endDate?: string;
isTemplate: boolean;
status: 'draft' | 'published' | 'archived' | 'template';
createdBy: string;
createdAt: string;
timeSlots: TimeSlot[];
shifts: Shift[];
scheduledShifts?: ScheduledShift[];
}
export interface TimeSlot {
@@ -49,16 +50,6 @@ export interface ShiftAssignment {
assignedBy: string;
}
export interface EmployeeAvailability {
id: string;
employeeId: string;
planId: string;
dayOfWeek: number;
timeSlotId: string;
preferenceLevel: 1 | 2 | 3; // 1:preferred, 2:available, 3:unavailable
notes?: string;
}
// Request/Response DTOs
export interface CreateShiftPlanRequest {
name: string;
@@ -68,7 +59,6 @@ export interface CreateShiftPlanRequest {
isTemplate: boolean;
timeSlots: Omit<TimeSlot, 'id' | 'planId'>[];
shifts: Omit<Shift, 'id' | 'planId'>[];
templateId?: string;
}
export interface UpdateShiftPlanRequest {
@@ -95,10 +85,6 @@ export interface AssignEmployeeRequest {
scheduledShiftId: string;
}
export interface UpdateAvailabilityRequest {
planId: string;
availabilities: Omit<EmployeeAvailability, 'id' | 'employeeId'>[];
}
export interface UpdateRequiredEmployeesRequest {
requiredEmployees: number;

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;
}