Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/pre-processing-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/blogger
/key
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package site.icebang.domain.workflow.controller;

import java.util.List;
import java.util.Map;

import org.springframework.http.HttpStatus;
Expand All @@ -9,7 +10,9 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

import site.icebang.common.dto.ApiResponse;
import site.icebang.domain.workflow.dto.TaskDto;
import site.icebang.domain.workflow.model.TaskIoData;
import site.icebang.domain.workflow.service.WorkflowService;

@RestController
Expand All @@ -33,4 +36,30 @@ public ResponseEntity<Map<String, Object>> getTask(@PathVariable Long id) {
}
return ResponseEntity.ok(Map.of("success", true, "data", task));
}

/**
* Task Run ID 목록으로 Task IO 데이터 조회
*
* @param taskRunIds Task Run ID 목록 (쉼표로 구분)
* @param ioType IO 타입 필터 ("INPUT", "OUTPUT", 미지정시 모두 조회)
* @param limit 조회 제한 수 (선택사항)
* @return Task IO 데이터 목록 (created_at 기준 내림차순 정렬)
*/
@GetMapping("/io-data")
public ResponseEntity<ApiResponse<List<TaskIoData>>> getTaskIoData(
@RequestParam List<Long> taskRunIds,
@RequestParam(required = false) String ioType,
@RequestParam(required = false) Integer limit) {

try {
List<TaskIoData> ioData =
workflowService.getTaskIoDataByTaskRunIds(taskRunIds, ioType, limit);
return ResponseEntity.ok(ApiResponse.success(ioData, "Task IO 데이터 조회 성공"));
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(
ApiResponse.error(
"Task IO 데이터 조회 실패: " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package site.icebang.domain.workflow.mapper;

import java.util.List;
import java.util.Optional;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import site.icebang.domain.workflow.model.TaskIoData;

Expand All @@ -11,4 +13,9 @@ public interface TaskIoDataMapper {
void insert(TaskIoData taskIoData);

Optional<TaskIoData> findOutputByTaskRunId(Long taskRunId);

List<TaskIoData> findByTaskRunIds(
@Param("taskRunIds") List<Long> taskRunIds,
@Param("ioType") String ioType,
@Param("limit") Integer limit);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import site.icebang.domain.schedule.service.QuartzScheduleService;
import site.icebang.domain.workflow.dto.*;
import site.icebang.domain.workflow.mapper.JobMapper;
import site.icebang.domain.workflow.mapper.TaskIoDataMapper;
import site.icebang.domain.workflow.mapper.TaskMapper;
import site.icebang.domain.workflow.mapper.WorkflowMapper;
import site.icebang.domain.workflow.model.TaskIoData;

/**
* 워크플로우의 '정의'와 관련된 비즈니스 로직을 처리하는 서비스 클래스입니다.
Expand All @@ -52,6 +54,7 @@ public class WorkflowService implements PageableService<WorkflowCardDto> {
private final QuartzScheduleService quartzScheduleService;
private final JobMapper jobMapper;
private final TaskMapper taskMapper;
private final TaskIoDataMapper taskIoDataMapper;

/**
* 워크플로우 목록을 페이징 처리하여 조회합니다.
Expand Down Expand Up @@ -248,6 +251,23 @@ public TaskDto findTaskById(Long id) {
return taskMapper.findTaskById(id);
}

/**
* Task Run ID 목록으로 Task IO 데이터 조회
*
* @param taskRunIds Task Run ID 목록
* @param ioType IO 타입 필터 ("INPUT", "OUTPUT", null이면 모두 조회)
* @param limit 조회 제한 수 (null이면 모두 조회)
* @return Task IO 데이터 목록 (created_at 기준 내림차순 정렬)
*/
@Transactional(readOnly = true)
public List<TaskIoData> getTaskIoDataByTaskRunIds(
List<Long> taskRunIds, String ioType, Integer limit) {
if (taskRunIds == null || taskRunIds.isEmpty()) {
return List.of();
}
return taskIoDataMapper.findByTaskRunIds(taskRunIds, ioType, limit);
}

/** 기본 입력값 검증 */
private void validateBasicInput(WorkflowCreateDto dto, BigInteger createdBy) {
if (dto == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,19 @@
ORDER BY id DESC
LIMIT 1
</select>

<select id="findByTaskRunIds" resultType="site.icebang.domain.workflow.model.TaskIoData">
SELECT * FROM task_io_data
WHERE task_run_id IN
<foreach collection="taskRunIds" item="taskRunId" open="(" separator="," close=")">
#{taskRunId}
</foreach>
<if test="ioType != null and ioType != ''">
AND io_type = #{ioType}
</if>
ORDER BY created_at DESC
<if test="limit != null">
LIMIT #{limit}
</if>
</select>
</mapper>
Loading