comment.controller.ts 779 B

123456789101112131415161718192021222324252627282930
  1. import {
  2. Controller,
  3. Put,
  4. Body,
  5. Post
  6. } from '@nestjs/common'
  7. import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'
  8. import { CommentService } from './comment.service'
  9. import { Comment } from './entities/comment.entity'
  10. import { PageRequest } from 'src/common/dto/page-request'
  11. import { CommentDto } from './dto/comment.dto'
  12. @ApiTags('comment')
  13. @Controller('/comment')
  14. @ApiBearerAuth()
  15. export class CommentController {
  16. constructor(private readonly commentService: CommentService) { }
  17. @Post()
  18. public async list(@Body() page: PageRequest<Comment>) {
  19. return await this.commentService.findAll(page)
  20. }
  21. @Put()
  22. public async create(@Body() commentDto: CommentDto) {
  23. return await this.commentService.create(commentDto)
  24. }
  25. }