package com.krt.newssak.controller; import com.krt.newssak.dto.capi.*; import com.krt.newssak.dto.project.ProjectDto; import com.krt.newssak.service.CapiService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; @Tag(name = "CAPI", description = "면접원 API") @RestController @RequestMapping("api/v1/capi") @RequiredArgsConstructor public class CapiController { private final CapiService capiService; @Operation(summary = "프로젝트 리스트 불러오기", description = "프로젝트 리스트 불러오기") @PostMapping("/getProjectList") public ResponseEntity getProjectList(){ List projectDtoList = capiService.getProjectList(); return ResponseEntity.ok(projectDtoList); } @Operation(summary = "면접원 저장 및 수정", description = "면접원 저장 및 수정") @PostMapping("/saveInterviewer") public ResponseEntity saveInterviewer(@RequestBody List saveInterviewerRequestDtos) throws Exception { capiService.saveInterviewer(saveInterviewerRequestDtos); return ResponseEntity.ok(true); } @Operation(summary = "면접원 리스트 불러오기", description = "면접원 리스트 불러오기") @PostMapping("/getInterviewers") public ResponseEntity saveInterviewer() throws Exception { return ResponseEntity.ok(capiService.getInterviewers()); } @Operation(summary = "면접원 리스트 삭제하기", description = "면접원 리스트 삭제하기") @PostMapping("/deleteInterviewers") public ResponseEntity deleteInterviewers(@RequestBody DeleteInterviewerRequestDto deleteInterviewerRequestDto) throws Exception { capiService.deleteInterviewer(deleteInterviewerRequestDto); return ResponseEntity.ok(true); } @Operation(summary = "면접원 배정 현황", description = "면접원 배정 현황") @PostMapping("/getInterviewerAllocationStatus") public ResponseEntity getInterviewerAllocationStatus(@RequestBody GetInterviewerAllocationStatusRequestDto getInterviewerAllocationStatusRequestDto) throws Exception { Map allocationStatusList = capiService.getInterviewerAllocationStatus(getInterviewerAllocationStatusRequestDto); return ResponseEntity.ok(allocationStatusList); } @Operation(summary = "면접원 배정 저장", description = "면접원 배정 저장") @PostMapping("/saveInterviewerAllocation") public ResponseEntity saveInterviewerAllocation(@RequestBody SaveInterviewerAllocationRequestDto saveInterviewerAllocationRequestDto) throws Exception { capiService.saveInterviewerAllocation(saveInterviewerAllocationRequestDto); return ResponseEntity.ok(true); } @Operation(summary = "면접원 현황", description = "면접원 현황") @PostMapping("/getInterviewerSurveyStatus") public ResponseEntity getInterviewerSurveyStatus(@RequestBody GetInterviewerSurveyStatusRequestDto getInterviewerSurveyStatusRequestDto) throws Exception { return ResponseEntity.ok(capiService.getInterviewerSurveyStatus(getInterviewerSurveyStatusRequestDto)); } @Operation(summary = "면접원 데이터 삭제 요청 리스트 조회", description = "면접원 데이터 삭제 요청 리스트 조회") @PostMapping("/surveyDataDeleteRequest") public ResponseEntity getSurveyDataDeleteRequestList(@RequestBody GetDeleteSurveyReqDataRequestDto getDeleteSurveyReqDataRequestDto) throws Exception { return ResponseEntity.ok(capiService.getSurveyDataDeleteRequestList(getDeleteSurveyReqDataRequestDto)); } @Operation(summary = "면접원 데이터 삭제 요청 승인", description = "면접원 데이터 삭제 요청 승인") @PostMapping("/surveyDataDeleteAccept") public ResponseEntity surveyDataDeleteAccept(@RequestBody SurveyDataDeleteAcceptRequestDto surveyDataDeleteAcceptRequestDto) throws Exception { capiService.surveyDataDeleteAccept(surveyDataDeleteAcceptRequestDto); return ResponseEntity.ok(true); } @Operation(summary = "면접원 리스트 다운로드", description = "면접원 리스트 다운로드") @PostMapping("/interviewerDownloadList") public ResponseEntity interviewerDownloadList(HttpServletResponse response, @RequestBody GetInterviewerSurveyStatusRequestDto listDownloadGetRequestDto) throws Exception { capiService.interviewerDownloadList(response, listDownloadGetRequestDto); return ResponseEntity.ok(true); } }