21 lines
668 B
TypeScript
21 lines
668 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
const prisma = new PrismaClient({});
|
|
|
|
export const initializePaidTimeOff = async () => {
|
|
const list_of_employees = await prisma.employees.findMany();
|
|
|
|
console.warn('Start of initialization of paid time off');
|
|
for (let id = 1; id <= list_of_employees.length + 1; id++) {
|
|
await prisma.paidTimeOff.create({
|
|
data: {
|
|
last_updated: new Date(),
|
|
banked_hours: 0,
|
|
employee_id: id,
|
|
sick_hours: 0,
|
|
vacation_hours: 0,
|
|
},
|
|
});
|
|
console.log('paid time off initialized for employee ', id);
|
|
}
|
|
} |