From 756b1cc561a119922b077bfbbacae321c762e783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Mon, 15 Apr 2024 19:30:53 +0900 Subject: [PATCH] add :: response --- .../feed/domain/screen/presentation/ScreenController.kt | 3 ++- .../screen/presentation/dto/response/ScreenResponse.kt | 5 +++++ .../equus/feed/domain/screen/service/CreateScreenService.kt | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/dto/response/ScreenResponse.kt diff --git a/src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/ScreenController.kt b/src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/ScreenController.kt index 302dae3..06f80fe 100644 --- a/src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/ScreenController.kt +++ b/src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/ScreenController.kt @@ -1,5 +1,6 @@ package hs.kr.equus.feed.domain.screen.presentation +import hs.kr.equus.feed.domain.screen.presentation.dto.response.ScreenResponse import hs.kr.equus.feed.domain.screen.service.CreateScreenService import org.springframework.http.HttpStatus import org.springframework.web.bind.annotation.PostMapping @@ -19,6 +20,6 @@ class ScreenController( @PostMapping fun createScreen( @RequestPart(name = "image") image: MultipartFile - ): String = + ): ScreenResponse = createScreenService.execute(image) } diff --git a/src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/dto/response/ScreenResponse.kt b/src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/dto/response/ScreenResponse.kt new file mode 100644 index 0000000..460dffd --- /dev/null +++ b/src/main/kotlin/hs/kr/equus/feed/domain/screen/presentation/dto/response/ScreenResponse.kt @@ -0,0 +1,5 @@ +package hs.kr.equus.feed.domain.screen.presentation.dto.response + +data class ScreenResponse ( + val image: String +) diff --git a/src/main/kotlin/hs/kr/equus/feed/domain/screen/service/CreateScreenService.kt b/src/main/kotlin/hs/kr/equus/feed/domain/screen/service/CreateScreenService.kt index c59f97b..4b3bb5e 100644 --- a/src/main/kotlin/hs/kr/equus/feed/domain/screen/service/CreateScreenService.kt +++ b/src/main/kotlin/hs/kr/equus/feed/domain/screen/service/CreateScreenService.kt @@ -2,6 +2,7 @@ package hs.kr.equus.feed.domain.screen.service import hs.kr.equus.feed.domain.screen.domain.Screen import hs.kr.equus.feed.domain.screen.domain.repository.ScreenRepository +import hs.kr.equus.feed.domain.screen.presentation.dto.response.ScreenResponse import hs.kr.equus.feed.global.utils.user.UserUtils import hs.kr.equus.feed.infrastructure.s3.PathList import hs.kr.equus.feed.infrastructure.s3.util.FileUtil @@ -17,7 +18,7 @@ class CreateScreenService( ) { @Transactional - fun execute(file: MultipartFile): String { + fun execute(file: MultipartFile): ScreenResponse { val adminId = userUtils.getCurrentUser().id val fileName = fileUtil.upload(file, PathList.NOTICE) @@ -27,6 +28,6 @@ class CreateScreenService( adminId = adminId ) ) - return fileName + return ScreenResponse(fileName) } }