[UPDATE] PipelineUploadController에 description 한글 디코딩 로직 추가 및 Minio 업로드 처리 개선

main
bjkim 9 months ago
parent d70e8a042f
commit 9948af81db

@ -20,6 +20,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@ -36,12 +38,6 @@ public class PipelineUploadController {
private final MinioAttachmentService minioAttachmentService;
@Operation(summary = "파이프라인 생성 및 MinIO업로드", description = "Kubeflow에 파이프라인 파일(Multipart)을 업로드하고 MinIO에 저장")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "파이프라인 업로드 및 MinIO 저장 성공"),
@ApiResponse(responseCode = "400", description = "잘못된 요청"),
@ApiResponse(responseCode = "500", description = "서버 내부 오류")
})
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Map<String, Object>> uploadPipeline(
@RequestParam("uploadfile") MultipartFile file,
@ -53,14 +49,20 @@ public class PipelineUploadController {
@RequestParam("projectId") Long projectId
) {
try {
// 1. Kubeflow 파이프라인 업로드
Map<String, Object> result = pipelineUploadService.uploadPipeline(file, name, displayName, description, namespace);
// description 한글 디코딩
String decodedDescription = description != null
? URLDecoder.decode(description, StandardCharsets.UTF_8)
: null;
// 1. Kubeflow 업로드
Map<String, Object> result = pipelineUploadService.uploadPipeline(
file, name, displayName, decodedDescription, namespace);
WorkflowEntity workflow = WorkflowEntity.builder()
.pipelineId((String) result.get("pipeline_id"))
.displayName((String) result.get("display_name"))
.name((String) result.get("name"))
.description((String) result.get("description"))
.description(decodedDescription) // 여기 디코딩 적용
.namespace((String) result.get("namespace"))
.regUserId(regUserId)
.projectId(projectId)
@ -73,19 +75,19 @@ public class PipelineUploadController {
// 2. MinIO 업로드
MinioAttachmentEntity attachment = minioAttachmentService.uploadFile(
file,
"workflows/" + projectId, // 저장 경로 예시
workflow.getId(), // refId : 방금 저장한 워크플로우 PK
"workflows", // refType
displayName, // title
description, // description
1, // version
"workflows/" + projectId,
workflow.getId(),
"workflows",
displayName,
decodedDescription, // 디코딩 적용
1,
regUserId,
projectId
);
String minioUrl = minioAttachmentService.getFileUrl(attachment.getStoragePath());
// 3. 최종 응답 구성
// 3. 최종 응답
Map<String, Object> response = new HashMap<>();
response.put("pipeline", result);
response.put("workflow", workflow);
@ -106,6 +108,7 @@ public class PipelineUploadController {
}
@PostMapping("/runs")
@Operation(
summary = "Kubeflow Run 생성",

Loading…
Cancel
Save