리드미 수정
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user