feat(db): v4 migration + shared types for specialist auto-assignment

Adds auto_assign_specialist + working_hours to businesses, and specialties + working_hours + efficiency_score to employees, with idempotent migrateV3ToV4 (backfills default Lun-Vie 09:00-20:00 working hours). Updates Business/Employee types and adds WorkingHoursMap.
This commit is contained in:
AgendaPro Dev
2026-07-26 15:59:02 -06:00
parent e8d2435cc2
commit 9d78663cfe
2 changed files with 49 additions and 0 deletions
+14
View File
@@ -14,9 +14,20 @@ export interface Business {
status?: string;
template?: string | null;
trial_ends_at?: string | null;
booking_enabled?: number | boolean;
cancel_window_hours?: number;
cancel_penalty_pct?: number;
require_deposit?: number | boolean;
deposit_pct?: number;
timezone?: string;
auto_assign_specialist?: number | boolean;
working_hours?: WorkingHoursMap | string | null;
created_at?: string;
}
export type WorkingDay = { start: string; end: string };
export type WorkingHoursMap = Record<number, WorkingDay | null>; // 1=Lun … 7=Dom
export interface User {
id: number;
business_id: number | null;
@@ -39,6 +50,9 @@ export interface Employee {
rating: number;
hire_date: string | null;
service_ids?: number[];
specialties?: string[];
working_hours?: WorkingHoursMap | string | null;
efficiency_score?: number;
stats?: EmployeeStats;
}