[ADD] 파이프라인 ID로 워크플로우 단건 조회 API 추가 및 관련 Service, Repository 메서드 구현

main
bjkim 8 months ago
parent 69d29885ed
commit 56de5c1f72

@ -38,6 +38,16 @@ public class WorkFlowController {
.orElse(ResponseEntity.notFound().build()); .orElse(ResponseEntity.notFound().build());
} }
@Operation(summary = "파이프라인 ID로 워크플로우 단건 조회")
@GetMapping("/pipeline/{pipelineId}")
public ResponseEntity<WorkflowEntity> getWorkflowByPipelineId(
@Parameter(description = "파이프라인 ID", example = "b935cc31-0db5-405e-8ae9-f4dbdc418c59") @PathVariable("pipelineId") String pipelineId) {
return workflowService.findBypipelineId(pipelineId)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
@Operation(summary = "워크플로우 검색 및 페이지네이션 프로젝트 목록 조회") @Operation(summary = "워크플로우 검색 및 페이지네이션 프로젝트 목록 조회")
@GetMapping("/search") @GetMapping("/search")
public ResponseEntity<Page<WorkflowEntity>> searchProjects( public ResponseEntity<Page<WorkflowEntity>> searchProjects(

@ -4,5 +4,8 @@ import kr.re.etri.autoflow.entity.WorkflowEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.Optional;
public interface WorkflowRepository extends JpaRepository<WorkflowEntity, Long>, JpaSpecificationExecutor<WorkflowEntity> { public interface WorkflowRepository extends JpaRepository<WorkflowEntity, Long>, JpaSpecificationExecutor<WorkflowEntity> {
Optional<WorkflowEntity> findByPipelineId(String pipelineId);
} }

@ -81,4 +81,9 @@ public class WorkFlowService {
return workflowRepository.findAll(spec, pageable); return workflowRepository.findAll(spec, pageable);
} }
public Optional<WorkflowEntity> findBypipelineId(String pipelineId) {
return workflowRepository.findByPipelineId(pipelineId);
}
} }

Loading…
Cancel
Save