fix(chat-room): 채팅방
- 쿼터 상태 조회, 쿼터 구매 API URL 변경
This commit is contained in:
@@ -51,12 +51,12 @@ class ChatRoomRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 쿼터 상태 조회 */
|
/** 쿼터 상태 조회 */
|
||||||
func getChatQuotaStatus() -> AnyPublisher<Response, MoyaError> {
|
func getChatQuotaStatus(roomId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||||
return talkApi.requestPublisher(.getChatQuotaStatus)
|
return talkApi.requestPublisher(.getChatQuotaStatus(roomId: roomId))
|
||||||
}
|
}
|
||||||
|
|
||||||
func purchaseChatQuota() -> AnyPublisher<Response, MoyaError> {
|
func purchaseChatQuota(roomId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||||
return talkApi.requestPublisher(.purchaseChatQuota(request: ChatQuotaPurchaseRequest()))
|
return talkApi.requestPublisher(.purchaseChatQuota(roomId: roomId, request: ChatQuotaPurchaseRequest()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetChatRoom(roomId: Int) -> AnyPublisher<Response, MoyaError> {
|
func resetChatRoom(roomId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ final class ChatRoomViewModel: ObservableObject {
|
|||||||
func purchaseChatQuota() {
|
func purchaseChatQuota() {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
repository.purchaseChatQuota()
|
repository.purchaseChatQuota(roomId: roomId)
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
@@ -402,7 +402,7 @@ final class ChatRoomViewModel: ObservableObject {
|
|||||||
private func checkQuotaStatus() {
|
private func checkQuotaStatus() {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
repository.getChatQuotaStatus()
|
repository.getChatQuotaStatus(roomId: roomId)
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ enum TalkApi {
|
|||||||
case sendMessage(roomId: Int, request: SendChatMessageRequest)
|
case sendMessage(roomId: Int, request: SendChatMessageRequest)
|
||||||
case getChatRoomMessages(roomId: Int, cursor: Int?, limit: Int)
|
case getChatRoomMessages(roomId: Int, cursor: Int?, limit: Int)
|
||||||
|
|
||||||
case getChatQuotaStatus
|
case getChatQuotaStatus(roomId: Int)
|
||||||
case purchaseChatQuota(request: ChatQuotaPurchaseRequest)
|
case purchaseChatQuota(roomId: Int, request: ChatQuotaPurchaseRequest)
|
||||||
|
|
||||||
case purchaseMessage(roomId: Int, messageId: Int64, request: ChatMessagePurchaseRequest)
|
case purchaseMessage(roomId: Int, messageId: Int64, request: ChatMessagePurchaseRequest)
|
||||||
case resetChatRoom(roomId: Int, request: ChatRoomResetRequest)
|
case resetChatRoom(roomId: Int, request: ChatRoomResetRequest)
|
||||||
@@ -42,11 +42,11 @@ extension TalkApi: TargetType {
|
|||||||
case .getChatRoomMessages(let roomId, _, _):
|
case .getChatRoomMessages(let roomId, _, _):
|
||||||
return "/api/chat/room/\(roomId)/messages"
|
return "/api/chat/room/\(roomId)/messages"
|
||||||
|
|
||||||
case .getChatQuotaStatus:
|
case .getChatQuotaStatus(let roomId):
|
||||||
return "/api/chat/quota/me"
|
return "/api/chat/rooms/\(roomId)/quota/me"
|
||||||
|
|
||||||
case .purchaseChatQuota:
|
case .purchaseChatQuota(let roomId, _):
|
||||||
return "/api/chat/quota/purchase"
|
return "/api/chat/rooms/\(roomId)/quota/purchase"
|
||||||
|
|
||||||
case .purchaseMessage(let roomId, let messageId, _):
|
case .purchaseMessage(let roomId, let messageId, _):
|
||||||
return "/api/chat/room/\(roomId)/messages/\(messageId)/purchase"
|
return "/api/chat/room/\(roomId)/messages/\(messageId)/purchase"
|
||||||
@@ -125,7 +125,7 @@ extension TalkApi: TargetType {
|
|||||||
case .getChatQuotaStatus:
|
case .getChatQuotaStatus:
|
||||||
return .requestPlain
|
return .requestPlain
|
||||||
|
|
||||||
case .purchaseChatQuota(let request):
|
case .purchaseChatQuota(_, let request):
|
||||||
return .requestJSONEncodable(request)
|
return .requestJSONEncodable(request)
|
||||||
|
|
||||||
case .purchaseMessage(_, _, let request):
|
case .purchaseMessage(_, _, let request):
|
||||||
|
|||||||
Reference in New Issue
Block a user