Skip to content

Commit

Permalink
add :: response
Browse files Browse the repository at this point in the history
  • Loading branch information
rudeh2926 committed Apr 15, 2024
1 parent 69c236b commit 756b1cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,6 +20,6 @@ class ScreenController(
@PostMapping
fun createScreen(
@RequestPart(name = "image") image: MultipartFile
): String =
): ScreenResponse =
createScreenService.execute(image)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package hs.kr.equus.feed.domain.screen.presentation.dto.response

data class ScreenResponse (
val image: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -27,6 +28,6 @@ class CreateScreenService(
adminId = adminId
)
)
return fileName
return ScreenResponse(fileName)
}
}

0 comments on commit 756b1cc

Please sign in to comment.