Skip to content

Commit

Permalink
fix seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzyfhuba committed Jun 30, 2022
1 parent c867547 commit 0d62fa4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 9 additions & 5 deletions src/app/database/seeder/BillSeeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ exports.seed = async function (knex) {
id: nanoid(),
user_id: user.id,
name: faker.word.noun(),
description: faker.lorem.paragraph(),
goal_amount: Math.floor(Math.random() * 1000000) + 1000000,
due_date: faker.date.future(),
type: type[Math.floor(Math.random() * type.length)],
status: status[Math.floor(Math.random() * status.length)],
// description: faker.lorem.paragraph(),
// goal_amount: Math.floor(Math.random() * 1000000) + 1000000,
// due_date: faker.date.future(),
// type: type[Math.floor(Math.random() * type.length)],
// status: status[Math.floor(Math.random() * status.length)],
payment: faker.finance.amount(),
date: faker.date.future(),
reminder: faker.datatype.boolean(),
status_paid: faker.datatype.boolean(),
});
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/app/database/seeder/NotificationSeeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ exports.seed = async function (knex) {
await knex('notifications').del();

const notification_temps = await NotificationTemp.all();
const users = await User.all();

const data = [];

notification_temps.forEach((notification_temp) => {
users.forEach((user) => {
data.push({
id: nanoid(),
id_ntemp: notification_temp.id,
user_id: user.id,
name: faker.word.verb(),
bill: faker.word.noun(),
tag: faker.random.numeric() % 10,
dateline: faker.date.future(),
description: faker.lorem.sentence(),
link: faker.lorem.slug(),
// link: faker.lorem.slug(),
is_reading: faker.datatype.boolean(),
});
});
Expand Down

0 comments on commit 0d62fa4

Please sign in to comment.