import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { EvaluationService } from '../service/evaluation.service';
import { TokenData } from 'src/common/decorator/token-data.decorator';
import { TokenDataEntity } from 'src/common/entities/token-data.entity';
import { StudentEvaluationDto } from '../dto/student-evaluation.dto';

@Controller('evaluation')
export class EvaluationController {
  constructor(private readonly evaluationService: EvaluationService) {}

  /**
   * 新建或修改评论
   */
  @Post()
  create(
    @Body() data: StudentEvaluationDto,
    @TokenData() token: TokenDataEntity,
  ) {
    data.creator = data.updater = token.userId;
    return this.evaluationService.create(data);
  }
  @Get()
  findAllTakeChargeStudent(@TokenData() token: TokenDataEntity) {
    return this.evaluationService.findAllTakeCharge(token);
  }
  @Get('my')
  findMyEavluation(@TokenData() token: TokenDataEntity) {
    return this.evaluationService.findMyEavluation(token);
  }
  // @Get()
  // findAll(@TokenData() token: TokenDataEntity) {
  //   return this.evaluationService.findAll(token);
  // }
}
