Skip to content

Commit

Permalink
fix: fix comment best answer
Browse files Browse the repository at this point in the history
  • Loading branch information
freitagfelipe committed Dec 1, 2023
1 parent 2fc58bd commit 9b280fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
3 changes: 1 addition & 2 deletions src/comment/comment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ export class CommentController {
async updateBestAnswer(
@Param("id", ParseIntPipe) id: number,
@Body() updateBestAnswerDto: UpdateBestAnswerDto,
@Req() req: Request,
) {
await this.commentService.updateBestAnswer(id, req.user.sub, updateBestAnswerDto);
await this.commentService.updateBestAnswer(id, updateBestAnswerDto);
}
}
10 changes: 0 additions & 10 deletions src/comment/comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,10 @@ export class CommentService {

async updateBestAnswer(
id: number,
username: string,
updateBestAnswerDto: UpdateBestAnswerDto,
) {
const bestAnswerComment = await this.commentRepository.findOne({
where: {
user: {
username,
},
post: {
id: updateBestAnswerDto.postId,
},
Expand All @@ -208,9 +204,6 @@ export class CommentService {
return (
await this.commentRepository.update({
id,
user: {
username,
},
post: {
id: updateBestAnswerDto.postId,
},
Expand All @@ -237,9 +230,6 @@ export class CommentService {
return (
await this.commentRepository.update({
id,
user: {
username,
},
post: {
id: updateBestAnswerDto.postId,
},
Expand Down

0 comments on commit 9b280fd

Please sign in to comment.