From 0d62fa40cfc2402d4fa8d544138264c7d160a0e9 Mon Sep 17 00:00:00 2001 From: Dzyfhuba Date: Fri, 1 Jul 2022 00:44:06 +0700 Subject: [PATCH] fix seeder --- src/app/database/seeder/BillSeeder.js | 14 +++++++++----- src/app/database/seeder/NotificationSeeder.js | 10 +++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/app/database/seeder/BillSeeder.js b/src/app/database/seeder/BillSeeder.js index 3fcb43a..5aa3302 100644 --- a/src/app/database/seeder/BillSeeder.js +++ b/src/app/database/seeder/BillSeeder.js @@ -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(), }); } } diff --git a/src/app/database/seeder/NotificationSeeder.js b/src/app/database/seeder/NotificationSeeder.js index 3603304..aa69fc8 100644 --- a/src/app/database/seeder/NotificationSeeder.js +++ b/src/app/database/seeder/NotificationSeeder.js @@ -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(), }); });