Skip to content

Commit

Permalink
✨ InquiryAdapter 구현 및 문의사항 글 작성하기 api 관련 함수 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
uuuuuuuk committed Mar 25, 2024
1 parent b59b020 commit 38b6045
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package andreas311.miso.domain.inquiry.adapter.input

import andreas311.miso.common.annotation.RequestController
import andreas311.miso.domain.inquiry.adapter.input.data.WriteInquiryRequest
import andreas311.miso.domain.inquiry.adapter.input.mapper.InquiryDataMapper
import andreas311.miso.domain.inquiry.application.port.input.WriteInquiryUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestPart
import org.springframework.web.multipart.MultipartFile
import javax.validation.Valid

@RequestController("/inquiry")
class InquiryAdapter(
private val inquiryDataMapper: InquiryDataMapper,
private val writeInquiryUseCase: WriteInquiryUseCase
) {
@PostMapping
fun write(
@RequestPart(value = "file") multipartFile: MultipartFile?,
@RequestPart(value = "inquiry") @Valid writeInquiryRequest: WriteInquiryRequest
): ResponseEntity<Void> =
writeInquiryUseCase.execute(inquiryDataMapper toDto writeInquiryRequest, multipartFile)
.let { ResponseEntity.status(HttpStatus.CREATED).build() }
}

0 comments on commit 38b6045

Please sign in to comment.