리드미 수정

This commit is contained in:
주수현
2025-07-30 10:44:54 +09:00
parent 6a167795c3
commit 6d208e0e74
4 changed files with 10 additions and 51 deletions

View File

@@ -1,40 +0,0 @@
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 lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@Controller
@RequiredArgsConstructor
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 =
saveToStoragePortIn.operate(FileUploadType.EDITOR_IMAGE, editorImage).orElseThrow();
return ResponseEntity.status(HttpStatus.OK)
.body(
fileUrlPortIn.getInline(
FileStorageType.valueOf(uploadStorageType),
saveToStorage.getPath(),
saveToStorage.getName()));
}
}