feat(user-creator-chat): DM 생성 수신자 필드를 일반화한다
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ class UserCreatorChatController(
|
||||
@RequestBody request: CreateUserCreatorChatRoomRequest
|
||||
) = run {
|
||||
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
ApiResponse.ok(service.createOrGetRoom(member, request.creatorId))
|
||||
ApiResponse.ok(service.createOrGetRoom(member, request.recipientMemberId()))
|
||||
}
|
||||
|
||||
@GetMapping("/{roomId}/open")
|
||||
|
||||
+12
-2
@@ -1,8 +1,18 @@
|
||||
package kr.co.vividnext.sodalive.v2.usercreatorchat.dto
|
||||
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
|
||||
data class CreateUserCreatorChatRoomRequest(
|
||||
val creatorId: Long
|
||||
)
|
||||
val recipientId: Long? = null,
|
||||
val creatorId: Long? = null
|
||||
) {
|
||||
fun recipientMemberId(): Long {
|
||||
if (recipientId != null && creatorId != null && recipientId != creatorId) {
|
||||
throw SodaException(messageKey = "common.error.invalid_request")
|
||||
}
|
||||
return recipientId ?: creatorId ?: throw SodaException(messageKey = "common.error.invalid_request")
|
||||
}
|
||||
}
|
||||
|
||||
data class CreateUserCreatorChatRoomResponse(
|
||||
val roomId: Long
|
||||
|
||||
Reference in New Issue
Block a user