File size: 1,284 Bytes
d76f93d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
// export enum LibrarySection {
// FICTION = "fiction",
// NON_FICTION = "non_fiction",
// CHILDREN = "children",
// REFERENCE = "reference",
// PERIODICALS = "periodicals",
// RARE_BOOKS = "rare_books",
// MULTIMEDIA = "multimedia",
// ADMINISTRATION = "administration",
// }
import { readMyData } from "../utils/fileStorage";
import { LinkManager } from "./LinkManager";
export enum DayOfWeek {
MONDAY = "monday",
TUESDAY = "tuesday",
WEDNESDAY = "wednesday",
THURSDAY = "thursday",
FRIDAY = "friday",
SATURDAY = "saturday",
SUNDAY = "sunday",
}
export interface Employee {
id: string;
name: string;
surname: string;
experience: number;
workDays: DayOfWeek[];
}
export class EmployeeLinkManager extends LinkManager<Employee> {
protected fileName = "employees.sea";
protected tableName = "employees";
async findWorkingOnDay(day: string): Promise<Employee[]> {
const employees = await readMyData<Employee>(this.fileName);
return employees.filter((e) => e.workDays.includes(day as DayOfWeek));
}
}
export const employeeLinkManager = new EmployeeLinkManager();
export interface CreateEmployeeRequest {
name: string;
surname: string;
experience: number;
workDays: DayOfWeek[];
}
|