Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge: (#281) 파일 & 이메일 & 관리자 dto 리팩토링 #308

Merged
merged 9 commits into from
Jan 18, 2023
Prev Previous commit
Next Next commit
refactor: (#281) application response 적용
  • Loading branch information
khcho0125 committed Jan 14, 2023
commit d85d5aafab185cf6c81de7b412ac2140122f257d
Original file line number Diff line number Diff line change
@@ -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<File>): List<String> {
fun execute(files: List<File>): UploadImageListResponse {
return uploadFilePort.upload(files)
.let(::UploadImageListResponse)
}
}
Original file line number Diff line number Diff line change
@@ -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<MultipartFile>): UploadImageListWebResponse {
return UploadImageListWebResponse(
uploadImageUseCase.execute(
files.let(ImageFileConverter::transferToList)
)
fun uploadMultipleImage(files: List<MultipartFile>): UploadImageListResponse {
return uploadImageUseCase.execute(
files.let(ImageFileConverter::transferToList)
)
}