From 5e2ea638af8e8a198886a45d2dc0db449da00f20 Mon Sep 17 00:00:00 2001 From: ThuongHoai081 Date: Thu, 14 Mar 2024 22:37:59 +0700 Subject: [PATCH] fix: file-index-api --- backend/src/core/api/index.js | 2 +- backend/src/core/database/seeds/04-posts.js | 6 +++--- backend/src/core/database/seeds/07-contacts.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/src/core/api/index.js b/backend/src/core/api/index.js index dd035d3..eaeba94 100644 --- a/backend/src/core/api/index.js +++ b/backend/src/core/api/index.js @@ -19,7 +19,7 @@ export const ModuleResolver = HandlerResolver.builder() MediaResolver, HelpSignalResolver, EmergencyResolver, - RelativeResolver + RelativeResolver, CommentResolver, UserReactResolver, ContactResolver, diff --git a/backend/src/core/database/seeds/04-posts.js b/backend/src/core/database/seeds/04-posts.js index a4e9a5f..c40ca9d 100644 --- a/backend/src/core/database/seeds/04-posts.js +++ b/backend/src/core/database/seeds/04-posts.js @@ -9,9 +9,9 @@ const tableName = 'posts'; exports.seed = async knex => { await knex(tableName).del(); - const topics = ["Food", "Accommodation", "Other"]; - const locations = ["130 Dien Bien Phu, Thanh Khe, Da Nang", "132 Nguyen Luong Bang, Lien Chieu, Da Nang", "44 Ho Tuong, Thanh Khe, Da Nang"]; - const posts = Array.from({ length: numUsers }, (_, index) => ({ + const topics = ['Food', 'Accommodation', 'Other']; + const locations = ['130 Dien Bien Phu, Thanh Khe, Da Nang', '132 Nguyen Luong Bang, Lien Chieu, Da Nang', '44 Ho Tuong, Thanh Khe, Da Nang']; + const posts = Array.from({ length: numUsers }, () => ({ topic: topics[fakerVI.number.int({ min: 0, max: topics.length - 1 })], location: locations[fakerVI.number.int({ min: 0, max: locations.length - 1 })], content: fakerVI.lorem.sentence(), diff --git a/backend/src/core/database/seeds/07-contacts.js b/backend/src/core/database/seeds/07-contacts.js index 22ca331..40dea03 100644 --- a/backend/src/core/database/seeds/07-contacts.js +++ b/backend/src/core/database/seeds/07-contacts.js @@ -13,17 +13,17 @@ exports.seed = async knex => { 'Motorbike repair team']; const lengthArr = rescueGroups.length; - const contacts = Array.from({ length: numContacts }, (_, index) => { + const contacts = Array.from({ length: numContacts }, () => { const numRD = Math.floor(Math.random() * lengthArr) + 1; return { group_name: rescueGroups[numRD - 1], - phone_number: '0' + fakerVI.string.numeric({ length: 9 }), + phone_number: `0${ fakerVI.string.numeric({ length: 9 })}`, address: fakerVI.location.streetAddress(), details: fakerVI.lorem.sentence(), latitude: fakerVI.location.latitude(), longitude: fakerVI.location.longitude(), emergency_id: numRD, - } + }; }); await knex(tableName).insert(contacts);