aboutsummaryrefslogtreecommitdiff
path: root/populateDb.ts
diff options
context:
space:
mode:
authorEugene Sokolov <eug-vs@keemail.me>2020-06-12 20:21:30 +0300
committerGitHub <noreply@github.com>2020-06-12 20:21:30 +0300
commit1860396a1286936374ab88937da3e0b6b9b1a36d (patch)
treeeb905fa1307833c1ab856c387be2fa533ed2ea34 /populateDb.ts
parent0ecf99e2749fe60a20e86b266c6019ebb56e021a (diff)
parent7e4ebee9a0e56546d6dce76c5c48d6d13371c689 (diff)
downloadwhich-api-1860396a1286936374ab88937da3e0b6b9b1a36d.tar.gz
Merge pull request #6 from eug-vs/eslint
Eslint
Diffstat (limited to 'populateDb.ts')
-rw-r--r--populateDb.ts8
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);