diff --git a/data/seeds/1 - accounts.js b/data/seeds/1 - accounts.js index f9269c4..24188ab 100644 --- a/data/seeds/1 - accounts.js +++ b/data/seeds/1 - accounts.js @@ -1,14 +1,16 @@ +const bcrypt = require('bcryptjs'); +const { saltingRounds } = require('../../config/config'); + exports.seed = function (knex) { // Deletes ALL existing entries return knex('account') .del() .then(function () { - // Inserts seed entries - return knex('account').insert([ + const accountSeeds = [ { username: 'liza', email: 'liza@example.com', - password: 'really-strong-password', + password: 'liza-password', timezone: 'Europe/Brussels', earliest_time: '09:30', latest_time: '22:00', @@ -16,7 +18,7 @@ exports.seed = function (knex) { { username: 'emile', email: 'emile@example.com', - password: 'really-strong-password', + password: 'emile-password', timezone: 'America/New_York', earliest_time: '09:00', latest_time: '20:00', @@ -24,7 +26,7 @@ exports.seed = function (knex) { { username: 'jack', email: 'jack@example.com', - password: 'really-strong-password', + password: 'jack-password', timezone: 'Asia/Kolkata', earliest_time: '10:30', latest_time: '17:00', @@ -32,7 +34,7 @@ exports.seed = function (knex) { { username: 'cynthia', email: 'cynthia@example.com', - password: 'really-strong-password', + password: 'cynthia-password', timezone: 'Europe/Brussels', earliest_time: '06:30', latest_time: '12:00', @@ -40,11 +42,20 @@ exports.seed = function (knex) { { username: 'celine', email: 'celine@example.com', - password: 'really-strong-password', + password: 'celine-password', timezone: 'Europe/Brussels', earliest_time: '10:30', latest_time: '20:00', }, - ]); + ]; + + // Hash password for each user + accountSeeds.forEach((account) => { + let hash = bcrypt.hashSync(account.password, saltingRounds); + account.password = hash; + }); + + // Inserts seed entries + return knex('account').insert(accountSeeds); }); }; diff --git a/data/seeds/5 - availibility.js b/data/seeds/5 - availibility.js index 4bb4cd0..b8af6e5 100644 --- a/data/seeds/5 - availibility.js +++ b/data/seeds/5 - availibility.js @@ -252,7 +252,7 @@ exports.seed = function (knex) { timezone: 'Europe/Brussels', }, - // Meeting 3 - Day 1 + // Meeting 3 - Day 3 { account_id: 1, meeting_id: 'a8344a68-7961-4bff-bb3b-b288f3abcf1c',