From d85d5aafab185cf6c81de7b412ac2140122f257d Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:32:27 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20(#281)=20application=20response=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/file/usecase/UploadImageUseCase.kt | 10 ++++++--- .../simtong/domain/file/WebFileAdapter.kt | 22 ++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt index c4ec9e7d..d1880d91 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt @@ -1,5 +1,7 @@ package team.comit.simtong.domain.file.usecase +import team.comit.simtong.domain.file.dto.response.UploadImageListResponse +import team.comit.simtong.domain.file.dto.response.UploadImageResponse import team.comit.simtong.domain.file.spi.UploadFilePort import team.comit.simtong.global.annotation.UseCase import java.io.File @@ -10,18 +12,20 @@ import java.io.File * * @author Chokyunghyeon * @date 2022/09/20 - * @version 1.0.0 + * @version 1.2.5 **/ @UseCase class UploadImageUseCase( private val uploadFilePort: UploadFilePort ) { - fun execute(file: File): String { + fun execute(file: File): UploadImageResponse { return uploadFilePort.upload(file) + .let(::UploadImageResponse) } - fun execute(files: List): List { + fun execute(files: List): UploadImageListResponse { return uploadFilePort.upload(files) + .let(::UploadImageListResponse) } } \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt index c7871f60..69708db5 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt @@ -6,10 +6,10 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestController import org.springframework.web.multipart.MultipartFile -import team.comit.simtong.domain.file.dto.response.UploadImageListWebResponse -import team.comit.simtong.domain.file.dto.response.UploadImageWebResponse import team.comit.simtong.domain.file.converter.ExcelFileConverter import team.comit.simtong.domain.file.converter.ImageFileConverter +import team.comit.simtong.domain.file.dto.response.UploadImageListResponse +import team.comit.simtong.domain.file.dto.response.UploadImageResponse import team.comit.simtong.domain.file.usecase.RegisterEmployeeCertificateUseCase import team.comit.simtong.domain.file.usecase.UploadImageUseCase @@ -19,7 +19,7 @@ import team.comit.simtong.domain.file.usecase.UploadImageUseCase * * @author Chokyunghyeon * @date 2022/09/21 - * @version 1.0.0 + * @version 1.2.5 **/ @RestController @RequestMapping("/files") @@ -30,21 +30,17 @@ class WebFileAdapter( @PostMapping @ResponseStatus(HttpStatus.CREATED) - fun uploadSingleImage(file: MultipartFile): UploadImageWebResponse { - return UploadImageWebResponse( - uploadImageUseCase.execute( - file.let(ImageFileConverter::transferTo) - ) + fun uploadSingleImage(file: MultipartFile): UploadImageResponse { + return uploadImageUseCase.execute( + file.let(ImageFileConverter::transferTo) ) } @PostMapping("/list") @ResponseStatus(HttpStatus.CREATED) - fun uploadMultipleImage(files: List): UploadImageListWebResponse { - return UploadImageListWebResponse( - uploadImageUseCase.execute( - files.let(ImageFileConverter::transferToList) - ) + fun uploadMultipleImage(files: List): UploadImageListResponse { + return uploadImageUseCase.execute( + files.let(ImageFileConverter::transferToList) ) }