64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
// import { PrismaClient } from "@prisma/client"
|
|
|
|
// const prisma = new PrismaClient({});
|
|
|
|
// const admin_list: number[] = [2, 6, 8, 20, 27, 28, 43, 46, 60];
|
|
|
|
// export const initializePreferences = async () => {
|
|
// console.log('start of preferences and Module Access initialization')
|
|
// for (let id = 1; id <= 61; id++) {
|
|
// const user = await prisma.employees.findUnique({
|
|
// where: { id },
|
|
// select: { user_id: true },
|
|
// });
|
|
// if (!user) {
|
|
// console.log(`user_id for employee ${id} not found`);
|
|
// continue;
|
|
// }
|
|
// console.log(`user_id for employee ${id} found`);
|
|
|
|
// await prisma.preferences.create({
|
|
// data: {
|
|
// display_language: 'fr-Fr',
|
|
// is_dark_mode: null,
|
|
// is_employee_list_grid: false,
|
|
// is_lefty_mode: false,
|
|
// is_timesheet_approval_grid: false,
|
|
// notifications: true,
|
|
// user_id: user.user_id,
|
|
// },
|
|
// });
|
|
// console.log(`Preferences for employee ${id} initiated`);
|
|
|
|
// await prisma.userModuleAccess.create({
|
|
// data: {
|
|
// user_id: user.user_id,
|
|
// dashboard: true,
|
|
// employee_list: true,
|
|
// employee_management: false,
|
|
// personal_profile: true,
|
|
// timesheets: true,
|
|
// timesheets_approval: false,
|
|
// },
|
|
// });
|
|
// console.log(`Module Access for employee ${id} initiated`);
|
|
|
|
// if (id in admin_list) {
|
|
// console.log(`employee ${id} is and admin`)
|
|
// await prisma.userModuleAccess.update({
|
|
// where: { user_id: user.user_id },
|
|
// data: {
|
|
// dashboard: true,
|
|
// employee_list: true,
|
|
// employee_management: true,
|
|
// personal_profile: true,
|
|
// timesheets: true,
|
|
// timesheets_approval: true,
|
|
// },
|
|
// });
|
|
// console.log(`Module Access for employee ${id} updated`);
|
|
// }
|
|
// }
|
|
// }
|
|
|