diff --git a/app/backend/src/poll/poll.module.ts b/app/backend/src/poll/poll.module.ts index 12c306e9..ff85aac1 100644 --- a/app/backend/src/poll/poll.module.ts +++ b/app/backend/src/poll/poll.module.ts @@ -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 }, ); } } diff --git a/app/backend/src/poll/poll.service.ts b/app/backend/src/poll/poll.service.ts index 052190e8..622dc942 100644 --- a/app/backend/src/poll/poll.service.ts +++ b/app/backend/src/poll/poll.service.ts @@ -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) {