diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-07-05 13:38:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-05 13:38:33 +0300 |
commit | 96398e544463651413ea80821c09ae7573f46cb1 (patch) | |
tree | df77b6f65247d87dbfde8000e918c83985624fc3 /populateDb.ts | |
parent | da76bb1bd8797c4e1dc657c489f597bf64918ceb (diff) | |
parent | 1c2f3c9e5b39826266d64f4227e53fff139ea948 (diff) | |
download | which-api-96398e544463651413ea80821c09ae7573f46cb1.tar.gz |
Merge pull request #17 from which-ecosystem/security
Prepare release-level backend security
Diffstat (limited to 'populateDb.ts')
-rw-r--r-- | populateDb.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/populateDb.ts b/populateDb.ts index e25005d..1565f44 100644 --- a/populateDb.ts +++ b/populateDb.ts @@ -56,9 +56,8 @@ const createPoll = (authorId: string): Promise<Poll> => { contents: { 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 }); }; |