aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-07-05 12:23:24 +0300
committereug-vs <eug-vs@keemail.me>2020-07-05 12:23:24 +0300
commitfaa7d45674f3886e8ee8ddd64f7250ae6d0c83f7 (patch)
tree41743f95b595945f6c4571c4f5fccbe091f023c3
parentf38a1cf6a6809e85ac2ba47026c42b49bfee3673 (diff)
downloadwhich-api-faa7d45674f3886e8ee8ddd64f7250ae6d0c83f7.tar.gz
feat: update populate script
-rw-r--r--populateDb.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/populateDb.ts b/populateDb.ts
index e25005d..de7ead9 100644
--- a/populateDb.ts
+++ b/populateDb.ts
@@ -57,8 +57,7 @@ const createPoll = (authorId: string): Promise<Poll> => {
left: generateImageData(),
right: generateImageData()
},
- authorId
- });
+ }, { user: { _id: authorId }, authenticated: true });
};
const createUser = (username: string): Promise<User> => {
@@ -69,18 +68,18 @@ const createUser = (username: string): Promise<User> => {
});
};
-const createVote = (userId: string, pollId: string): Promise<Vote> => {
+const createVote = (authorId: string, pollId: string): Promise<Vote> => {
return app.service('votes').create({
pollId,
which: _.sample(choices)
- }, { user: { _id: userId }, authenticated: true });
+ }, { user: { _id: authorId }, authenticated: true });
};
const createFeedback = (userId: string): Promise<Feedback> => {
return app.service('feedback').create({
version: 'v1.0.0',
score: _.sample([1, 2, 3, 4, 5]),
- content: 'Absolutely amazing!'
+ contents: 'Absolutely amazing!'
}, { user: { _id: userId }, authenticated: true });
};