Skip to content

Commit

Permalink
Merge pull request #741 from bounswe/be/fix_userID_nulability
Browse files Browse the repository at this point in the history
be:Fix userID check bug
  • Loading branch information
Alputer authored Dec 24, 2023
2 parents a1c85e1 + 65fa1fa commit 7acf2ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/backend/src/poll/poll.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class PollModule implements NestModule {
.forRoutes(
{ path: '/poll', method: RequestMethod.GET },
{ path: '/poll/:param', method: RequestMethod.GET },
{ path: '/poll/:id', method: RequestMethod.GET },
);
}
}
2 changes: 1 addition & 1 deletion app/backend/src/poll/poll.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export class PollService {
throw new NotFoundException('Poll not found');
}

const votedOption = (await this.voteService.findOne(poll.id, userId))?.option || null;
const votedOption = userId ? (await this.voteService.findOne(poll.id, userId))?.option || null : null;

let voteDistribution = null;
if (votedOption) {
Expand Down

0 comments on commit 7acf2ef

Please sign in to comment.