Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ interface BoardService {
@Path("boardId") boardId: Long,
): Response<GetBoardResponseDTO?>

@GET("api/bookmarks/me")
@GET("api/bookmarks")
suspend fun getLikedBoard(
@Query("page") page: Int,
@Query("size") size: Int = 10,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package com.catchmate.data.datasource.remote

import com.catchmate.data.dto.chatting.ChatRoomInfoDTO
import com.catchmate.data.dto.chatting.DeleteChattingCrewKickOutResponseDTO
import com.catchmate.data.dto.chatting.DeleteChattingRoomResponseDTO
import com.catchmate.data.dto.chatting.GetChattingCrewListResponseDTO
import com.catchmate.data.dto.chatting.GetChattingHistoryResponseDTO
import com.catchmate.data.dto.chatting.GetChattingMessagesResponseDTO
import com.catchmate.data.dto.chatting.GetChattingRoomListResponseDTO
import com.catchmate.data.dto.chatting.PatchChattingRoomImageResponseDTO
import com.catchmate.data.dto.chatting.PutChattingRoomAlarmResponseDTO
import com.catchmate.data.dto.chatting.PutChattingRoomAlarmRequestDTO
import okhttp3.MultipartBody
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Multipart
Expand All @@ -26,44 +23,39 @@ interface ChattingService {
@Query("size") size: Int,
): Response<GetChattingRoomListResponseDTO?>

@GET("chat-rooms/{chatRoomId}/user-list")
@GET("api/chat/rooms/{chatRoomId}/members")
suspend fun getChattingCrewList(
@Path("chatRoomId") chatRoomId: Long,
): Response<GetChattingCrewListResponseDTO?>

@GET("chat-rooms/{chatRoomId}")
suspend fun getChattingRoomInfo(
@Path("chatRoomId") chatRoomId: Long,
): Response<ChatRoomInfoDTO?>
): Response<List<GetChattingCrewListResponseDTO>?>

@Multipart
@PATCH("chat-rooms/{chatRoomId}/image")
@PATCH("api/chat/rooms/{roomId}/image")
suspend fun patchChattingRoomImage(
@Path("chatRoomId") chatRoomId: Long,
@Path("roomId") roomId: Long,
@Part chatRoomImage: MultipartBody.Part,
): Response<PatchChattingRoomImageResponseDTO?>
): Response<Unit>

@PUT("chat-rooms/{chatRoomId}/notification")
@PUT("api/chat/rooms/{roomId}/notifications")
suspend fun putChattingRoomAlarm(
@Path("chatRoomId") chatRoomId: Long,
@Query("enable") enable: Boolean,
): Response<PutChattingRoomAlarmResponseDTO?>
@Path("roomId") roomId: Long,
@Body putChattingRoomAlarmRequestDTO: PutChattingRoomAlarmRequestDTO,
): Response<Unit?>

@DELETE("chat-rooms/{chatRoomId}")
@DELETE("api/chat/rooms/{roomId}")
suspend fun deleteChattingRoom(
@Path("chatRoomId") chatRoomId: Long,
): Response<DeleteChattingRoomResponseDTO?>

@DELETE("chat-rooms/{chatRoomId}/users/{userId}")
suspend fun deleteChattingCrewKickOut(
@Path("chatRoomId") chatRoomId: Long,
@Path("userId") userId: Long,
): Response<DeleteChattingCrewKickOutResponseDTO?>

@GET("chats/{chatRoomId}")
suspend fun getChattingHistory(
@Path("chatRoomId") chatRoomId: Long,
@Query("lastMessageId") lastMessageId: String?,
@Query("size") size: Int?, // default = 20
): Response<GetChattingHistoryResponseDTO?>
@Path("roomId") roomId: Long,
): Response<Unit>

@DELETE("api/chat/rooms/{roomId}/members/{targetUserId}")
suspend fun deleteChattingCrew(
@Path("roomId") roomId: Long,
@Path("targetUserId") targetUserId: Long,
): Response<Unit>

@GET("api/chat/rooms/{roomId}/messages")
suspend fun getChattingMessages(
@Path("roomId") roomId: Long,
@Query("lastMessageId") lastMessageId: Long?,
@Query("size") size: Int, // default = 20
): Response<List<GetChattingMessagesResponseDTO>?>
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data class GetBoardResponseDTO(
val liftUpDate: String,
val bookMarked: Boolean,
val buttonStatus: String,
val myEnrollId: Long,
val myEnrollId: Long?,
val chatRoomId: Long,
val cheerClub: ClubDTO,
val game: GameInfoDTO,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ data class ChatRoomInfoDTO(
val chatRoomId: Long,
val board: BoardDTO,
val lastMessage: LastMessageInfoDto?,
val unreadCount: Long,
val chatRoomImageUrl: String?,
val createdAt: String,
val notificationOn: Boolean,
)

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.catchmate.data.dto.chatting

import com.catchmate.data.dto.user.GetUserProfileResponseDTO

data class GetChattingCrewListResponseDTO(
val userInfoList: List<GetUserProfileResponseDTO>,
val memberId: Long,
val userId: Long,
val nickName: String,
val profileImageUrl: String,
val joinedAt: String,
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.catchmate.data.dto.chatting

data class GetChattingMessagesResponseDTO(
val messageId: Long,
val chatRoomId: Long,
val senderId: Long,
val senderNickName: String,
val senderProfileImageUrl: String,
val content: String,
val messageType: String,
val createdAt: String,
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.catchmate.data.dto.chatting

data class PutChattingRoomAlarmRequestDTO(
val on: Boolean,
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
package com.catchmate.data.mapper

import com.catchmate.data.dto.chatting.ChatMessageIdDTO
import com.catchmate.data.dto.chatting.ChatMessageInfoDTO
import com.catchmate.data.dto.chatting.ChatRoomInfoDTO
import com.catchmate.data.dto.chatting.DeleteChattingCrewKickOutResponseDTO
import com.catchmate.data.dto.chatting.DeleteChattingRoomResponseDTO
import com.catchmate.data.dto.chatting.GetChattingCrewListResponseDTO
import com.catchmate.data.dto.chatting.GetChattingHistoryResponseDTO
import com.catchmate.data.dto.chatting.GetChattingMessagesResponseDTO
import com.catchmate.data.dto.chatting.GetChattingRoomListResponseDTO
import com.catchmate.data.dto.chatting.LastMessageInfoDto
import com.catchmate.data.dto.chatting.PatchChattingRoomImageResponseDTO
import com.catchmate.data.dto.chatting.PutChattingRoomAlarmResponseDTO
import com.catchmate.data.dto.chatting.PutChattingRoomAlarmRequestDTO
import com.catchmate.data.mapper.BoardMapper.toBoard
import com.catchmate.data.mapper.UserMapper.toGetUserProfileResponse
import com.catchmate.domain.model.chatting.ChatMessageId
import com.catchmate.domain.model.chatting.ChatMessageInfo
import com.catchmate.domain.model.chatting.ChatRoomInfo
import com.catchmate.domain.model.chatting.DeleteChattingCrewKickOutResponse
import com.catchmate.domain.model.chatting.DeleteChattingRoomResponse
import com.catchmate.domain.model.chatting.GetChattingCrewListResponse
import com.catchmate.domain.model.chatting.GetChattingHistoryResponse
import com.catchmate.domain.model.chatting.GetChattingMessagesResponse
import com.catchmate.domain.model.chatting.GetChattingRoomListResponse
import com.catchmate.domain.model.chatting.LastMessageInfo
import com.catchmate.domain.model.chatting.PatchChattingRoomImageResponse
import com.catchmate.domain.model.chatting.PutChattingRoomAlarmResponse
import com.catchmate.domain.model.chatting.PutChattingRoomAlarmRequest

object ChattingMapper {
fun toGetChattingRoomListResponse(dto: GetChattingRoomListResponseDTO): GetChattingRoomListResponse =
Expand All @@ -40,7 +29,10 @@ object ChattingMapper {
chatRoomId = dto.chatRoomId,
board = toBoard(dto.board),
lastMessage = toLastMessageInfo(dto.lastMessage),
unreadCount = dto.unreadCount,
chatRoomImageUrl = dto.chatRoomImageUrl,
createdAt = dto.createdAt,
notificationOn = dto.notificationOn,
)

private fun toLastMessageInfo(dto: LastMessageInfoDto?): LastMessageInfo? =
Expand All @@ -57,52 +49,29 @@ object ChattingMapper {
)
}

fun toGetChattingHistoryResponse(dto: GetChattingHistoryResponseDTO): GetChattingHistoryResponse =
GetChattingHistoryResponse(
chatMessageInfoList = dto.chatMessageInfoList.map { toChatMessageInfo(it) },
isFirst = dto.isFirst,
isLast = dto.isLast,
lastMessageId = dto.lastMessageId,
)

private fun toChatMessageInfo(dto: ChatMessageInfoDTO): ChatMessageInfo =
ChatMessageInfo(
id = toChatMessageId(dto.id),
chatMessageId = dto.chatMessageId,
roomId = dto.roomId,
content = dto.content,
fun toGetChattingHistoryResponse(dto: GetChattingMessagesResponseDTO): GetChattingMessagesResponse =
GetChattingMessagesResponse(
messageId = dto.messageId,
chatRoomId = dto.chatRoomId,
senderId = dto.senderId,
senderNickName = dto.senderNickName,
senderProfileImageUrl = dto.senderProfileImageUrl,
content = dto.content,
messageType = dto.messageType,
)

private fun toChatMessageId(dto: ChatMessageIdDTO): ChatMessageId =
ChatMessageId(
timestamp = dto.timestamp,
date = dto.date,
createdAt = dto.createdAt,
)

fun toGetChattingCrewListResponse(dto: GetChattingCrewListResponseDTO): GetChattingCrewListResponse =
GetChattingCrewListResponse(
userInfoList = dto.userInfoList.map { toGetUserProfileResponse(it) },
)

fun toDeleteChattingRoomResponse(dto: DeleteChattingRoomResponseDTO): DeleteChattingRoomResponse =
DeleteChattingRoomResponse(
state = dto.state,
)

fun toDeleteChattingCrewKickOutResponse(dto: DeleteChattingCrewKickOutResponseDTO): DeleteChattingCrewKickOutResponse =
DeleteChattingCrewKickOutResponse(
state = dto.state,
)

fun toPatchChattingRoomImageResponse(dto: PatchChattingRoomImageResponseDTO): PatchChattingRoomImageResponse =
PatchChattingRoomImageResponse(
state = dto.state,
memberId = dto.memberId,
userId = dto.userId,
nickName = dto.nickName,
profileImageUrl = dto.profileImageUrl,
joinedAt = dto.joinedAt,
)

fun toPutChattingRoomAlarmResponse(dto: PutChattingRoomAlarmResponseDTO): PutChattingRoomAlarmResponse =
PutChattingRoomAlarmResponse(
state = dto.state,
fun toPutChattingRoomAlarmRequestDTO(request: PutChattingRoomAlarmRequest): PutChattingRoomAlarmRequestDTO =
PutChattingRoomAlarmRequestDTO(
on = request.on,
)
}
Loading