2024-11-06 06:35:08 +00:00
|
|
|
const bcrypt = require("bcryptjs");
|
|
|
|
|
const { v4: uuidv4 } = require("uuid");
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
up: async (queryInterface) => {
|
|
|
|
|
const adminHashedPassword = await bcrypt.hash("adminsealspolinema24", 10);
|
|
|
|
|
const teacherHashedPassword = await bcrypt.hash("sealsteacher24", 10);
|
2024-12-18 12:31:03 +00:00
|
|
|
|
|
|
|
|
const adminId = uuidv4();
|
|
|
|
|
const teacherId = uuidv4();
|
|
|
|
|
|
2024-11-06 06:35:08 +00:00
|
|
|
await queryInterface.bulkInsert("users", [
|
|
|
|
|
{
|
2024-12-18 12:31:03 +00:00
|
|
|
ID: adminId,
|
2024-11-06 06:35:08 +00:00
|
|
|
NAME_USERS: "Administrator",
|
|
|
|
|
EMAIL: "adminseals@gmail.com",
|
|
|
|
|
PASSWORD: adminHashedPassword,
|
|
|
|
|
ROLE: "admin",
|
2024-11-07 02:18:27 +00:00
|
|
|
IS_VALIDATED: 1,
|
2024-11-06 06:35:08 +00:00
|
|
|
TIME_USERS: new Date(),
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-12-18 12:31:03 +00:00
|
|
|
ID: teacherId,
|
2024-11-06 06:35:08 +00:00
|
|
|
NAME_USERS: "Initial Teacher",
|
|
|
|
|
EMAIL: "sealsteach@gmail.com",
|
|
|
|
|
PASSWORD: teacherHashedPassword,
|
|
|
|
|
ROLE: "teacher",
|
2024-11-07 02:18:27 +00:00
|
|
|
IS_VALIDATED: 1,
|
2024-11-06 06:35:08 +00:00
|
|
|
TIME_USERS: new Date(),
|
|
|
|
|
},
|
|
|
|
|
]);
|
2024-12-18 12:31:03 +00:00
|
|
|
|
|
|
|
|
await queryInterface.bulkInsert("teacher", [
|
|
|
|
|
{
|
|
|
|
|
ID_GURU: uuidv4(),
|
|
|
|
|
ID: teacherId,
|
|
|
|
|
NIP: 1234567890123456,
|
|
|
|
|
},
|
|
|
|
|
]);
|
2024-11-06 06:35:08 +00:00
|
|
|
},
|
|
|
|
|
down: async (queryInterface) => {
|
2024-12-18 12:31:03 +00:00
|
|
|
await queryInterface.bulkDelete("teacher", null, {
|
|
|
|
|
truncate: true,
|
|
|
|
|
cascade: true,
|
|
|
|
|
restartIdentity: true,
|
|
|
|
|
});
|
|
|
|
|
|
2024-11-06 06:35:08 +00:00
|
|
|
await queryInterface.bulkDelete("users", {
|
|
|
|
|
EMAIL: ["adminseals@gmail.com", "sealsteach@gmail.com"],
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
};
|