[UPDATE] MinioAttachmentService 및 MinioAttachmentController에 프로젝트 ID 처리 로직 추가 및 엔티티 필드 업데이트

main
bjkim 9 months ago
parent c7b9309e63
commit 9bf626cf0e

@ -196,6 +196,8 @@ public class MinioAttachmentController {
public ResponseEntity<Map<String, Object>> updateFile( public ResponseEntity<Map<String, Object>> updateFile(
@Parameter(description = "기존 첨부파일 ID", required = true) @Parameter(description = "기존 첨부파일 ID", required = true)
@PathVariable("id") Long id, @PathVariable("id") Long id,
@Parameter(description = "프로젝트 ID", required = true)
@RequestParam("projectId") Long projectId,
@Parameter(description = "새 파일") @RequestPart("file") MultipartFile file, @Parameter(description = "새 파일") @RequestPart("file") MultipartFile file,
@RequestPart(value = "path", required = false) String path, @RequestPart(value = "path", required = false) String path,
@RequestParam(value = "title", required = false) String title, @RequestParam(value = "title", required = false) String title,
@ -204,7 +206,7 @@ public class MinioAttachmentController {
) { ) {
try { try {
MinioAttachmentEntity updated = minioAttachmentService.updateFile( MinioAttachmentEntity updated = minioAttachmentService.updateFile(
id, file, path, title, description, regUserId id, projectId, file, path, title, description, regUserId
); );
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();

@ -153,6 +153,7 @@ public class MinioAttachmentService {
public MinioAttachmentEntity updateFile( public MinioAttachmentEntity updateFile(
Long id, Long id,
Long projectId, // 추가
MultipartFile file, MultipartFile file,
String path, String path,
String title, String title,
@ -190,6 +191,7 @@ public class MinioAttachmentService {
// 새로운 엔티티 생성 (이전 데이터는 그대로 두고, 새로운 버전 생성) // 새로운 엔티티 생성 (이전 데이터는 그대로 두고, 새로운 버전 생성)
MinioAttachmentEntity newAttachment = MinioAttachmentEntity.builder() MinioAttachmentEntity newAttachment = MinioAttachmentEntity.builder()
.projectId(projectId) // 추가
.refId(existing.getRefId()) .refId(existing.getRefId())
.refType(existing.getRefType()) .refType(existing.getRefType())
.originalName(file.getOriginalFilename()) .originalName(file.getOriginalFilename())
@ -206,7 +208,6 @@ public class MinioAttachmentService {
return minioAttachmentRepository.save(newAttachment); return minioAttachmentRepository.save(newAttachment);
} }
/** /**
* (DB , ) * (DB , )
*/ */

Loading…
Cancel
Save