Merge branch 'testing' into 'master'
feat: initial user seeder See merge request profile-image/kedaireka/polinema-adapative-learning/backend-adaptive-learning!4
This commit is contained in:
commit
2d3142b416
|
|
@ -1,21 +0,0 @@
|
||||||
const bcrypt = require('bcryptjs');
|
|
||||||
const { v4: uuidv4 } = require('uuid');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
up: async (queryInterface) => {
|
|
||||||
const hashedPassword = await bcrypt.hash('adminsealspolinema24', 10);
|
|
||||||
await queryInterface.bulkInsert('users', [
|
|
||||||
{
|
|
||||||
ID: uuidv4(),
|
|
||||||
NAME_USERS: 'Administrator',
|
|
||||||
EMAIL: 'adminseals@gmail.com',
|
|
||||||
PASSWORD: hashedPassword,
|
|
||||||
ROLE: 'admin',
|
|
||||||
TIME_USERS: new Date(),
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
down: async (queryInterface) => {
|
|
||||||
await queryInterface.bulkDelete('users', { EMAIL: 'adminseals@gmail.com' });
|
|
||||||
},
|
|
||||||
};
|
|
||||||
32
database/seeders/20241012193900-create-initial-user.cjs
Normal file
32
database/seeders/20241012193900-create-initial-user.cjs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
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);
|
||||||
|
await queryInterface.bulkInsert("users", [
|
||||||
|
{
|
||||||
|
ID: uuidv4(),
|
||||||
|
NAME_USERS: "Administrator",
|
||||||
|
EMAIL: "adminseals@gmail.com",
|
||||||
|
PASSWORD: adminHashedPassword,
|
||||||
|
ROLE: "admin",
|
||||||
|
TIME_USERS: new Date(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: uuidv4(),
|
||||||
|
NAME_USERS: "Initial Teacher",
|
||||||
|
EMAIL: "sealsteach@gmail.com",
|
||||||
|
PASSWORD: teacherHashedPassword,
|
||||||
|
ROLE: "teacher",
|
||||||
|
TIME_USERS: new Date(),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
down: async (queryInterface) => {
|
||||||
|
await queryInterface.bulkDelete("users", {
|
||||||
|
EMAIL: ["adminseals@gmail.com", "sealsteach@gmail.com"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user