Merge branch 'susu' into dev

This commit is contained in:
주수현
2025-06-26 16:51:34 +09:00
2 changed files with 13 additions and 3 deletions

View File

@@ -1,11 +1,13 @@
package app.module.front.usecase.editor.adapters.web;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.file.saveToStorage.ports.SaveToStoragePortIn;
import app.module.core.usecase.file.saveToStorage.ports.application.domain.SaveToStorage;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
@@ -19,6 +21,9 @@ public class EditorImageUploadController {
private final SaveToStoragePortIn saveToStoragePortIn;
private final FileUrlPortIn fileUrlPortIn;
@Value("${path.upload.storage}")
private String uploadStorageType;
@PostMapping(path = "/api/front/editorImage/upload")
ResponseEntity<?> editorImageUpload(MultipartFile editorImage) throws IOException {
SaveToStorage saveToStorage =
@@ -27,7 +32,7 @@ public class EditorImageUploadController {
return ResponseEntity.status(HttpStatus.OK)
.body(
fileUrlPortIn.getInline(
saveToStorage.getType().getFileStorageType(),
FileStorageType.valueOf(uploadStorageType),
saveToStorage.getPath(),
saveToStorage.getName()));
}

View File

@@ -1,11 +1,13 @@
package app.module.front.usecase.info.notice.getNotice.adapters.persistence;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import app.module.front.usecase.info.notice.getNotice.ports.GetNoticePortOut;
import app.module.front.usecase.info.notice.getNotice.ports.application.domain.GetNotice;
import app.module.front.usecase.info.notice.getNotice.ports.application.domain.GetNoticeCmd;
import app.module.front.usecase.info.notice.getNotice.ports.application.domain.GetNoticeUploadFile;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -20,6 +22,9 @@ class GetNoticeDao implements GetNoticePortOut {
private final GetNoticeMapper mapper;
private final FileUrlPortIn fileUrlPortIn;
@Value("${path.upload.storage}")
private String uploadStorageType;
@Override
@Transactional
public Optional<GetNotice> operate(GetNoticeCmd command) {
@@ -35,13 +40,13 @@ class GetNoticeDao implements GetNoticePortOut {
// 참조 URL 전달
uploadFile.setReferURL(
fileUrlPortIn.getInline(
uploadFile.getType().getFileStorageType(),
FileStorageType.valueOf(uploadStorageType),
uploadFile.getPath(),
uploadFile.getName()));
// attachment URL 전달
uploadFile.setAttachmentURL(
fileUrlPortIn.getAttachment(
uploadFile.getType().getFileStorageType(), uploadFile.getId()));
FileStorageType.valueOf(uploadStorageType), uploadFile.getId()));
return uploadFile;
})