|
|
|
|
@ -5,10 +5,9 @@ import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import kr.re.etri.autoflow.entity.DataGroupEntity;
|
|
|
|
|
import kr.re.etri.autoflow.payload.request.BaseSearchRequest;
|
|
|
|
|
import kr.re.etri.autoflow.payload.request.ProjectBaseSearchRequest;
|
|
|
|
|
import kr.re.etri.autoflow.payload.request.ProjectRequest;
|
|
|
|
|
import kr.re.etri.autoflow.service.DataGroupService;
|
|
|
|
|
import kr.re.etri.autoflow.service.ProjectService;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springdoc.core.annotations.ParameterObject;
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
@ -17,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Tag(name = "데이터 그룹", description = "Project CRUD 기능 제공")
|
|
|
|
|
@Tag(name = "데이터 그룹", description = "데이터 그룹 CRUD 기능 제공")
|
|
|
|
|
@CrossOrigin(origins = "*", maxAge = 3600)
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/api/datagroup")
|
|
|
|
|
@ -26,16 +25,16 @@ public class DataGroupController {
|
|
|
|
|
|
|
|
|
|
private final DataGroupService dataGroupService;
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "전체 프로젝트 목록 조회")
|
|
|
|
|
@Operation(summary = "전체 데이터 그룹 목록 조회")
|
|
|
|
|
@GetMapping
|
|
|
|
|
public ResponseEntity<List<DataGroupEntity>> getAllProjects() {
|
|
|
|
|
return ResponseEntity.ok(dataGroupService.findAll());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "ID로 프로젝트 조회")
|
|
|
|
|
@Operation(summary = "ID로 데이터 그룹 조회")
|
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
|
public ResponseEntity<DataGroupEntity> getProjectById(
|
|
|
|
|
@Parameter(description = "조회할 프로젝트 ID", required = true, in = ParameterIn.PATH)
|
|
|
|
|
@Parameter(description = "조회할 데이터 그룹 ID", required = true, in = ParameterIn.PATH)
|
|
|
|
|
@PathVariable("id") Long id) {
|
|
|
|
|
|
|
|
|
|
return dataGroupService.findById(id)
|
|
|
|
|
@ -43,15 +42,15 @@ public class DataGroupController {
|
|
|
|
|
.orElse(ResponseEntity.notFound().build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "검색 및 페이지네이션 프로젝트 목록 조회")
|
|
|
|
|
@Operation(summary = "검색 및 페이지네이션 데이터 그룹 목록 조회")
|
|
|
|
|
@GetMapping("/search")
|
|
|
|
|
public ResponseEntity<Page<DataGroupEntity>> searchProjects(
|
|
|
|
|
@ParameterObject @ModelAttribute BaseSearchRequest request) {
|
|
|
|
|
@ParameterObject @ModelAttribute ProjectBaseSearchRequest request) {
|
|
|
|
|
Page<DataGroupEntity> page = dataGroupService.search(request);
|
|
|
|
|
return ResponseEntity.ok(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "프로젝트 생성")
|
|
|
|
|
@Operation(summary = "데이터 그룹 생성")
|
|
|
|
|
@PostMapping
|
|
|
|
|
public ResponseEntity<?> createProject(@RequestBody DataGroupEntity project) {
|
|
|
|
|
try {
|
|
|
|
|
@ -62,10 +61,10 @@ public class DataGroupController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "프로젝트 수정")
|
|
|
|
|
@Operation(summary = "데이터 그룹 수정")
|
|
|
|
|
@PutMapping("/{id}")
|
|
|
|
|
public ResponseEntity<DataGroupEntity> updateProject(
|
|
|
|
|
@Parameter(description = "수정할 프로젝트 ID", required = true, in = ParameterIn.PATH)
|
|
|
|
|
@Parameter(description = "수정할 데이터 그룹 ID", required = true, in = ParameterIn.PATH)
|
|
|
|
|
@PathVariable("id") Long id,
|
|
|
|
|
@RequestBody ProjectRequest dto) {
|
|
|
|
|
|
|
|
|
|
@ -74,10 +73,10 @@ public class DataGroupController {
|
|
|
|
|
.orElse(ResponseEntity.notFound().build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "프로젝트 삭제")
|
|
|
|
|
@Operation(summary = "데이터 그룹 삭제")
|
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
|
public ResponseEntity<Void> deleteProject(
|
|
|
|
|
@Parameter(description = "삭제할 프로젝트 ID", required = true, in = ParameterIn.PATH)
|
|
|
|
|
@Parameter(description = "삭제할 데이터 그룹 ID", required = true, in = ParameterIn.PATH)
|
|
|
|
|
@PathVariable("id") Long id) {
|
|
|
|
|
if (dataGroupService.delete(id)) {
|
|
|
|
|
return ResponseEntity.noContent().build();
|
|
|
|
|
|