diff options
Diffstat (limited to 'populateDb.ts')
-rw-r--r-- | populateDb.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/populateDb.ts b/populateDb.ts index 8000111..0a89cc9 100644 --- a/populateDb.ts +++ b/populateDb.ts @@ -37,7 +37,7 @@ const createPoll = (authorId: string): Promise<PollSchema> => { return app.service('polls').create({ contents: { left: generateImageData(), - right: generateImageData(), + right: generateImageData() }, authorId }); @@ -54,10 +54,10 @@ const createUser = (name: string): Promise<UserSchema> => { const populate = async () => { const users = await bluebird.map(names, name => createUser(name)); - for (let i = 0; i < POLLS_AMOUNT; i++) { + await bluebird.mapSeries(new Array(POLLS_AMOUNT), async () => { const sampleUser = _.sample(users); - await createPoll(sampleUser?._id); - }; + return createPoll(sampleUser?._id); + }); }; populate().finally(mongoose.disconnect); |