From 02cb33ea7a8a5884317784a9b652a03376b3d503 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:16:22 +0900 Subject: [PATCH 01/14] =?UTF-8?q?:memo:=20CommandNotificationPersistenceAd?= =?UTF-8?q?apter=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommandNotificationPersistenceAdapter.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/CommandNotificationPersistenceAdapter.kt diff --git a/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/CommandNotificationPersistenceAdapter.kt b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/CommandNotificationPersistenceAdapter.kt new file mode 100644 index 00000000..be7157d1 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/CommandNotificationPersistenceAdapter.kt @@ -0,0 +1,18 @@ +package andreas311.miso.domain.notification.adapter.output.persistence + +import andreas311.miso.domain.notification.adapter.output.persistence.mapper.NotificationMapper +import andreas311.miso.domain.notification.adapter.output.persistence.repository.NotificationRepository +import andreas311.miso.domain.notification.application.port.output.CommandNotificationPort +import andreas311.miso.domain.notification.domain.Notification +import org.springframework.stereotype.Component + +@Component +class CommandNotificationPersistenceAdapter( + private val notificationMapper: NotificationMapper, + private val notificationRepository: NotificationRepository +) : CommandNotificationPort { + override fun saveNotification(notification: Notification): Notification { + val notificationEntity = notificationRepository.save(notificationMapper.toEntity(notification)) + return notificationMapper.toDomain(notificationEntity)!! + } +} \ No newline at end of file From ac1c1e8bff4294dd8df0a031407e7ac495ea12e5 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:16:30 +0900 Subject: [PATCH 02/14] =?UTF-8?q?:memo:=20CommandNotificationPort=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/port/output/CommandNotificationPort.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/notification/application/port/output/CommandNotificationPort.kt diff --git a/src/main/kotlin/andreas311/miso/domain/notification/application/port/output/CommandNotificationPort.kt b/src/main/kotlin/andreas311/miso/domain/notification/application/port/output/CommandNotificationPort.kt new file mode 100644 index 00000000..d3a107f8 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/notification/application/port/output/CommandNotificationPort.kt @@ -0,0 +1,7 @@ +package andreas311.miso.domain.notification.application.port.output + +import andreas311.miso.domain.notification.domain.Notification + +interface CommandNotificationPort { + fun saveNotification(notification: Notification): Notification +} \ No newline at end of file From adb5e52b1397e24edd156c8247d171dea1435cfe Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:16:40 +0900 Subject: [PATCH 03/14] =?UTF-8?q?:memo:=20Notification=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/notification/domain/Notification.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/notification/domain/Notification.kt diff --git a/src/main/kotlin/andreas311/miso/domain/notification/domain/Notification.kt b/src/main/kotlin/andreas311/miso/domain/notification/domain/Notification.kt new file mode 100644 index 00000000..5dedbd75 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/notification/domain/Notification.kt @@ -0,0 +1,11 @@ +package andreas311.miso.domain.notification.domain + +import andreas311.miso.domain.inquiry.domain.Inquiry +import andreas311.miso.domain.user.domain.User + +data class Notification( + val id: Long, + val answer: String, + val inquiry: Inquiry, + val user: User +) From 65ac2ce87c87e00748b7ee52a0d25850c4787df1 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:17:00 +0900 Subject: [PATCH 04/14] =?UTF-8?q?:memo:=20NotificationEntity=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/entity/NotificationEntity.kt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/entity/NotificationEntity.kt diff --git a/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/entity/NotificationEntity.kt b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/entity/NotificationEntity.kt new file mode 100644 index 00000000..5d15c6f0 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/entity/NotificationEntity.kt @@ -0,0 +1,25 @@ +package andreas311.miso.domain.notification.adapter.output.persistence.entity + +import andreas311.miso.domain.inquiry.adapter.output.persistence.entity.InquiryEntity +import andreas311.miso.domain.user.adapter.output.persistence.entity.UserEntity +import javax.persistence.* + +@Entity +@Table(name = "notification") +data class NotificationEntity( + @Id + @Column(name = "notification_id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @Column(name = "answer", nullable = false) + val answer: String, + + @ManyToOne + @JoinColumn(name = "inquiry_id") + val inquiry: InquiryEntity, + + @ManyToOne + @JoinColumn(name = "user_id") + val user: UserEntity +) From d4d54e7fdcd0c4e8904c6c3d3563f0456b7f9eda Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:17:08 +0900 Subject: [PATCH 05/14] =?UTF-8?q?:memo:=20NotificationMapper=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/mapper/NotificationMapper.kt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/mapper/NotificationMapper.kt diff --git a/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/mapper/NotificationMapper.kt b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/mapper/NotificationMapper.kt new file mode 100644 index 00000000..ea1039e5 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/mapper/NotificationMapper.kt @@ -0,0 +1,31 @@ +package andreas311.miso.domain.notification.adapter.output.persistence.mapper + +import andreas311.miso.domain.inquiry.adapter.output.persistence.mapper.InquiryMapper +import andreas311.miso.domain.notification.adapter.output.persistence.entity.NotificationEntity +import andreas311.miso.domain.notification.domain.Notification +import andreas311.miso.domain.user.adapter.output.persistence.mapper.UserMapper +import org.springframework.stereotype.Component + +@Component +class NotificationMapper( + private val userMapper: UserMapper, + private val inquiryMapper: InquiryMapper +) { + infix fun toEntity(domain: Notification): NotificationEntity = + NotificationEntity( + id = domain.id, + answer = domain.answer, + user = userMapper.toEntity(domain.user), + inquiry = inquiryMapper.toEntity(domain.inquiry) + ) + + infix fun toDomain(entity: NotificationEntity?): Notification? = + entity?.let { + Notification( + id = entity.id, + answer = entity.answer, + user = userMapper.toDomain(entity.user)!!, + inquiry = inquiryMapper.toDomain(entity.inquiry)!! + ) + } +} \ No newline at end of file From d44b7ce3804dbe0603d7bb12a4133b86cfdc605d Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:17:22 +0900 Subject: [PATCH 06/14] =?UTF-8?q?:memo:=20NotificationRepository=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../output/persistence/repository/NotificationRepository.kt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/repository/NotificationRepository.kt diff --git a/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/repository/NotificationRepository.kt b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/repository/NotificationRepository.kt new file mode 100644 index 00000000..4c27f2a0 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/notification/adapter/output/persistence/repository/NotificationRepository.kt @@ -0,0 +1,6 @@ +package andreas311.miso.domain.notification.adapter.output.persistence.repository + +import andreas311.miso.domain.notification.adapter.output.persistence.entity.NotificationEntity +import org.springframework.data.repository.CrudRepository + +interface NotificationRepository : CrudRepository \ No newline at end of file From 8b575ff0472c82bd35b937fe7b7a99563a4b95b5 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:17:44 +0900 Subject: [PATCH 07/14] =?UTF-8?q?:memo:=20WriteInquiryRespondDto=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/port/input/dto/WriteInquiryRespondDto.kt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/dto/WriteInquiryRespondDto.kt diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/dto/WriteInquiryRespondDto.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/dto/WriteInquiryRespondDto.kt new file mode 100644 index 00000000..b1f0378a --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/dto/WriteInquiryRespondDto.kt @@ -0,0 +1,5 @@ +package andreas311.miso.domain.inquiry.application.port.input.dto + +data class WriteInquiryRespondDto( + val answer: String +) From 9a03e4a472baee6b908adb4e8a9ec8dafec03f0d Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:17:55 +0900 Subject: [PATCH 08/14] =?UTF-8?q?:memo:=20WriteInquiryRespondRequest=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../input/data/request/WriteInquiryRespondRequest.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/data/request/WriteInquiryRespondRequest.kt diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/data/request/WriteInquiryRespondRequest.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/data/request/WriteInquiryRespondRequest.kt new file mode 100644 index 00000000..f366fa2d --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/data/request/WriteInquiryRespondRequest.kt @@ -0,0 +1,8 @@ +package andreas311.miso.domain.inquiry.adapter.input.data.request + +import javax.validation.constraints.NotNull + +data class WriteInquiryRespondRequest( + @field:NotNull + val answer: String +) From a85cf5a9ab559b6719cc63505a282a6e95fcc736 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:19:42 +0900 Subject: [PATCH 09/14] =?UTF-8?q?:memo:=20InquiryDataMapper=20=EC=97=90=20?= =?UTF-8?q?toDto=20=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inquiry/adapter/input/mapper/InquiryDataMapper.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/mapper/InquiryDataMapper.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/mapper/InquiryDataMapper.kt index ee15eac2..cbda276b 100644 --- a/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/mapper/InquiryDataMapper.kt +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/mapper/InquiryDataMapper.kt @@ -1,12 +1,14 @@ package andreas311.miso.domain.inquiry.adapter.input.mapper import andreas311.miso.domain.inquiry.adapter.input.data.request.WriteInquiryRequest +import andreas311.miso.domain.inquiry.adapter.input.data.request.WriteInquiryRespondRequest import andreas311.miso.domain.inquiry.adapter.input.data.response.DetailInquiryResponse import andreas311.miso.domain.inquiry.adapter.input.data.response.InquiryResponse import andreas311.miso.domain.inquiry.adapter.input.data.response.ListInquiryResponse import andreas311.miso.domain.inquiry.application.port.input.dto.DetailInquiryDto import andreas311.miso.domain.inquiry.application.port.input.dto.ListInquiryDto import andreas311.miso.domain.inquiry.application.port.input.dto.WriteInquiryDto +import andreas311.miso.domain.inquiry.application.port.input.dto.WriteInquiryRespondDto import org.springframework.stereotype.Component @Component @@ -17,6 +19,11 @@ class InquiryDataMapper { content = writeInquiryRequest.content ) + infix fun toDto(writeInquiryRespondRequest: WriteInquiryRespondRequest): WriteInquiryRespondDto = + WriteInquiryRespondDto( + answer = writeInquiryRespondRequest.answer + ) + fun toResponse(detailInquiryDto: DetailInquiryDto): DetailInquiryResponse = DetailInquiryResponse( id = detailInquiryDto.id, From 7875bd804f5e1f6b47b44cea349a943468b9dac6 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:20:04 +0900 Subject: [PATCH 10/14] =?UTF-8?q?:memo:=20Inquiry=20=EC=97=90=20updateInqu?= =?UTF-8?q?iryStatus=20=ED=95=A8=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/andreas311/miso/domain/inquiry/domain/Inquiry.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/domain/Inquiry.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/domain/Inquiry.kt index b2f8c57b..dd5e963e 100644 --- a/src/main/kotlin/andreas311/miso/domain/inquiry/domain/Inquiry.kt +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/domain/Inquiry.kt @@ -12,7 +12,8 @@ data class Inquiry( val user: User, val createdDate: LocalDateTime ) { - fun updateInquiryStatus(inquiryStatus: InquiryStatus) { + fun updateInquiryStatus(inquiryStatus: InquiryStatus): Inquiry { this.inquiryStatus = inquiryStatus + return this } } \ No newline at end of file From 4ebfe4e090d14f16be5cb46c25e6cd01e57f20ea Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:20:20 +0900 Subject: [PATCH 11/14] =?UTF-8?q?:memo:=20FcmNotificationPort=20=EC=A4=84?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/application/port/output/FcmNotificationPort.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/kotlin/andreas311/miso/domain/notification/application/port/output/FcmNotificationPort.kt b/src/main/kotlin/andreas311/miso/domain/notification/application/port/output/FcmNotificationPort.kt index 34cd686a..77de8184 100644 --- a/src/main/kotlin/andreas311/miso/domain/notification/application/port/output/FcmNotificationPort.kt +++ b/src/main/kotlin/andreas311/miso/domain/notification/application/port/output/FcmNotificationPort.kt @@ -4,6 +4,5 @@ import andreas311.miso.domain.notification.domain.NotificationAlarm interface FcmNotificationPort { fun sendInquiryNotification(deviceToken: String, notificationAlarm: NotificationAlarm) - fun sendEnvironmentNotification(deviceTokens: List, notificationAlarm: NotificationAlarm) } \ No newline at end of file From 96c0df52c2c59109c6dede9203a7d315e216f634 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:20:50 +0900 Subject: [PATCH 12/14] =?UTF-8?q?:memo:=20DiscordMessageSendPort=20?= =?UTF-8?q?=EC=A4=84=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inquiry/application/port/output/DiscordMessageSendPort.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/output/DiscordMessageSendPort.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/output/DiscordMessageSendPort.kt index e1ac9934..e0da6cd9 100644 --- a/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/output/DiscordMessageSendPort.kt +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/output/DiscordMessageSendPort.kt @@ -2,8 +2,6 @@ package andreas311.miso.domain.inquiry.application.port.output interface DiscordMessageSendPort { fun sendDiscordMessage(message: String) - fun toSingleDiscordMessage(string: String): String - fun createInquiryMessage(inquiryName: String): String } \ No newline at end of file From 59ee961ea5c3a77af30448eeab2ff63316edf8fa Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:21:33 +0900 Subject: [PATCH 13/14] =?UTF-8?q?:sparkles:=20=EB=AC=B8=EC=9D=98=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B8=80=20=EB=8B=B5=EB=B3=80=ED=95=98=EA=B8=B0=20?= =?UTF-8?q?api=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../port/input/WriteInquiryRespondUseCase.kt | 7 ++++ .../service/WriteInquiryRespondService.kt | 38 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/WriteInquiryRespondUseCase.kt create mode 100644 src/main/kotlin/andreas311/miso/domain/inquiry/application/service/WriteInquiryRespondService.kt diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/WriteInquiryRespondUseCase.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/WriteInquiryRespondUseCase.kt new file mode 100644 index 00000000..54865c63 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/application/port/input/WriteInquiryRespondUseCase.kt @@ -0,0 +1,7 @@ +package andreas311.miso.domain.inquiry.application.port.input + +import andreas311.miso.domain.inquiry.application.port.input.dto.WriteInquiryRespondDto + +interface WriteInquiryRespondUseCase { + fun execute(id: Long, writeInquiryRespondDto: WriteInquiryRespondDto) +} \ No newline at end of file diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/application/service/WriteInquiryRespondService.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/application/service/WriteInquiryRespondService.kt new file mode 100644 index 00000000..80e87a83 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/application/service/WriteInquiryRespondService.kt @@ -0,0 +1,38 @@ +package andreas311.miso.domain.inquiry.application.service + +import andreas311.miso.common.annotation.RollbackService +import andreas311.miso.domain.auth.application.port.output.UserSecurityPort +import andreas311.miso.domain.inquiry.application.exception.InquiryNotFoundException +import andreas311.miso.domain.inquiry.application.port.input.WriteInquiryRespondUseCase +import andreas311.miso.domain.inquiry.application.port.input.dto.WriteInquiryRespondDto +import andreas311.miso.domain.inquiry.application.port.output.CommandInquiryPort +import andreas311.miso.domain.inquiry.application.port.output.QueryInquiryPort +import andreas311.miso.domain.inquiry.domain.InquiryStatus +import andreas311.miso.domain.notification.application.port.output.CommandNotificationPort +import andreas311.miso.domain.notification.domain.Notification + +@RollbackService +class WriteInquiryRespondService( + private val userSecurityPort: UserSecurityPort, + private val queryInquiryPort: QueryInquiryPort, + private val commandInquiryPort: CommandInquiryPort, + private val commandNotificationPort: CommandNotificationPort +) : WriteInquiryRespondUseCase { + override fun execute(id: Long, writeInquiryRespondDto: WriteInquiryRespondDto) { + val user = userSecurityPort.currentUser() + + val inquiry = queryInquiryPort.findByIdOrNull(id) + ?: throw InquiryNotFoundException() + + commandInquiryPort.saveInquiry(inquiry.updateInquiryStatus(InquiryStatus.COMPLETE)) + + commandNotificationPort.saveNotification( + Notification( + id = 0L, + answer = writeInquiryRespondDto.answer, + user = user, + inquiry = inquiry + ) + ) + } +} \ No newline at end of file From ddc663e1a9886ce5623c830980097e821a8cf802 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Wed, 27 Mar 2024 20:21:51 +0900 Subject: [PATCH 14/14] =?UTF-8?q?:sparkles:=20InquiryAdapter=20=EC=97=90?= =?UTF-8?q?=20=EB=AC=B8=EC=9D=98=EC=82=AC=ED=95=AD=20=EA=B8=80=20=EB=8B=B5?= =?UTF-8?q?=EB=B3=80=ED=95=98=EA=B8=B0=20api=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inquiry/adapter/input/InquiryAdapter.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/InquiryAdapter.kt b/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/InquiryAdapter.kt index 9a7454e1..0bbdd1d9 100644 --- a/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/InquiryAdapter.kt +++ b/src/main/kotlin/andreas311/miso/domain/inquiry/adapter/input/InquiryAdapter.kt @@ -2,20 +2,15 @@ package andreas311.miso.domain.inquiry.adapter.input import andreas311.miso.common.annotation.RequestController import andreas311.miso.domain.inquiry.adapter.input.data.request.WriteInquiryRequest +import andreas311.miso.domain.inquiry.adapter.input.data.request.WriteInquiryRespondRequest import andreas311.miso.domain.inquiry.adapter.input.data.response.DetailInquiryResponse import andreas311.miso.domain.inquiry.adapter.input.data.response.ListInquiryResponse import andreas311.miso.domain.inquiry.adapter.input.mapper.InquiryDataMapper -import andreas311.miso.domain.inquiry.application.port.input.DetailInquiryUseCase -import andreas311.miso.domain.inquiry.application.port.input.ListFilterInquiryUseCase -import andreas311.miso.domain.inquiry.application.port.input.ListInquiryUseCase -import andreas311.miso.domain.inquiry.application.port.input.WriteInquiryUseCase +import andreas311.miso.domain.inquiry.application.port.input.* import andreas311.miso.domain.inquiry.domain.InquiryStatus import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.* import org.springframework.web.multipart.MultipartFile import javax.validation.Valid @@ -25,7 +20,8 @@ class InquiryAdapter( private val listInquiryUseCase: ListInquiryUseCase, private val writeInquiryUseCase: WriteInquiryUseCase, private val detailInquiryUseCase: DetailInquiryUseCase, - private val listFilterInquiryUseCase: ListFilterInquiryUseCase + private val listFilterInquiryUseCase: ListFilterInquiryUseCase, + private val writeInquiryRespondUseCase: WriteInquiryRespondUseCase ) { @PostMapping fun write( @@ -52,4 +48,9 @@ class InquiryAdapter( detailInquiryUseCase.execute(id) .let { inquiryDataMapper.toResponse(it) } .let { ResponseEntity.status(HttpStatus.OK).body(it) } + + @PatchMapping("/respond/{id}") + fun respond(@PathVariable id: Long, @RequestBody @Valid writeInquiryRespondRequest: WriteInquiryRespondRequest): ResponseEntity = + writeInquiryRespondUseCase.execute(id, inquiryDataMapper toDto writeInquiryRespondRequest) + .let { ResponseEntity.status(HttpStatus.OK).build() } } \ No newline at end of file