Skip to content

Commit

Permalink
Remove: unnecessary async call
Browse files Browse the repository at this point in the history
  • Loading branch information
kmc7468 committed Jan 6, 2024
1 parent ca2b083 commit 01e3ac4
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/sampleGenerator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,15 @@ const {
const { connectDatabase } = require("../modules/stores/mongo");
const { mongo: mongoUrl, numberOfChats, numberOfRooms } = require("./loadenv");

const fs = require("fs");
const path = require("path");
const sampleDataPath = path.resolve(".", "sampleData.json");

const database = connectDatabase(mongoUrl);

const loadSampleData = new Promise((resolve, reject) => {
fs.readFile(sampleDataPath, (err, data) => {
if (err) {
reject(err);
} else {
resolve(JSON.parse(data));
}
});
});
const fs = require("fs");
const sampleData = JSON.parse(fs.readFileSync("./sampleData.json"));

const main = async () => {
await database.db.dropDatabase();

const { users, locations } = await Promise.resolve(loadSampleData);
const { users, locations } = sampleData;

const userOids = [];
const roomOids = [];
Expand Down

0 comments on commit 01e3ac4

Please sign in to comment.