Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rgonslayer committed Nov 16, 2023
1 parent 97555c7 commit 7a5cf40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 3 additions & 6 deletions question-service/src/questions/question.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,21 @@ export class QuestionController {
return await this.questionService.getRandomQuestionWithDifficulty(difficulty);
}

@UseGuards(AccessTokenGuard)
@UseGuards(RolesGuard)
@UseGuards(AccessTokenGuard, RolesGuard)
@Roles([UserRole.Admin])
@Post()
async addQuestion(@Body() questionDto: QuestionDto) {
return await this.questionService.addQuestion(questionDto);
}

@UseGuards(AccessTokenGuard)
@UseGuards(RolesGuard)
@UseGuards(AccessTokenGuard, RolesGuard)
@Roles([UserRole.Admin])
@Delete('/:questionId')
async deleteQuestion(@Param("questionId") questionId: string) {
await this.questionService.deleteQuestion(questionId);
}

@UseGuards(AccessTokenGuard)
@UseGuards(RolesGuard)
@UseGuards(AccessTokenGuard, RolesGuard)
@Roles([UserRole.Admin])
@Put('/:questionId')
async editQuestion(@Param("questionId") questionId: string, @Body() questionDto: QuestionDto) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class LiveQuestionRepository {
return true;
} catch (error) {
console.error(error);
throw(error)
return false;
}
}
Expand Down

0 comments on commit 7a5cf40

Please sign in to comment.