|
|
@@ -2,7 +2,11 @@ import {
|
|
|
Controller,
|
|
|
Put,
|
|
|
Body,
|
|
|
- Post
|
|
|
+ Post,
|
|
|
+ Delete,
|
|
|
+ Param,
|
|
|
+ HttpStatus,
|
|
|
+ BadRequestException
|
|
|
} from '@nestjs/common'
|
|
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'
|
|
|
import { CommentService } from './comment.service'
|
|
|
@@ -27,4 +31,17 @@ export class CommentController {
|
|
|
return await this.commentService.create(commentDto)
|
|
|
}
|
|
|
|
|
|
+ @Delete('/:id')
|
|
|
+ public async deleteComment(@Param('id') id: number) {
|
|
|
+ try {
|
|
|
+ await this.commentService.delete(id)
|
|
|
+ return {
|
|
|
+ message: 'Comment Deleted successfully!',
|
|
|
+ status: HttpStatus.OK
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ throw new BadRequestException(err, 'Error: Comment not deleted!')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|