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

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

Loading…
Cancel
Save