diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-25 11:53:21 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-25 11:53:21 +0300 |
commit | a9678b794758164a86a8c136c1d8acc8b1d0135d (patch) | |
tree | 227a72f40a5de620604154221e2a3253f063da97 /hooks | |
parent | cf34d891b349b8bb799393067a77fa23a4874ad5 (diff) | |
download | which-api-a9678b794758164a86a8c136c1d8acc8b1d0135d.tar.gz |
fix: add userChoice correctly
Diffstat (limited to 'hooks')
-rw-r--r-- | hooks/convertPoll.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hooks/convertPoll.ts b/hooks/convertPoll.ts index 4da25c1..1c32851 100644 --- a/hooks/convertPoll.ts +++ b/hooks/convertPoll.ts @@ -22,7 +22,9 @@ export default async (context: HookContext): Promise<HookContext> => { { left: { votes: 0 }, right: { votes: 0 } } )); - const userChoice = await VoteModel.findOne({ pollId: poll._id, userId: user?._id }); + const userChoice = await VoteModel.findOne( + { pollId: poll._id, userId: user?._id } + ).then(vote => vote?.which); return _.merge( _.omit(poll, ['authorId']), |