import { Controller, Get, Put, Param, Body, Query, UseGuards, } from '@nestjs/common'; import { ReviewService } from './review.service'; import { QueryReviewDto } from './dto/review.dto'; import { JwtAuthGuard, RolesGuard } from '@/common'; import { Roles } from '@/common/decorators/roles.decorator'; // 管理员评价审核接口 @Controller('admin/reviews') @UseGuards(JwtAuthGuard, RolesGuard) @Roles('admin') export class ReviewAdminController { constructor(private readonly reviewService: ReviewService) {} // 评价审核列表 @Get() async list(@Query() query: QueryReviewDto) { return this.reviewService.findAllForAdmin(query); } // 审核通过 @Put(':id/approve') async approve(@Param('id') id: number) { return this.reviewService.approve(Number(id)); } // 审核拒绝 @Put(':id/reject') async reject(@Param('id') id: number, @Body('reason') reason: string) { return this.reviewService.reject(Number(id), reason); } }