refactor: seeder update
This commit is contained in:
parent
e50f666928
commit
eda1e5c57a
|
|
@ -5,9 +5,13 @@ module.exports = {
|
||||||
up: async (queryInterface) => {
|
up: async (queryInterface) => {
|
||||||
const adminHashedPassword = await bcrypt.hash("adminsealspolinema24", 10);
|
const adminHashedPassword = await bcrypt.hash("adminsealspolinema24", 10);
|
||||||
const teacherHashedPassword = await bcrypt.hash("sealsteacher24", 10);
|
const teacherHashedPassword = await bcrypt.hash("sealsteacher24", 10);
|
||||||
|
|
||||||
|
const adminId = uuidv4();
|
||||||
|
const teacherId = uuidv4();
|
||||||
|
|
||||||
await queryInterface.bulkInsert("users", [
|
await queryInterface.bulkInsert("users", [
|
||||||
{
|
{
|
||||||
ID: uuidv4(),
|
ID: adminId,
|
||||||
NAME_USERS: "Administrator",
|
NAME_USERS: "Administrator",
|
||||||
EMAIL: "adminseals@gmail.com",
|
EMAIL: "adminseals@gmail.com",
|
||||||
PASSWORD: adminHashedPassword,
|
PASSWORD: adminHashedPassword,
|
||||||
|
|
@ -16,7 +20,7 @@ module.exports = {
|
||||||
TIME_USERS: new Date(),
|
TIME_USERS: new Date(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: uuidv4(),
|
ID: teacherId,
|
||||||
NAME_USERS: "Initial Teacher",
|
NAME_USERS: "Initial Teacher",
|
||||||
EMAIL: "sealsteach@gmail.com",
|
EMAIL: "sealsteach@gmail.com",
|
||||||
PASSWORD: teacherHashedPassword,
|
PASSWORD: teacherHashedPassword,
|
||||||
|
|
@ -25,8 +29,22 @@ module.exports = {
|
||||||
TIME_USERS: new Date(),
|
TIME_USERS: new Date(),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
await queryInterface.bulkInsert("teacher", [
|
||||||
|
{
|
||||||
|
ID_GURU: uuidv4(),
|
||||||
|
ID: teacherId,
|
||||||
|
NIP: 1234567890123456,
|
||||||
|
},
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
down: async (queryInterface) => {
|
down: async (queryInterface) => {
|
||||||
|
await queryInterface.bulkDelete("teacher", null, {
|
||||||
|
truncate: true,
|
||||||
|
cascade: true,
|
||||||
|
restartIdentity: true,
|
||||||
|
});
|
||||||
|
|
||||||
await queryInterface.bulkDelete("users", {
|
await queryInterface.bulkDelete("users", {
|
||||||
EMAIL: ["adminseals@gmail.com", "sealsteach@gmail.com"],
|
EMAIL: ["adminseals@gmail.com", "sealsteach@gmail.com"],
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user