package com.krt.newssak.controller; import com.krt.newssak.dto.datamange.*; import com.krt.newssak.service.DataManageService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; 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; @Tag(name = "DataManage", description = "데이터관리 API") @RestController @RequestMapping("api/v1/dataManage") @RequiredArgsConstructor public class DataManageController { private final DataManageService dataManageService; @Operation(summary = "데이터 조회") @PostMapping("/getData") public ResponseEntity getData(@RequestBody GetDataRequestDto getDataRequestDto) throws Exception { List answerQuestionDtoList = dataManageService.getAllData(getDataRequestDto); return ResponseEntity.ok(answerQuestionDtoList); } @Operation(summary = "데이터 수정") @PostMapping("/modifyData") public ResponseEntity modifyData(@RequestBody ModifyDataRequestDto modifyDataRequestDto) throws Exception { long result = dataManageService.modifyData(modifyDataRequestDto); return ResponseEntity.ok(true); } @Operation(summary = "데이터 삭제") @PostMapping("/deleteData") public ResponseEntity deleteData(@RequestBody DeleteDataRequestDto deleteDataRequestDto) throws Exception { long result = dataManageService.deleteData(deleteDataRequestDto); return ResponseEntity.ok(true); } @Operation(summary = "응답자 목록 조회") @PostMapping("/getAnswerUser") public ResponseEntity getAnswerUser(@RequestBody GetAnswerUserRequestDto getAnswerUserRequestDto) throws Exception { List getAnswerUserResponseDtoList = dataManageService.getAnswerUser(getAnswerUserRequestDto); return ResponseEntity.ok(getAnswerUserResponseDtoList); } @Operation(summary = "응답자 데이터 상태 변경") @PostMapping("/changeAnswerStatus") public ResponseEntity changeAnswerStatus(@RequestBody ChangeStatusRequestDto changeStatusRequestDto) throws Exception { long result = dataManageService.changeAnswerStatus(changeStatusRequestDto); return ResponseEntity.ok(true); } }