Merge branch 'susu' into dev
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
package app.module.front.usecase.editor.adapters.web;
|
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.config.application.enums.FileUploadType;
|
||||||
import app.module.core.usecase.file.saveToStorage.ports.SaveToStoragePortIn;
|
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.saveToStorage.ports.application.domain.SaveToStorage;
|
||||||
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
|
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -19,6 +21,9 @@ public class EditorImageUploadController {
|
|||||||
private final SaveToStoragePortIn saveToStoragePortIn;
|
private final SaveToStoragePortIn saveToStoragePortIn;
|
||||||
private final FileUrlPortIn fileUrlPortIn;
|
private final FileUrlPortIn fileUrlPortIn;
|
||||||
|
|
||||||
|
@Value("${path.upload.storage}")
|
||||||
|
private String uploadStorageType;
|
||||||
|
|
||||||
@PostMapping(path = "/api/front/editorImage/upload")
|
@PostMapping(path = "/api/front/editorImage/upload")
|
||||||
ResponseEntity<?> editorImageUpload(MultipartFile editorImage) throws IOException {
|
ResponseEntity<?> editorImageUpload(MultipartFile editorImage) throws IOException {
|
||||||
SaveToStorage saveToStorage =
|
SaveToStorage saveToStorage =
|
||||||
@@ -27,7 +32,7 @@ public class EditorImageUploadController {
|
|||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(
|
.body(
|
||||||
fileUrlPortIn.getInline(
|
fileUrlPortIn.getInline(
|
||||||
saveToStorage.getType().getFileStorageType(),
|
FileStorageType.valueOf(uploadStorageType),
|
||||||
saveToStorage.getPath(),
|
saveToStorage.getPath(),
|
||||||
saveToStorage.getName()));
|
saveToStorage.getName()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package app.module.front.usecase.info.notice.getNotice.adapters.persistence;
|
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.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.GetNoticePortOut;
|
||||||
import app.module.front.usecase.info.notice.getNotice.ports.application.domain.GetNotice;
|
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.GetNoticeCmd;
|
||||||
import app.module.front.usecase.info.notice.getNotice.ports.application.domain.GetNoticeUploadFile;
|
import app.module.front.usecase.info.notice.getNotice.ports.application.domain.GetNoticeUploadFile;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -20,6 +22,9 @@ class GetNoticeDao implements GetNoticePortOut {
|
|||||||
private final GetNoticeMapper mapper;
|
private final GetNoticeMapper mapper;
|
||||||
private final FileUrlPortIn fileUrlPortIn;
|
private final FileUrlPortIn fileUrlPortIn;
|
||||||
|
|
||||||
|
@Value("${path.upload.storage}")
|
||||||
|
private String uploadStorageType;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Optional<GetNotice> operate(GetNoticeCmd command) {
|
public Optional<GetNotice> operate(GetNoticeCmd command) {
|
||||||
@@ -35,13 +40,13 @@ class GetNoticeDao implements GetNoticePortOut {
|
|||||||
// 참조 URL 전달
|
// 참조 URL 전달
|
||||||
uploadFile.setReferURL(
|
uploadFile.setReferURL(
|
||||||
fileUrlPortIn.getInline(
|
fileUrlPortIn.getInline(
|
||||||
uploadFile.getType().getFileStorageType(),
|
FileStorageType.valueOf(uploadStorageType),
|
||||||
uploadFile.getPath(),
|
uploadFile.getPath(),
|
||||||
uploadFile.getName()));
|
uploadFile.getName()));
|
||||||
// attachment URL 전달
|
// attachment URL 전달
|
||||||
uploadFile.setAttachmentURL(
|
uploadFile.setAttachmentURL(
|
||||||
fileUrlPortIn.getAttachment(
|
fileUrlPortIn.getAttachment(
|
||||||
uploadFile.getType().getFileStorageType(), uploadFile.getId()));
|
FileStorageType.valueOf(uploadStorageType), uploadFile.getId()));
|
||||||
|
|
||||||
return uploadFile;
|
return uploadFile;
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user