diff --git a/CatchMate/app/build.gradle.kts b/CatchMate/app/build.gradle.kts index 1654883f..e701259a 100644 --- a/CatchMate/app/build.gradle.kts +++ b/CatchMate/app/build.gradle.kts @@ -38,6 +38,16 @@ android { excludes.add("META-INF/DEPENDENCIES") } } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules-release.pro", + ) + } + } } dependencies { diff --git a/CatchMate/build-logic/src/main/kotlin/com/catchmate/app/KotlinAndroid.kt b/CatchMate/build-logic/src/main/kotlin/com/catchmate/app/KotlinAndroid.kt index ecce1c94..b6da0e0d 100644 --- a/CatchMate/build-logic/src/main/kotlin/com/catchmate/app/KotlinAndroid.kt +++ b/CatchMate/build-logic/src/main/kotlin/com/catchmate/app/KotlinAndroid.kt @@ -37,7 +37,7 @@ internal fun Project.configureKotlinAndroid() { ) } getByName("release") { - isMinifyEnabled = true + isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules-release.pro", diff --git a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/BoardService.kt b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/BoardService.kt index b35f5c37..43a6974b 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/BoardService.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/BoardService.kt @@ -52,10 +52,11 @@ interface BoardService { @Query("size") size: Int? = null, ): Response - @GET("boards/list/{userId}") + @GET("api/boards/users/{userId}") suspend fun getUserBoardList( @Path("userId") userId: Long, @Query("page") page: Int, + @Query("size") size: Int, ): Response @GET("api/boards/{boardId}") diff --git a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/ChattingService.kt b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/ChattingService.kt index 5a278376..83f143a6 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/ChattingService.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/ChattingService.kt @@ -20,9 +20,10 @@ import retrofit2.http.Path import retrofit2.http.Query interface ChattingService { - @GET("chat-rooms/list") + @GET("api/chat/rooms") suspend fun getChattingRoomList( @Query("page") page: Int, + @Query("size") size: Int, ): Response @GET("chat-rooms/{chatRoomId}/user-list") diff --git a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/EnrollService.kt b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/EnrollService.kt index 7a04954e..1e6267b1 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/EnrollService.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/EnrollService.kt @@ -3,9 +3,9 @@ package com.catchmate.data.datasource.remote import com.catchmate.data.dto.enroll.DeleteEnrollResponseDTO import com.catchmate.data.dto.enroll.GetAllReceivedEnrollResponseDTO import com.catchmate.data.dto.enroll.GetEnrollNewCountResponseDTO +import com.catchmate.data.dto.enroll.GetEnrollResponseDTO import com.catchmate.data.dto.enroll.GetReceivedEnrollResponseDTO import com.catchmate.data.dto.enroll.GetRequestedEnrollListResponseDTO -import com.catchmate.data.dto.enroll.GetRequestedEnrollResponseDTO import com.catchmate.data.dto.enroll.PatchEnrollAcceptResponseDTO import com.catchmate.data.dto.enroll.PatchEnrollRejectResponseDTO import com.catchmate.data.dto.enroll.PostEnrollRequestDTO @@ -20,46 +20,50 @@ import retrofit2.http.Path import retrofit2.http.Query interface EnrollService { - @POST("enrolls/{boardId}") + @POST("api/boards/{boardId}/enrolls") suspend fun postEnroll( @Path("boardId") boardId: Long, @Body postEnrollRequestDTO: PostEnrollRequestDTO, ): Response - @PATCH("enrolls/{enrollId}/reject") + @PATCH("api/enrolls/{enrollId}/reject") suspend fun patchEnrollReject( @Path("enrollId") enrollId: Long, ): Response - @PATCH("enrolls/{enrollId}/accept") + @PATCH("api/enrolls/{enrollId}/accept") suspend fun patchEnrollAccept( @Path("enrollId") enrollId: Long, ): Response - @GET("enrolls/{boardId}/description") - suspend fun getRequestedEnroll( - @Path("boardId") boardId: Long, - ): Response + @GET("api/enrolls/{enrollId}") + suspend fun getEnroll( + @Path("enrollId") enrollId: Long, + ): Response - @GET("enrolls/request") + @GET("api/enrolls/request") suspend fun getRequestedEnrollList( @Query("page") page: Int, + @Query("size") size: Int, ): Response - @GET("enrolls/receive") + @GET("api/enrolls/receive") suspend fun getReceivedEnroll( @Query("boardId") boardId: Long, + @Query("page") page: Int, + @Query("size") size: Int, ): Response - @GET("enrolls/receive/all") + @GET("api/enrolls/receive/all") suspend fun getAllReceivedEnroll( @Query("page") page: Int, + @Query("size") size: Int, ): Response - @GET("enrolls/new-count") + @GET("api/enrolls/count") suspend fun getEnrollNewCount(): Response - @DELETE("enrolls/cancel/{enrollId}") + @DELETE("api/enrolls/{enrollId}") suspend fun deleteEnroll( @Path("enrollId") enrollId: Long, ): Response diff --git a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/NotificationService.kt b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/NotificationService.kt index 24e72fb8..c3ef2000 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/NotificationService.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/NotificationService.kt @@ -1,7 +1,8 @@ package com.catchmate.data.datasource.remote import com.catchmate.data.dto.notification.DeleteReceivedNotificationResponseDTO -import com.catchmate.data.dto.notification.GetReceivedNotificationListResponseDTO +import com.catchmate.data.dto.notification.GetHasUnreadNotificationResponseDto +import com.catchmate.data.dto.notification.GetNotificationListResponseDTO import com.catchmate.data.dto.notification.GetReceivedNotificationResponseDTO import retrofit2.Response import retrofit2.http.DELETE @@ -10,18 +11,22 @@ import retrofit2.http.Path import retrofit2.http.Query interface NotificationService { - @GET("notifications/receive") - suspend fun getReceivedNotificationList( + @GET("api/notifications") + suspend fun getNotificationList( @Query("page") page: Int, - ): Response + @Query("size") size: Int, + ): Response + + @GET("api/notifications/unread") + suspend fun getHasUnreadNotification(): Response @GET("notifications/receive/{notificationId}") suspend fun getReceivedNotification( @Path("notificationId") notificationId: Long, ): Response - @DELETE("notifications/receive/{notificationId}") - suspend fun deleteReceivedNotification( + @DELETE("api/notifications/{notificationId}") + suspend fun deleteNotification( @Path("notificationId") notificationId: Long, - ): Response + ): Response } diff --git a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/SupportService.kt b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/SupportService.kt index 7126398b..18f8b752 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/SupportService.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/SupportService.kt @@ -15,28 +15,28 @@ import retrofit2.http.Path import retrofit2.http.Query interface SupportService { - @GET("inquiries/{inquiryId}") + @GET("api/inquiries/{inquiryId}") suspend fun getInquiry( @Path("inquiryId") inquiryId: Long, ): Response - @POST("inquiries") + @POST("api/inquiries") suspend fun postInquiry( @Body postInquiryRequestDTO: PostInquiryRequestDTO, ): Response - @POST("reports/{reportedUserId}") + @POST("api/reports") suspend fun postUserReport( - @Path("reportedUserId") reportedUserId: Long, @Body postUserReportRequestDTO: PostUserReportRequestDTO, ): Response - @GET("notices/list") + @GET("api/notices") suspend fun getNoticeList( @Query("page") page: Int, + @Query("size") size: Int, ): Response - @GET("notices/{noticeId}") + @GET("api/notices/{noticeId}") suspend fun getNoticeDetail( @Path("noticeId") noticeId: Long, ): Response diff --git a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/UserService.kt b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/UserService.kt index 1daaa1d8..fc0c34d2 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/UserService.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/datasource/remote/UserService.kt @@ -4,7 +4,7 @@ import com.catchmate.data.dto.user.DeleteBlockedUserResponseDTO import com.catchmate.data.dto.user.DeleteUserAccountResponseDTO import com.catchmate.data.dto.user.GetBlockedUserListResponseDTO import com.catchmate.data.dto.user.GetCheckNicknameResponseDTO -import com.catchmate.data.dto.user.GetUnreadInfoResponseDTO +import com.catchmate.data.dto.user.GetUserAlarmResponseDto import com.catchmate.data.dto.user.GetUserProfileByIdResponseDTO import com.catchmate.data.dto.user.GetUserProfileResponseDTO import com.catchmate.data.dto.user.PatchUserAlarmResponseDTO @@ -34,22 +34,23 @@ interface UserService { @GET("api/users/profile") suspend fun getUserProfile(): Response - @GET("users/profile/{profileUserId}") + @GET("api/users/profile/{profileUserId}") suspend fun getUserProfileById( @Path("profileUserId") profileUserId: Long, ): Response - @GET("users/block") + @GET("api/users/blocks") suspend fun getBlockedUserList( @Query("page") page: Int, + @Query("size") size: Int, ): Response - @GET("users/has-unread") - suspend fun getUnreadInfo(): Response + @GET("api/users/alarm") + suspend fun getUserAlarmState(): Response - @POST("users/block/{blockedUserId}") + @POST("api/users/blocks/{targetUserId}") suspend fun postUserBlock( - @Path("blockedUserId") blockedUserId: Long, + @Path("targetUserId") targetUserId: Long, ): Response @POST("api/users/additional-info") @@ -58,7 +59,7 @@ interface UserService { ): Response @Multipart - @PATCH("users/profile") + @PATCH("api/users/profile") suspend fun patchUserProfile( @Part("request") request: RequestBody, @Part profileImage: MultipartBody.Part, @@ -70,9 +71,9 @@ interface UserService { @Query("isEnabled") isEnabled: Boolean, ): Response - @DELETE("users/block/{blockedUserId}") + @DELETE("api/users/blocks/{targetUserId}") suspend fun deleteBlockedUser( - @Path("blockedUserId") blockedUserId: Long, + @Path("targetUserId") targetUserId: Long, ): Response @DELETE("users/withdraw") diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetBoardResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetBoardResponseDTO.kt index f06cd7a3..7475889a 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetBoardResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetBoardResponseDTO.kt @@ -15,7 +15,8 @@ data class GetBoardResponseDTO( val liftUpDate: String, val bookMarked: Boolean, val buttonStatus: String, - val chatRoomId: Long?, + val myEnrollId: Long, + val chatRoomId: Long, val cheerClub: ClubDTO, val game: GameInfoDTO, val user: UserInfoDTO, diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetUserBoardListResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetUserBoardListResponseDTO.kt index 8d2a6e5d..a37f02a5 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetUserBoardListResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/GetUserBoardListResponseDTO.kt @@ -1,9 +1,9 @@ package com.catchmate.data.dto.board data class GetUserBoardListResponseDTO( - val boardInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardRequestDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardRequestDTO.kt index aecfe500..19800196 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardRequestDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardRequestDTO.kt @@ -1,13 +1,12 @@ package com.catchmate.data.dto.board data class PostBoardRequestDTO( - val boardId: Long? = null, // 임시저장 완성 시 임시저장 게시글 boardId 삽입, 새 게시글 생성 시 null val title: String?, val content: String?, val maxPerson: Int?, val cheerClubId: Int?, val preferredGender: String?, val preferredAgeRange: List?, - val completed: Boolean, // 임시 저장 시 false, 게시글 작성 시 true - val gameRequest: GameRequestDto?, + val completed: Boolean, // 임시 저장 시 false, 게시글 등록 시 true + val gameCreateRequest: GameRequestDto?, ) // 임시 저장 시 미입력 항목은 전부 null로 보냄 diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardResponseDTO.kt index 2833b8e4..d0b62a8b 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PostBoardResponseDTO.kt @@ -1,17 +1,6 @@ package com.catchmate.data.dto.board -import com.catchmate.data.dto.enroll.GameInfoDTO -import com.catchmate.data.dto.enroll.UserInfoDTO -import com.catchmate.data.dto.user.ClubDTO - data class PostBoardResponseDTO( val boardId: Long, - val title: String, - val content: String, - val currentPerson: Int, - val maxPerson: Int, - val bookMarked: Boolean, - val cheerClub: ClubDTO, - val gameResponse: GameInfoDTO, - val userResponse: UserInfoDTO, + val createdAt: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardRequestDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardRequestDTO.kt index b80b5555..865f0e0d 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardRequestDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardRequestDTO.kt @@ -8,5 +8,5 @@ data class PutBoardRequestDTO( val preferredGender: String?, val preferredAgeRange: List?, val completed: Boolean, - val gameRequest: GameRequestDto, + val gameUpdateRequest: GameRequestDto, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardResponseDTO.kt index b17778e2..45eb92f3 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/board/PutBoardResponseDTO.kt @@ -1,17 +1,6 @@ package com.catchmate.data.dto.board -import com.catchmate.data.dto.enroll.GameInfoDTO -import com.catchmate.data.dto.enroll.UserInfoDTO -import com.catchmate.data.dto.user.ClubDTO - data class PutBoardResponseDTO( val boardId: Long, - val title: String, - val content: String, - val currentPerson: Int, - val maxPerson: Int, - val bookMarked: Boolean, - val cheerClub: ClubDTO, - val gameResponse: GameInfoDTO, - val userResponse: UserInfoDTO, + val createdAt: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/ChatRoomInfoDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/ChatRoomInfoDTO.kt index 49ab3a69..eb278368 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/ChatRoomInfoDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/ChatRoomInfoDTO.kt @@ -4,12 +4,7 @@ import com.catchmate.data.dto.board.BoardDTO data class ChatRoomInfoDTO( val chatRoomId: Long, - val boardInfo: BoardDTO, - val participantCount: Int, - val lastMessageAt: String?, - val lastMessageContent: String?, - val chatRoomImage: String, - val unreadMessageCount: Int, - val isNewChatRoom: Boolean, - val isNotificationEnabled: Boolean, + val board: BoardDTO, + val lastMessage: LastMessageInfoDto?, + val createdAt: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/GetChattingRoomListResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/GetChattingRoomListResponseDTO.kt index 4306c58a..5237a4d3 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/GetChattingRoomListResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/GetChattingRoomListResponseDTO.kt @@ -1,9 +1,9 @@ package com.catchmate.data.dto.chatting data class GetChattingRoomListResponseDTO( - val chatRoomInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/LastMessageInfoDto.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/LastMessageInfoDto.kt new file mode 100644 index 00000000..f6db5506 --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/chatting/LastMessageInfoDto.kt @@ -0,0 +1,12 @@ +package com.catchmate.data.dto.chatting + +data class LastMessageInfoDto( + val messageId: Long, + val chatRoomId: Long, + val senderId: Long, + val senderNickName: String, + val senderProfileImageUrl: String, + val content: String, + val messageType: String, + val createdAt: String, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/AllReceivedEnrollInfoResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/AllReceivedEnrollInfoResponseDTO.kt index 1335f85b..6fae063a 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/AllReceivedEnrollInfoResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/AllReceivedEnrollInfoResponseDTO.kt @@ -1,6 +1,6 @@ package com.catchmate.data.dto.enroll data class AllReceivedEnrollInfoResponseDTO( - val boardInfo: EnrollBoardInfoDTO, - val enrollReceiveInfoList: List, + val boardResponse: EnrollBoardInfoDTO, + val enrollResponses: List, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollBoardInfoDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollBoardInfoDTO.kt index 1843d1f5..4a81252b 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollBoardInfoDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollBoardInfoDTO.kt @@ -1,18 +1,15 @@ package com.catchmate.data.dto.enroll +import com.catchmate.data.dto.user.ClubDTO + data class EnrollBoardInfoDTO( val boardId: Long, val title: String, val content: String, - val cheerClubId: Int, val currentPerson: Int, val maxPerson: Int, - val preferredGender: String, - val preferredAgeRange: String, - val liftUpDate: String, - val gameInfo: GameInfoDTO, - val userInfo: UserInfoDTO, - val buttonStatus: String?, - val chatRoomId: Long, val bookMarked: Boolean, + val cheerClub: ClubDTO, + val gameResponse: GameInfoDTO, + val userResponse: UserInfoDTO, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollInfoDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollInfoDTO.kt index d7706011..268d8769 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollInfoDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollInfoDTO.kt @@ -5,6 +5,5 @@ data class EnrollInfoDTO( val acceptStatus: String, val description: String, val requestDate: String, - val userInfo: UserInfoDTO, - val boardInfo: EnrollBoardInfoDTO, + val boardResponse: EnrollBoardInfoDTO, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollUserInfoDto.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollUserInfoDto.kt new file mode 100644 index 00000000..80acb699 --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/EnrollUserInfoDto.kt @@ -0,0 +1,11 @@ +package com.catchmate.data.dto.enroll + +data class EnrollUserInfoDto( + val userId: Long, + val nickname: String, + val profileImageUrl: String, + val gender: String, + val ageRange: String, + val favoriteClub: String, + val watchStyle: String?, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetAllReceivedEnrollResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetAllReceivedEnrollResponseDTO.kt index 47e39f56..9d94f8c1 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetAllReceivedEnrollResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetAllReceivedEnrollResponseDTO.kt @@ -1,9 +1,9 @@ package com.catchmate.data.dto.enroll data class GetAllReceivedEnrollResponseDTO( - val enrollInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetEnrollNewCountResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetEnrollNewCountResponseDTO.kt index 49fc95c6..0a58b36f 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetEnrollNewCountResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetEnrollNewCountResponseDTO.kt @@ -1,5 +1,5 @@ package com.catchmate.data.dto.enroll data class GetEnrollNewCountResponseDTO( - val newEnrollCount: Int, + val count: Int, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetEnrollResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetEnrollResponseDTO.kt new file mode 100644 index 00000000..141df832 --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetEnrollResponseDTO.kt @@ -0,0 +1,12 @@ +package com.catchmate.data.dto.enroll + +import com.catchmate.data.dto.board.BoardDTO + +data class GetEnrollResponseDTO( + val enrollId: Long, + val acceptStatus: String, + val description: String, + val requestDate: String, + val applicant: UserInfoDTO, + val boardResponse: BoardDTO, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetReceivedEnrollResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetReceivedEnrollResponseDTO.kt index b75970c4..8752c79e 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetReceivedEnrollResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetReceivedEnrollResponseDTO.kt @@ -1,9 +1,9 @@ package com.catchmate.data.dto.enroll data class GetReceivedEnrollResponseDTO( - val enrollInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetRequestedEnrollListResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetRequestedEnrollListResponseDTO.kt index 20a50dd5..e48ae313 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetRequestedEnrollListResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetRequestedEnrollListResponseDTO.kt @@ -1,9 +1,9 @@ package com.catchmate.data.dto.enroll data class GetRequestedEnrollListResponseDTO( - val enrollInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetRequestedEnrollResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetRequestedEnrollResponseDTO.kt deleted file mode 100644 index ecdc803b..00000000 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/GetRequestedEnrollResponseDTO.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.catchmate.data.dto.enroll - -data class GetRequestedEnrollResponseDTO( - val enrollId: Long, - val description: String, -) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollAcceptResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollAcceptResponseDTO.kt index 83464e5f..6cc4580a 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollAcceptResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollAcceptResponseDTO.kt @@ -2,5 +2,5 @@ package com.catchmate.data.dto.enroll data class PatchEnrollAcceptResponseDTO( val enrollId: Long, - val acceptStatus: String, + val message: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollRejectResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollRejectResponseDTO.kt index db8086f9..6f2ee791 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollRejectResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/PatchEnrollRejectResponseDTO.kt @@ -2,5 +2,5 @@ package com.catchmate.data.dto.enroll data class PatchEnrollRejectResponseDTO( val enrollId: Long, - val acceptStatus: String, + val message: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoDTO.kt index bc70e81c..c5a212ba 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoDTO.kt @@ -2,9 +2,8 @@ package com.catchmate.data.dto.enroll data class ReceivedEnrollInfoDTO( val enrollId: Long, - val acceptStatus: String, val description: String, + val newEnroll: Boolean, val requestDate: String, - val userInfo: UserInfoDTO, - val new: Boolean, + val applicant: EnrollUserInfoDto, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoResponseDTO.kt index 8cb42684..ca29ad52 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/enroll/ReceivedEnrollInfoResponseDTO.kt @@ -1,5 +1,9 @@ package com.catchmate.data.dto.enroll data class ReceivedEnrollInfoResponseDTO( - val enrollReceiveInfoList: List, + val enrollId: Long, + val description: String, + val requestDate: String, + val newEnroll: Boolean, + val applicantResponse: EnrollUserInfoDto, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetHasUnreadNotificationResponseDto.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetHasUnreadNotificationResponseDto.kt new file mode 100644 index 00000000..3dcc3ceb --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetHasUnreadNotificationResponseDto.kt @@ -0,0 +1,5 @@ +package com.catchmate.data.dto.notification + +data class GetHasUnreadNotificationResponseDto( + val hasUnread: Boolean, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetNotificationListResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetNotificationListResponseDTO.kt new file mode 100644 index 00000000..5e4fc8e9 --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetNotificationListResponseDTO.kt @@ -0,0 +1,9 @@ +package com.catchmate.data.dto.notification + +data class GetNotificationListResponseDTO( + val content: List, + val pageNumber: Int, + val totalPages: Int, + val totalElements: Int, + val hasNext: Boolean, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetReceivedNotificationListResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetReceivedNotificationListResponseDTO.kt deleted file mode 100644 index 97e5d7d6..00000000 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/GetReceivedNotificationListResponseDTO.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.catchmate.data.dto.notification - -data class GetReceivedNotificationListResponseDTO( - val notificationInfoList: List, - val totalPages: Int, - val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, -) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/NotificationInfoDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/NotificationInfoDTO.kt index f8bc193e..e91ffbae 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/NotificationInfoDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/notification/NotificationInfoDTO.kt @@ -1,15 +1,11 @@ package com.catchmate.data.dto.notification -import com.catchmate.data.dto.board.BoardDTO - data class NotificationInfoDTO( - val notificationId: Long, - val boardInfo: BoardDTO?, - val inquiryInfo: InquiryDTO?, - val senderProfileImageUrl: String?, + val id: Long, val title: String, - val body: String, - val createdAt: String, - val acceptStatus: String?, + val alarmType: String, val read: Boolean, + val createdAt: String, + val senderProfileImageUrl: String?, + val gameInfo: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/AdminUserInfoDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/AdminUserInfoDTO.kt deleted file mode 100644 index d5e1b1a0..00000000 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/AdminUserInfoDTO.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.catchmate.data.dto.support - -import com.catchmate.data.dto.user.ClubDTO - -data class AdminUserInfoDTO( - val userId: Long, - val profileImageUrl: String, - val nickName: String, - val clubInfo: ClubDTO, - val gender: String, - val email: String, - val socialType: String, - val joinedAt: String, -) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetInquiryResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetInquiryResponseDTO.kt index 6c8b2bea..2507f97d 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetInquiryResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetInquiryResponseDTO.kt @@ -2,10 +2,10 @@ package com.catchmate.data.dto.support data class GetInquiryResponseDTO( val inquiryId: Long, - val inquiryType: String, + val nickname: String, + val type: String, val content: String, - val nickName: String, val answer: String, - val isCompleted: Boolean, + val status: String, val createdAt: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetNoticeListResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetNoticeListResponseDTO.kt index 0ccde424..53277a8b 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetNoticeListResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/GetNoticeListResponseDTO.kt @@ -1,9 +1,9 @@ package com.catchmate.data.dto.support data class GetNoticeListResponseDTO( - val noticeInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/NoticeInfoDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/NoticeInfoDTO.kt index 495db6c8..63b33a0f 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/NoticeInfoDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/NoticeInfoDTO.kt @@ -4,7 +4,6 @@ data class NoticeInfoDTO( val noticeId: Long, val title: String, val content: String, - val userInfo: AdminUserInfoDTO, + val writerNickname: String, val createdAt: String, - val updatedAt: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/NoticeListInfoDto.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/NoticeListInfoDto.kt new file mode 100644 index 00000000..cb8b88fb --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/NoticeListInfoDto.kt @@ -0,0 +1,8 @@ +package com.catchmate.data.dto.support + +data class NoticeListInfoDto( + val noticeId: Long, + val title: String, + val writerNickname: String, + val createdAt: String, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryRequestDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryRequestDTO.kt index 13c030a9..df727cc5 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryRequestDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryRequestDTO.kt @@ -1,6 +1,6 @@ package com.catchmate.data.dto.support data class PostInquiryRequestDTO( - val inquiryType: String, + val type: String, val content: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryResponseDTO.kt index 5da2ddef..611c29ec 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostInquiryResponseDTO.kt @@ -1,5 +1,6 @@ package com.catchmate.data.dto.support data class PostInquiryResponseDTO( - val state: Boolean, + val inquiryId: Long, + val createdAt: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportRequestDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportRequestDTO.kt index b2da6669..18721992 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportRequestDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportRequestDTO.kt @@ -1,6 +1,7 @@ package com.catchmate.data.dto.support data class PostUserReportRequestDTO( - val reportType: String, - val content: String, + val reportedUserId: Long, + val reason: String, + val description: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportResponseDTO.kt index c067e5a9..df8af2bd 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/support/PostUserReportResponseDTO.kt @@ -1,5 +1,6 @@ package com.catchmate.data.dto.support data class PostUserReportResponseDTO( - val state: Boolean, + val reportId: Long, + val createdAt: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/BlockedUserInfoDto.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/BlockedUserInfoDto.kt new file mode 100644 index 00000000..6b5aa684 --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/BlockedUserInfoDto.kt @@ -0,0 +1,9 @@ +package com.catchmate.data.dto.user + +data class BlockedUserInfoDto( + val blockId: Long, + val userId: Long, + val nickName: String, + val profileImageUrl: String, + val blockedAt: String?, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/DeleteBlockedUserResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/DeleteBlockedUserResponseDTO.kt index b8cf8784..4cd45161 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/DeleteBlockedUserResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/DeleteBlockedUserResponseDTO.kt @@ -1,5 +1,6 @@ package com.catchmate.data.dto.user data class DeleteBlockedUserResponseDTO( - val state: Boolean, + val targetUserId: Long, + val message: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetBlockedUserListResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetBlockedUserListResponseDTO.kt index 8a4be046..ac99919e 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetBlockedUserListResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetBlockedUserListResponseDTO.kt @@ -1,9 +1,9 @@ package com.catchmate.data.dto.user data class GetBlockedUserListResponseDTO( - val userInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUnreadInfoResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUnreadInfoResponseDTO.kt deleted file mode 100644 index fbda9d8c..00000000 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUnreadInfoResponseDTO.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.catchmate.data.dto.user - -data class GetUnreadInfoResponseDTO( - val hasUnreadChat: Boolean, - val hasUnreadNotification: Boolean, -) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUserAlarmResponseDto.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUserAlarmResponseDto.kt new file mode 100644 index 00000000..8ab0fb47 --- /dev/null +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUserAlarmResponseDto.kt @@ -0,0 +1,8 @@ +package com.catchmate.data.dto.user + +data class GetUserAlarmResponseDto( + val allAlarm: Boolean, + val chatAlarm: Boolean, + val enrollAlarm: Boolean, + val eventAlarm: Boolean, +) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUserProfileByIdResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUserProfileByIdResponseDTO.kt index cd0d6df5..844bfd56 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUserProfileByIdResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/GetUserProfileByIdResponseDTO.kt @@ -2,15 +2,11 @@ package com.catchmate.data.dto.user data class GetUserProfileByIdResponseDTO( val userId: Long, + val nickName: String, val email: String, val profileImageUrl: String, val gender: String, - val allAlarm: String, - val chatAlarm: String, - val enrollAlarm: String, - val eventAlarm: String, - val nickName: String, - val favoriteClub: ClubDTO, val birthDate: String, - val watchStyle: String, + val watchStyle: String?, + val club: ClubDTO, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PatchUserProfileResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PatchUserProfileResponseDTO.kt index 324fb853..eb2d8019 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PatchUserProfileResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PatchUserProfileResponseDTO.kt @@ -1,5 +1,16 @@ package com.catchmate.data.dto.user data class PatchUserProfileResponseDTO( - val state: Boolean, + val userId: Long, + val email: String, + val profileImageUrl: String, + val gender: String, + val allAlarm: String, + val chatAlarm: String, + val enrollAlarm: String, + val eventAlarm: String, + val nickName: String, + val club: ClubDTO, + val birthDate: String, + val watchStyle: String?, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PostUserBlockResponseDTO.kt b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PostUserBlockResponseDTO.kt index 8672edba..d4e2de58 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PostUserBlockResponseDTO.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/dto/user/PostUserBlockResponseDTO.kt @@ -1,5 +1,6 @@ package com.catchmate.data.dto.user data class PostUserBlockResponseDTO( - val state: Boolean, + val targetUserId: Long, + val message: String, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/mapper/BoardMapper.kt b/CatchMate/data/src/main/java/com/catchmate/data/mapper/BoardMapper.kt index 502fc0c9..27a86da8 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/mapper/BoardMapper.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/mapper/BoardMapper.kt @@ -34,7 +34,6 @@ import com.catchmate.domain.model.user.Club object BoardMapper { fun toPostBoardRequestDTO(request: PostBoardRequest): PostBoardRequestDTO = PostBoardRequestDTO( - boardId = request.boardId, title = request.title, content = request.content, maxPerson = request.maxPerson, @@ -42,7 +41,7 @@ object BoardMapper { preferredGender = request.preferredGender, preferredAgeRange = request.preferredAgeRange, completed = request.completed, - gameRequest = toGameRequestDto(request.gameRequest), + gameCreateRequest = toGameRequestDto(request.gameCreateRequest), ) private fun toGameRequestDto(request: GameRequest?): GameRequestDto? = @@ -69,14 +68,7 @@ object BoardMapper { fun toPostBoardResponse(dto: PostBoardResponseDTO): PostBoardResponse = PostBoardResponse( boardId = dto.boardId, - title = dto.title, - content = dto.content, - currentPerson = dto.currentPerson, - maxPerson = dto.maxPerson, - bookMarked = dto.bookMarked, - cheerClub = toClub(dto.cheerClub)!!, - gameResponse = toGameInfo(dto.gameResponse)!!, - userResponse = toUserInfo(dto.userResponse), + createdAt = dto.createdAt, ) private fun toGameInfo(dto: GameInfoDTO?): GameInfo? = @@ -137,20 +129,13 @@ object BoardMapper { preferredGender = request.preferredGender, preferredAgeRange = request.preferredAgeRange, completed = request.completed, - gameRequest = toGameRequestDto(request.gameRequest)!!, + gameUpdateRequest = toGameRequestDto(request.gameUpdateRequest)!!, ) fun toPutBoardResponse(responseDTO: PutBoardResponseDTO): PutBoardResponse = PutBoardResponse( boardId = responseDTO.boardId, - title = responseDTO.title, - content = responseDTO.content, - currentPerson = responseDTO.currentPerson, - maxPerson = responseDTO.maxPerson, - bookMarked = responseDTO.bookMarked, - cheerClub = toClub(responseDTO.cheerClub)!!, - gameResponse = toGameInfo(responseDTO.gameResponse)!!, - userResponse = toUserInfo(responseDTO.userResponse), + createdAt = responseDTO.createdAt, ) fun toPatchBoardLiftUpResponse(dto: PatchBoardLiftUpResponseDTO): PatchBoardLiftUpResponse = @@ -183,11 +168,11 @@ object BoardMapper { fun toGetUserBoardListResponse(dto: GetUserBoardListResponseDTO): GetUserBoardListResponse = GetUserBoardListResponse( - boardInfoList = dto.boardInfoList.map { toBoard(it) }, + content = dto.content.map { toBoard(it) }, totalPages = dto.totalPages, totalElements = dto.totalElements, - isFirst = dto.isFirst, - isLast = dto.isLast, + pageNumber = dto.pageNumber, + hasNext = dto.hasNext, ) fun toGetBoardResponse(responseDTO: GetBoardResponseDTO): GetBoardResponse = @@ -202,6 +187,7 @@ object BoardMapper { liftUpDate = responseDTO.liftUpDate, bookMarked = responseDTO.bookMarked, buttonStatus = responseDTO.buttonStatus, + myEnrollId = responseDTO.myEnrollId, chatRoomId = responseDTO.chatRoomId, cheerClub = toClub(responseDTO.cheerClub)!!, game = toGameInfo(responseDTO.game)!!, diff --git a/CatchMate/data/src/main/java/com/catchmate/data/mapper/ChattingMapper.kt b/CatchMate/data/src/main/java/com/catchmate/data/mapper/ChattingMapper.kt index add9217c..220023f5 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/mapper/ChattingMapper.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/mapper/ChattingMapper.kt @@ -8,6 +8,7 @@ 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.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.mapper.BoardMapper.toBoard @@ -20,32 +21,42 @@ 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.GetChattingRoomListResponse +import com.catchmate.domain.model.chatting.LastMessageInfo import com.catchmate.domain.model.chatting.PatchChattingRoomImageResponse import com.catchmate.domain.model.chatting.PutChattingRoomAlarmResponse object ChattingMapper { fun toGetChattingRoomListResponse(dto: GetChattingRoomListResponseDTO): GetChattingRoomListResponse = GetChattingRoomListResponse( - chatRoomInfoList = dto.chatRoomInfoList.map { toChatRoomInfo(it) }, + content = dto.content.map { toChatRoomInfo(it) }, + pageNumber = dto.pageNumber, totalPages = dto.totalPages, totalElements = dto.totalElements, - isFirst = dto.isFirst, - isLast = dto.isLast, + hasNext = dto.hasNext, ) fun toChatRoomInfo(dto: ChatRoomInfoDTO): ChatRoomInfo = ChatRoomInfo( chatRoomId = dto.chatRoomId, - boardInfo = toBoard(dto.boardInfo), - participantCount = dto.participantCount, - lastMessageAt = dto.lastMessageAt, - lastMessageContent = dto.lastMessageContent, - chatRoomImage = dto.chatRoomImage, - unreadMessageCount = dto.unreadMessageCount, - isNewChatRoom = dto.isNewChatRoom, - isNotificationEnabled = dto.isNotificationEnabled, + board = toBoard(dto.board), + lastMessage = toLastMessageInfo(dto.lastMessage), + createdAt = dto.createdAt, ) + private fun toLastMessageInfo(dto: LastMessageInfoDto?): LastMessageInfo? = + dto?.let { + LastMessageInfo( + messageId = dto.messageId, + chatRoomId = dto.chatRoomId, + senderId = dto.senderId, + senderNickName = dto.senderNickName, + senderProfileImageUrl = dto.senderProfileImageUrl, + content = dto.content, + messageType = dto.messageType, + createdAt = dto.createdAt, + ) + } + fun toGetChattingHistoryResponse(dto: GetChattingHistoryResponseDTO): GetChattingHistoryResponse = GetChattingHistoryResponse( chatMessageInfoList = dto.chatMessageInfoList.map { toChatMessageInfo(it) }, diff --git a/CatchMate/data/src/main/java/com/catchmate/data/mapper/EnrollMapper.kt b/CatchMate/data/src/main/java/com/catchmate/data/mapper/EnrollMapper.kt index 38a2847f..f886fd9f 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/mapper/EnrollMapper.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/mapper/EnrollMapper.kt @@ -1,15 +1,17 @@ package com.catchmate.data.mapper +import com.catchmate.data.dto.board.BoardDTO import com.catchmate.data.dto.enroll.AllReceivedEnrollInfoResponseDTO import com.catchmate.data.dto.enroll.DeleteEnrollResponseDTO import com.catchmate.data.dto.enroll.EnrollBoardInfoDTO import com.catchmate.data.dto.enroll.EnrollInfoDTO +import com.catchmate.data.dto.enroll.EnrollUserInfoDto import com.catchmate.data.dto.enroll.GameInfoDTO import com.catchmate.data.dto.enroll.GetAllReceivedEnrollResponseDTO import com.catchmate.data.dto.enroll.GetEnrollNewCountResponseDTO +import com.catchmate.data.dto.enroll.GetEnrollResponseDTO import com.catchmate.data.dto.enroll.GetReceivedEnrollResponseDTO import com.catchmate.data.dto.enroll.GetRequestedEnrollListResponseDTO -import com.catchmate.data.dto.enroll.GetRequestedEnrollResponseDTO import com.catchmate.data.dto.enroll.PatchEnrollAcceptResponseDTO import com.catchmate.data.dto.enroll.PatchEnrollRejectResponseDTO import com.catchmate.data.dto.enroll.PostEnrollRequestDTO @@ -18,16 +20,18 @@ import com.catchmate.data.dto.enroll.ReceivedEnrollInfoDTO import com.catchmate.data.dto.enroll.ReceivedEnrollInfoResponseDTO import com.catchmate.data.dto.enroll.UserInfoDTO import com.catchmate.data.mapper.BoardMapper.toClub +import com.catchmate.domain.model.board.Board import com.catchmate.domain.model.enroll.AllReceivedEnrollInfoResponse import com.catchmate.domain.model.enroll.DeleteEnrollResponse import com.catchmate.domain.model.enroll.EnrollBoardInfo import com.catchmate.domain.model.enroll.EnrollInfo +import com.catchmate.domain.model.enroll.EnrollUserInfo import com.catchmate.domain.model.enroll.GameInfo import com.catchmate.domain.model.enroll.GetAllReceivedEnrollResponse import com.catchmate.domain.model.enroll.GetEnrollNewCountResponse +import com.catchmate.domain.model.enroll.GetEnrollResponse import com.catchmate.domain.model.enroll.GetReceivedEnrollResponse import com.catchmate.domain.model.enroll.GetRequestedEnrollListResponse -import com.catchmate.domain.model.enroll.GetRequestedEnrollResponse import com.catchmate.domain.model.enroll.PatchEnrollAcceptResponse import com.catchmate.domain.model.enroll.PatchEnrollRejectResponse import com.catchmate.domain.model.enroll.PostEnrollRequest @@ -51,28 +55,45 @@ object EnrollMapper { fun toPatchEnrollRejectResponse(responseDTO: PatchEnrollRejectResponseDTO): PatchEnrollRejectResponse = PatchEnrollRejectResponse( enrollId = responseDTO.enrollId, - acceptStatus = responseDTO.acceptStatus, + message = responseDTO.message, ) fun toPatchEnrollAcceptResponse(responseDTO: PatchEnrollAcceptResponseDTO): PatchEnrollAcceptResponse = PatchEnrollAcceptResponse( enrollId = responseDTO.enrollId, - acceptStatus = responseDTO.acceptStatus, + message = responseDTO.message, ) - fun toGetRequestedEnrollResponse(dto: GetRequestedEnrollResponseDTO): GetRequestedEnrollResponse = - GetRequestedEnrollResponse( + fun toGetEnrollResponse(dto: GetEnrollResponseDTO): GetEnrollResponse = + GetEnrollResponse( enrollId = dto.enrollId, + acceptStatus = dto.acceptStatus, description = dto.description, + requestDate = dto.requestDate, + applicant = toUserInfo(dto.applicant), + boardResponse = toEnrollBoardResponse(dto.boardResponse), + ) + + private fun toEnrollBoardResponse(dto: BoardDTO): Board = + Board( + dto.boardId, + dto.title, + dto.content, + dto.currentPerson, + dto.maxPerson, + dto.bookMarked, + toClub(dto.cheerClub)!!, + toGameInfo(dto.gameResponse), + toUserInfo(dto.userResponse), ) fun toGetRequestedEnrollListResponse(responseDTO: GetRequestedEnrollListResponseDTO): GetRequestedEnrollListResponse = GetRequestedEnrollListResponse( - enrollInfoList = responseDTO.enrollInfoList.map { toEnrollInfo(it) }, + content = responseDTO.content.map { toEnrollInfo(it) }, + pageNumber = responseDTO.pageNumber, totalPages = responseDTO.totalPages, totalElements = responseDTO.totalElements, - isFirst = responseDTO.isFirst, - isLast = responseDTO.isLast, + hasNext = responseDTO.hasNext, ) private fun toEnrollInfo(dto: EnrollInfoDTO): EnrollInfo = @@ -81,11 +102,10 @@ object EnrollMapper { acceptStatus = dto.acceptStatus, description = dto.description, requestDate = dto.requestDate, - userInfo = toEnrollUserInfo(dto.userInfo), - boardInfo = toEnrollBoardInfo(dto.boardInfo), + boardResponse = toEnrollBoardInfo(dto.boardResponse), ) - private fun toEnrollUserInfo(dto: UserInfoDTO): UserInfo = + private fun toUserInfo(dto: UserInfoDTO): UserInfo = UserInfo( userId = dto.userId, nickName = dto.nickName, @@ -102,17 +122,23 @@ object EnrollMapper { boardId = dto.boardId, title = dto.title, content = dto.content, - cheerClubId = dto.cheerClubId, currentPerson = dto.currentPerson, maxPerson = dto.maxPerson, - preferredGender = dto.preferredGender, - preferredAgeRange = dto.preferredAgeRange, - gameInfo = toGameInfo(dto.gameInfo), - liftUpDate = dto.liftUpDate, - userInfo = toEnrollUserInfo(dto.userInfo), - buttonStatus = dto.buttonStatus, - chatRoomId = dto.chatRoomId, bookMarked = dto.bookMarked, + cheerClub = toClub(dto.cheerClub)!!, + gameResponse = toGameInfo(dto.gameResponse), + userResponse = toUserInfo(dto.userResponse), + ) + + private fun toEnrollUserInfo(dto: EnrollUserInfoDto): EnrollUserInfo = + EnrollUserInfo( + userId = dto.userId, + nickname = dto.nickname, + profileImageUrl = dto.profileImageUrl, + gender = dto.gender, + ageRange = dto.ageRange, + favoriteClub = dto.favoriteClub, + watchStyle = dto.watchStyle, ) private fun toGameInfo(dto: GameInfoDTO): GameInfo = @@ -126,46 +152,49 @@ object EnrollMapper { fun toGetReceivedEnrollResponse(responseDTO: GetReceivedEnrollResponseDTO): GetReceivedEnrollResponse = GetReceivedEnrollResponse( - enrollInfoList = responseDTO.enrollInfoList.map { toReceivedEnrollInfoResponse(it) }, + content = responseDTO.content.map { toReceivedEnrollInfoResponse(it) }, + pageNumber = responseDTO.pageNumber, totalPages = responseDTO.totalPages, totalElements = responseDTO.totalElements, - isFirst = responseDTO.isFirst, - isLast = responseDTO.isLast, + hasNext = responseDTO.hasNext, ) private fun toReceivedEnrollInfoResponse(dto: ReceivedEnrollInfoResponseDTO): ReceivedEnrollInfoResponse = ReceivedEnrollInfoResponse( - enrollReceiveInfoList = dto.enrollReceiveInfoList.map { toReceivedEnrollInfo(it) }, + enrollId = dto.enrollId, + description = dto.description, + requestDate = dto.requestDate, + newEnroll = dto.newEnroll, + applicantResponse = toEnrollUserInfo(dto.applicantResponse), ) private fun toReceivedEnrollInfo(dto: ReceivedEnrollInfoDTO): ReceivedEnrollInfo = ReceivedEnrollInfo( enrollId = dto.enrollId, - acceptStatus = dto.acceptStatus, description = dto.description, + newEnroll = dto.newEnroll, requestDate = dto.requestDate, - userInfo = toEnrollUserInfo(dto.userInfo), - new = dto.new, + applicant = toEnrollUserInfo(dto.applicant), ) fun toGetAllReceivedEnrollResponse(responseDTO: GetAllReceivedEnrollResponseDTO): GetAllReceivedEnrollResponse = GetAllReceivedEnrollResponse( - enrollInfoList = responseDTO.enrollInfoList.map { toAllReceivedEnrollInfoResponse(it) }, + content = responseDTO.content.map { toAllReceivedEnrollInfoResponse(it) }, + pageNumber = responseDTO.pageNumber, totalPages = responseDTO.totalPages, totalElements = responseDTO.totalElements, - isFirst = responseDTO.isFirst, - isLast = responseDTO.isLast, + hasNext = responseDTO.hasNext, ) private fun toAllReceivedEnrollInfoResponse(dto: AllReceivedEnrollInfoResponseDTO): AllReceivedEnrollInfoResponse = AllReceivedEnrollInfoResponse( - boardInfo = toEnrollBoardInfo(dto.boardInfo), - enrollReceiveInfoList = dto.enrollReceiveInfoList.map { toReceivedEnrollInfo(it) }, + boardResponse = toEnrollBoardInfo(dto.boardResponse), + enrollResponses = dto.enrollResponses.map { toReceivedEnrollInfo(it) }, ) fun toGetEnrollNewCountResponse(responseDTO: GetEnrollNewCountResponseDTO): GetEnrollNewCountResponse = GetEnrollNewCountResponse( - newEnrollCount = responseDTO.newEnrollCount, + count = responseDTO.count, ) fun toDeleteEnrollResponse(responseDTO: DeleteEnrollResponseDTO): DeleteEnrollResponse = diff --git a/CatchMate/data/src/main/java/com/catchmate/data/mapper/NotificationMapper.kt b/CatchMate/data/src/main/java/com/catchmate/data/mapper/NotificationMapper.kt index 2f8381c0..46f89df5 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/mapper/NotificationMapper.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/mapper/NotificationMapper.kt @@ -1,38 +1,36 @@ package com.catchmate.data.mapper -import com.catchmate.data.dto.notification.DeleteReceivedNotificationResponseDTO -import com.catchmate.data.dto.notification.GetReceivedNotificationListResponseDTO +import com.catchmate.data.dto.notification.GetHasUnreadNotificationResponseDto +import com.catchmate.data.dto.notification.GetNotificationListResponseDTO import com.catchmate.data.dto.notification.GetReceivedNotificationResponseDTO import com.catchmate.data.dto.notification.InquiryDTO import com.catchmate.data.dto.notification.NotificationInfoDTO import com.catchmate.data.mapper.BoardMapper.toBoard -import com.catchmate.domain.model.notification.DeleteReceivedNotificationResponse -import com.catchmate.domain.model.notification.GetReceivedNotificationListResponse +import com.catchmate.domain.model.notification.GetHasUnreadNotificationResponse +import com.catchmate.domain.model.notification.GetNotificationListResponse import com.catchmate.domain.model.notification.GetReceivedNotificationResponse import com.catchmate.domain.model.notification.Inquiry import com.catchmate.domain.model.notification.NotificationInfo object NotificationMapper { - fun toGetReceivedNotificationListResponse(responseDTO: GetReceivedNotificationListResponseDTO): GetReceivedNotificationListResponse = - GetReceivedNotificationListResponse( - notificationInfoList = responseDTO.notificationInfoList.map { toNotificationInfo(it) }, + fun toGetReceivedNotificationListResponse(responseDTO: GetNotificationListResponseDTO): GetNotificationListResponse = + GetNotificationListResponse( + content = responseDTO.content.map { toNotificationInfo(it) }, + pageNumber = responseDTO.pageNumber, totalPages = responseDTO.totalPages, totalElements = responseDTO.totalElements, - isFirst = responseDTO.isFirst, - isLast = responseDTO.isLast, + hasNext = responseDTO.hasNext, ) private fun toNotificationInfo(dto: NotificationInfoDTO): NotificationInfo = NotificationInfo( - notificationId = dto.notificationId, - boardInfo = dto.boardInfo?.let { toBoard(it) }, - inquiryInfo = dto.inquiryInfo?.let { toInquiry(it) }, - senderProfileImageUrl = dto.senderProfileImageUrl, + id = dto.id, title = dto.title, - body = dto.body, - createdAt = dto.createdAt, - acceptStatus = dto.acceptStatus, + alarmType = dto.alarmType, read = dto.read, + createdAt = dto.createdAt, + senderProfileImageUrl = dto.senderProfileImageUrl, + gameInfo = dto.gameInfo, ) private fun toInquiry(dto: InquiryDTO): Inquiry = @@ -58,8 +56,6 @@ object NotificationMapper { read = dto.read, ) - fun toDeleteReceivedNotificationResponse(responseDTO: DeleteReceivedNotificationResponseDTO): DeleteReceivedNotificationResponse = - DeleteReceivedNotificationResponse( - state = responseDTO.state, - ) + fun toGetHasUnreadNotificationResponse(dto: GetHasUnreadNotificationResponseDto): GetHasUnreadNotificationResponse = + GetHasUnreadNotificationResponse(dto.hasUnread) } diff --git a/CatchMate/data/src/main/java/com/catchmate/data/mapper/SupportMapper.kt b/CatchMate/data/src/main/java/com/catchmate/data/mapper/SupportMapper.kt index 842bd345..d1e1bd32 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/mapper/SupportMapper.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/mapper/SupportMapper.kt @@ -1,18 +1,18 @@ package com.catchmate.data.mapper -import com.catchmate.data.dto.support.AdminUserInfoDTO import com.catchmate.data.dto.support.GetInquiryResponseDTO import com.catchmate.data.dto.support.GetNoticeListResponseDTO import com.catchmate.data.dto.support.NoticeInfoDTO +import com.catchmate.data.dto.support.NoticeListInfoDto import com.catchmate.data.dto.support.PostInquiryRequestDTO import com.catchmate.data.dto.support.PostInquiryResponseDTO import com.catchmate.data.dto.support.PostUserReportRequestDTO import com.catchmate.data.dto.support.PostUserReportResponseDTO import com.catchmate.data.mapper.BoardMapper.toClub -import com.catchmate.domain.model.support.AdminUserInfo import com.catchmate.domain.model.support.GetInquiryResponse import com.catchmate.domain.model.support.GetNoticeListResponse import com.catchmate.domain.model.support.NoticeInfo +import com.catchmate.domain.model.support.NoticeListInfo import com.catchmate.domain.model.support.PostInquiryRequest import com.catchmate.domain.model.support.PostInquiryResponse import com.catchmate.domain.model.support.PostUserReportRequest @@ -21,44 +21,55 @@ import com.catchmate.domain.model.support.PostUserReportResponse object SupportMapper { fun toPostInquiryRequestDTO(request: PostInquiryRequest): PostInquiryRequestDTO = PostInquiryRequestDTO( - inquiryType = request.inquiryType, + type = request.type, content = request.content, ) fun toPostInquiryResponse(dto: PostInquiryResponseDTO): PostInquiryResponse = PostInquiryResponse( - state = dto.state, + inquiryId = dto.inquiryId, + createdAt = dto.createdAt, ) fun toPostUserReportRequestDTO(request: PostUserReportRequest): PostUserReportRequestDTO = PostUserReportRequestDTO( - reportType = request.reportType, - content = request.content, + reportedUserId = request.reportedUserId, + reason = request.reason, + description = request.description, ) fun toPostUserReportResponse(dto: PostUserReportResponseDTO): PostUserReportResponse = PostUserReportResponse( - state = dto.state, + reportId = dto.reportId, + createdAt = dto.createdAt, ) fun toGetInquiryResponse(dto: GetInquiryResponseDTO): GetInquiryResponse = GetInquiryResponse( inquiryId = dto.inquiryId, - inquiryType = dto.inquiryType, + nickname = dto.nickname, + type = dto.type, content = dto.content, - nickName = dto.nickName, answer = dto.answer, - isCompleted = dto.isCompleted, + status = dto.status, createdAt = dto.createdAt, ) fun toGetNoticeListResponse(dto: GetNoticeListResponseDTO): GetNoticeListResponse = GetNoticeListResponse( - noticeInfoList = dto.noticeInfoList.map { toNoticeInfo(it) }, + content = dto.content.map { toNoticeListInfo(it) }, + pageNumber = dto.pageNumber, totalPages = dto.totalPages, totalElements = dto.totalElements, - isFirst = dto.isFirst, - isLast = dto.isLast, + hasNext = dto.hasNext, + ) + + private fun toNoticeListInfo(dto: NoticeListInfoDto): NoticeListInfo = + NoticeListInfo( + noticeId = dto.noticeId, + title = dto.title, + writerNickname = dto.writerNickname, + createdAt = dto.createdAt, ) fun toNoticeInfo(dto: NoticeInfoDTO): NoticeInfo = @@ -66,20 +77,7 @@ object SupportMapper { noticeId = dto.noticeId, title = dto.title, content = dto.content, - userInfo = toAdminUserInfo(dto.userInfo), + writerNickname = dto.writerNickname, createdAt = dto.createdAt, - updatedAt = dto.updatedAt, - ) - - fun toAdminUserInfo(dto: AdminUserInfoDTO): AdminUserInfo = - AdminUserInfo( - userId = dto.userId, - profileImageUrl = dto.profileImageUrl, - nickName = dto.nickName, - clubInfo = toClub(dto.clubInfo)!!, - gender = dto.gender, - email = dto.email, - socialType = dto.socialType, - joinedAt = dto.joinedAt, ) } diff --git a/CatchMate/data/src/main/java/com/catchmate/data/mapper/UserMapper.kt b/CatchMate/data/src/main/java/com/catchmate/data/mapper/UserMapper.kt index 299b110e..1bbf9256 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/mapper/UserMapper.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/mapper/UserMapper.kt @@ -1,10 +1,11 @@ package com.catchmate.data.mapper +import com.catchmate.data.dto.user.BlockedUserInfoDto import com.catchmate.data.dto.user.DeleteBlockedUserResponseDTO import com.catchmate.data.dto.user.DeleteUserAccountResponseDTO import com.catchmate.data.dto.user.GetBlockedUserListResponseDTO import com.catchmate.data.dto.user.GetCheckNicknameResponseDTO -import com.catchmate.data.dto.user.GetUnreadInfoResponseDTO +import com.catchmate.data.dto.user.GetUserAlarmResponseDto import com.catchmate.data.dto.user.GetUserProfileByIdResponseDTO import com.catchmate.data.dto.user.GetUserProfileResponseDTO import com.catchmate.data.dto.user.PatchUserAlarmResponseDTO @@ -13,11 +14,12 @@ import com.catchmate.data.dto.user.PostUserAdditionalInfoRequestDTO import com.catchmate.data.dto.user.PostUserAdditionalInfoResponseDTO import com.catchmate.data.dto.user.PostUserBlockResponseDTO import com.catchmate.data.mapper.BoardMapper.toClub +import com.catchmate.domain.model.user.BlockedUserInfo import com.catchmate.domain.model.user.DeleteBlockedUserResponse import com.catchmate.domain.model.user.DeleteUserAccountResponse import com.catchmate.domain.model.user.GetBlockedUserListResponse import com.catchmate.domain.model.user.GetCheckNicknameResponse -import com.catchmate.domain.model.user.GetUnreadInfoResponse +import com.catchmate.domain.model.user.GetUserAlarmResponse import com.catchmate.domain.model.user.GetUserProfileByIdResponse import com.catchmate.domain.model.user.GetUserProfileResponse import com.catchmate.domain.model.user.PatchUserAlarmResponse @@ -63,7 +65,18 @@ object UserMapper { fun toPatchUserProfileResponse(responseDTO: PatchUserProfileResponseDTO): PatchUserProfileResponse = PatchUserProfileResponse( - state = responseDTO.state, + userId = responseDTO.userId, + email = responseDTO.email, + profileImageUrl = responseDTO.profileImageUrl, + gender = responseDTO.gender, + allAlarm = responseDTO.allAlarm, + chatAlarm = responseDTO.chatAlarm, + enrollAlarm = responseDTO.enrollAlarm, + eventAlarm = responseDTO.eventAlarm, + nickName = responseDTO.nickName, + club = toClub(responseDTO.club)!!, + birthDate = responseDTO.birthDate, + watchStyle = responseDTO.watchStyle, ) fun toPatchUserAlarmResponse(responseDTO: PatchUserAlarmResponseDTO): PatchUserAlarmResponse = @@ -81,42 +94,51 @@ object UserMapper { fun toGetUserProfileByIdResponse(responseDTO: GetUserProfileByIdResponseDTO): GetUserProfileByIdResponse = GetUserProfileByIdResponse( userId = responseDTO.userId, + nickName = responseDTO.nickName, email = responseDTO.email, profileImageUrl = responseDTO.profileImageUrl, gender = responseDTO.gender, - allAlarm = responseDTO.allAlarm, - chatAlarm = responseDTO.chatAlarm, - enrollAlarm = responseDTO.enrollAlarm, - eventAlarm = responseDTO.eventAlarm, - nickName = responseDTO.nickName, - favoriteClub = toClub(responseDTO.favoriteClub)!!, birthDate = responseDTO.birthDate, watchStyle = responseDTO.watchStyle, + club = toClub(responseDTO.club)!!, + ) + + fun toGetUserAlarmStateResponse(dto: GetUserAlarmResponseDto): GetUserAlarmResponse = + GetUserAlarmResponse( + allAlarm = dto.allAlarm, + chatAlarm = dto.chatAlarm, + enrollAlarm = dto.enrollAlarm, + eventAlarm = dto.eventAlarm, ) fun toGetBlockedUserListResponse(dto: GetBlockedUserListResponseDTO): GetBlockedUserListResponse = GetBlockedUserListResponse( - userInfoList = dto.userInfoList.map { toGetUserProfileResponse(it) }, + content = dto.content.map { toBlockedUserInfo(it) }, + pageNumber = dto.pageNumber, totalPages = dto.totalPages, totalElements = dto.totalElements, - isFirst = dto.isFirst, - isLast = dto.isLast, + hasNext = dto.hasNext, + ) + + private fun toBlockedUserInfo(dto: BlockedUserInfoDto): BlockedUserInfo = + BlockedUserInfo( + blockId = dto.blockId, + userId = dto.userId, + nickName = dto.nickName, + profileImageUrl = dto.profileImageUrl, + blockedAt = dto.blockedAt, ) fun toDeleteBlockedUserResponse(dto: DeleteBlockedUserResponseDTO): DeleteBlockedUserResponse = DeleteBlockedUserResponse( - state = dto.state, + targetUserId = dto.targetUserId, + message = dto.message, ) fun toPostUserBlockResponse(dto: PostUserBlockResponseDTO): PostUserBlockResponse = PostUserBlockResponse( - state = dto.state, - ) - - fun toGetUnreadInfoResponse(dto: GetUnreadInfoResponseDTO): GetUnreadInfoResponse = - GetUnreadInfoResponse( - hasUnreadChat = dto.hasUnreadChat, - hasUnreadNotification = dto.hasUnreadNotification, + targetUserId = dto.targetUserId, + message = dto.message, ) fun toDeleteUserAccountResponse(dto: DeleteUserAccountResponseDTO): DeleteUserAccountResponse = diff --git a/CatchMate/data/src/main/java/com/catchmate/data/repository/BoardRepositoryImpl.kt b/CatchMate/data/src/main/java/com/catchmate/data/repository/BoardRepositoryImpl.kt index 543523bf..bdfe5fae 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/repository/BoardRepositoryImpl.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/repository/BoardRepositoryImpl.kt @@ -82,10 +82,11 @@ class BoardRepositoryImpl override suspend fun getUserBoardList( userId: Long, page: Int, + size: Int, ): Result = apiCall( tag = this.tag, - apiFunction = { boardApi.getUserBoardList(userId, page) }, + apiFunction = { boardApi.getUserBoardList(userId, page, size) }, transform = { BoardMapper.toGetUserBoardListResponse(it!!) }, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/repository/ChattingRepositoryImpl.kt b/CatchMate/data/src/main/java/com/catchmate/data/repository/ChattingRepositoryImpl.kt index b2a41a44..ceb08bda 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/repository/ChattingRepositoryImpl.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/repository/ChattingRepositoryImpl.kt @@ -24,10 +24,13 @@ class ChattingRepositoryImpl private val chattingApi = retrofitClient.createApi() private val tag = "ChattingRepo" - override suspend fun getChattingRoomList(page: Int): Result = + override suspend fun getChattingRoomList( + page: Int, + size: Int, + ): Result = apiCall( tag = this.tag, - apiFunction = { chattingApi.getChattingRoomList(page) }, + apiFunction = { chattingApi.getChattingRoomList(page, size) }, transform = { ChattingMapper.toGetChattingRoomListResponse(it!!) }, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/repository/EnrollRepositoryImpl.kt b/CatchMate/data/src/main/java/com/catchmate/data/repository/EnrollRepositoryImpl.kt index fade9c30..eda7e891 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/repository/EnrollRepositoryImpl.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/repository/EnrollRepositoryImpl.kt @@ -7,9 +7,9 @@ import com.catchmate.data.util.ApiResponseHandleUtil.apiCall import com.catchmate.domain.model.enroll.DeleteEnrollResponse import com.catchmate.domain.model.enroll.GetAllReceivedEnrollResponse import com.catchmate.domain.model.enroll.GetEnrollNewCountResponse +import com.catchmate.domain.model.enroll.GetEnrollResponse import com.catchmate.domain.model.enroll.GetReceivedEnrollResponse import com.catchmate.domain.model.enroll.GetRequestedEnrollListResponse -import com.catchmate.domain.model.enroll.GetRequestedEnrollResponse import com.catchmate.domain.model.enroll.PatchEnrollAcceptResponse import com.catchmate.domain.model.enroll.PatchEnrollRejectResponse import com.catchmate.domain.model.enroll.PostEnrollRequest @@ -49,31 +49,41 @@ class EnrollRepositoryImpl transform = { EnrollMapper.toPatchEnrollAcceptResponse(it!!) }, ) - override suspend fun getRequestedEnroll(boardId: Long): Result = + override suspend fun getEnroll(enrollId: Long): Result = apiCall( tag = this.tag, - apiFunction = { enrollApi.getRequestedEnroll(boardId) }, - transform = { EnrollMapper.toGetRequestedEnrollResponse(it!!) }, + apiFunction = { enrollApi.getEnroll(enrollId) }, + transform = { EnrollMapper.toGetEnrollResponse(it!!) }, ) - override suspend fun getRequestedEnrollList(page: Int): Result = + override suspend fun getRequestedEnrollList( + page: Int, + size: Int, + ): Result = apiCall( tag = this.tag, - apiFunction = { enrollApi.getRequestedEnrollList(page) }, + apiFunction = { enrollApi.getRequestedEnrollList(page, size) }, transform = { EnrollMapper.toGetRequestedEnrollListResponse(it!!) }, ) - override suspend fun getReceivedEnroll(boardId: Long): Result = + override suspend fun getReceivedEnroll( + boardId: Long, + page: Int, + size: Int, + ): Result = apiCall( tag = this.tag, - apiFunction = { enrollApi.getReceivedEnroll(boardId) }, + apiFunction = { enrollApi.getReceivedEnroll(boardId, page, size) }, transform = { EnrollMapper.toGetReceivedEnrollResponse(it!!) }, ) - override suspend fun getAllReceivedEnroll(page: Int): Result = + override suspend fun getAllReceivedEnroll( + page: Int, + size: Int, + ): Result = apiCall( tag = this.tag, - apiFunction = { enrollApi.getAllReceivedEnroll(page) }, + apiFunction = { enrollApi.getAllReceivedEnroll(page, size) }, transform = { EnrollMapper.toGetAllReceivedEnrollResponse(it!!) }, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/repository/NotificationRepositoryImpl.kt b/CatchMate/data/src/main/java/com/catchmate/data/repository/NotificationRepositoryImpl.kt index 3aaf853e..d7f97efa 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/repository/NotificationRepositoryImpl.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/repository/NotificationRepositoryImpl.kt @@ -4,8 +4,9 @@ import com.catchmate.data.datasource.remote.NotificationService import com.catchmate.data.datasource.remote.RetrofitClient import com.catchmate.data.mapper.NotificationMapper import com.catchmate.data.util.ApiResponseHandleUtil.apiCall -import com.catchmate.domain.model.notification.DeleteReceivedNotificationResponse -import com.catchmate.domain.model.notification.GetReceivedNotificationListResponse +import com.catchmate.data.util.ApiResponseHandleUtil.apiCallWithFullResponse +import com.catchmate.domain.model.notification.GetHasUnreadNotificationResponse +import com.catchmate.domain.model.notification.GetNotificationListResponse import com.catchmate.domain.model.notification.GetReceivedNotificationResponse import com.catchmate.domain.repository.NotificationRepository import javax.inject.Inject @@ -18,13 +19,23 @@ class NotificationRepositoryImpl private val notificationApi = retrofitClient.createApi() private val tag = "NotificationRepo" - override suspend fun getReceivedNotificationList(page: Int): Result = + override suspend fun getNotificationList( + page: Int, + size: Int, + ): Result = apiCall( tag = this.tag, - apiFunction = { notificationApi.getReceivedNotificationList(page) }, + apiFunction = { notificationApi.getNotificationList(page, size) }, transform = { NotificationMapper.toGetReceivedNotificationListResponse(it!!) }, ) + override suspend fun getHasUnreadNotification(): Result = + apiCall( + tag = this.tag, + apiFunction = { notificationApi.getHasUnreadNotification() }, + transform = { NotificationMapper.toGetHasUnreadNotificationResponse(it!!) }, + ) + override suspend fun getReceivedNotification(notificationId: Long): Result = apiCall( tag = this.tag, @@ -32,10 +43,10 @@ class NotificationRepositoryImpl transform = { NotificationMapper.toGetReceivedNotificationResponse(it!!) }, ) - override suspend fun deleteReceivedNotification(notificationId: Long): Result = - apiCall( + override suspend fun deleteNotification(notificationId: Long): Result = + apiCallWithFullResponse( tag = this.tag, - apiFunction = { notificationApi.deleteReceivedNotification(notificationId) }, - transform = { NotificationMapper.toDeleteReceivedNotificationResponse(it!!) }, + apiFunction = { notificationApi.deleteNotification(notificationId) }, + transform = { it.code() }, ) } diff --git a/CatchMate/data/src/main/java/com/catchmate/data/repository/SupportRepositoryImpl.kt b/CatchMate/data/src/main/java/com/catchmate/data/repository/SupportRepositoryImpl.kt index 5be07238..9d0bdad2 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/repository/SupportRepositoryImpl.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/repository/SupportRepositoryImpl.kt @@ -36,20 +36,20 @@ class SupportRepositoryImpl transform = { SupportMapper.toPostInquiryResponse(it!!) }, ) - override suspend fun portUserReport( - reportedUserId: Long, - request: PostUserReportRequest, - ): Result = + override suspend fun postUserReport(request: PostUserReportRequest): Result = apiCall( tag = this.tag, - apiFunction = { supportApi.postUserReport(reportedUserId, SupportMapper.toPostUserReportRequestDTO(request)) }, + apiFunction = { supportApi.postUserReport(SupportMapper.toPostUserReportRequestDTO(request)) }, transform = { SupportMapper.toPostUserReportResponse(it!!) }, ) - override suspend fun getNoticeList(page: Int): Result = + override suspend fun getNoticeList( + page: Int, + size: Int, + ): Result = apiCall( tag = this.tag, - apiFunction = { supportApi.getNoticeList(page) }, + apiFunction = { supportApi.getNoticeList(page, size) }, transform = { SupportMapper.toGetNoticeListResponse(it!!) }, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/repository/UserRepositoryImpl.kt b/CatchMate/data/src/main/java/com/catchmate/data/repository/UserRepositoryImpl.kt index ce089f3e..f2ab4f6a 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/repository/UserRepositoryImpl.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/repository/UserRepositoryImpl.kt @@ -4,13 +4,14 @@ import com.catchmate.data.datasource.remote.RetrofitClient import com.catchmate.data.datasource.remote.UserService import com.catchmate.data.mapper.UserMapper import com.catchmate.data.mapper.UserMapper.toGetCheckNicknameResponse +import com.catchmate.data.mapper.UserMapper.toGetUserAlarmStateResponse import com.catchmate.data.util.ApiResponseHandleUtil.apiCall import com.catchmate.domain.exception.UserBlockFailureException import com.catchmate.domain.model.user.DeleteBlockedUserResponse import com.catchmate.domain.model.user.DeleteUserAccountResponse import com.catchmate.domain.model.user.GetBlockedUserListResponse import com.catchmate.domain.model.user.GetCheckNicknameResponse -import com.catchmate.domain.model.user.GetUnreadInfoResponse +import com.catchmate.domain.model.user.GetUserAlarmResponse import com.catchmate.domain.model.user.GetUserProfileByIdResponse import com.catchmate.domain.model.user.GetUserProfileResponse import com.catchmate.domain.model.user.PatchUserAlarmResponse @@ -52,24 +53,27 @@ class UserRepositoryImpl transform = { UserMapper.toGetUserProfileByIdResponse(it!!) }, ) - override suspend fun getBlockedUserList(page: Int): Result = + override suspend fun getBlockedUserList( + page: Int, + size: Int, + ): Result = apiCall( tag = this.tag, - apiFunction = { userApi.getBlockedUserList(page) }, + apiFunction = { userApi.getBlockedUserList(page, size) }, transform = { UserMapper.toGetBlockedUserListResponse(it!!) }, ) - override suspend fun getUnreadInfo(): Result = + override suspend fun getUserAlarmState(): Result = apiCall( tag = this.tag, - apiFunction = { userApi.getUnreadInfo() }, - transform = { UserMapper.toGetUnreadInfoResponse(it!!) }, + apiFunction = { userApi.getUserAlarmState() }, + transform = { toGetUserAlarmStateResponse(it!!) }, ) - override suspend fun postUserBlock(blockedUserId: Long): Result = + override suspend fun postUserBlock(targetUserId: Long): Result = apiCall( tag = this.tag, - apiFunction = { userApi.postUserBlock(blockedUserId) }, + apiFunction = { userApi.postUserBlock(targetUserId) }, transform = { UserMapper.toPostUserBlockResponse(it!!) }, errorHandler = { response, jsonObject -> if (response.code() == 400) { @@ -117,10 +121,10 @@ class UserRepositoryImpl transform = { UserMapper.toPatchUserAlarmResponse(it!!) }, ) - override suspend fun deleteBlockedUser(blockedUserId: Long): Result = + override suspend fun deleteBlockedUser(targetUserId: Long): Result = apiCall( tag = this.tag, - apiFunction = { userApi.deleteBlockedUser(blockedUserId) }, + apiFunction = { userApi.deleteBlockedUser(targetUserId) }, transform = { UserMapper.toDeleteBlockedUserResponse(it!!) }, ) diff --git a/CatchMate/data/src/main/java/com/catchmate/data/util/ApiResponseHandleUtil.kt b/CatchMate/data/src/main/java/com/catchmate/data/util/ApiResponseHandleUtil.kt index 7ac610a0..fe1f1855 100644 --- a/CatchMate/data/src/main/java/com/catchmate/data/util/ApiResponseHandleUtil.kt +++ b/CatchMate/data/src/main/java/com/catchmate/data/util/ApiResponseHandleUtil.kt @@ -36,4 +36,36 @@ object ApiResponseHandleUtil { } catch (e: Exception) { Result.failure(e) } + + private fun Response.handleApiFullResponse( + transform: (Response) -> R, + errorHandler: (Response, JSONObject) -> Exception, + ): Result = + try { + if (isSuccessful) { + Result.success(transform(this)) + } else { + val errorJson = JSONObject(errorBody()?.string() ?: "") + Result.failure(errorHandler(this, errorJson)) + } + } catch (e: ReissueFailureException) { + Result.failure(e) + } catch (e: Exception) { + Result.failure(e) + } + + suspend fun apiCallWithFullResponse( + tag: String, + apiFunction: suspend () -> Response, + transform: (Response) -> R, + errorHandler: (Response, JSONObject) -> Exception = + { response, json -> + Exception("$tag 통신 실패: ${response.code()} - $json") + }, + ): Result = + try { + apiFunction().handleApiFullResponse(transform, errorHandler) + } catch (e: Exception) { + Result.failure(e) + } } diff --git a/CatchMate/domain/build.gradle.kts b/CatchMate/domain/build.gradle.kts index 10595b2e..1a000358 100644 --- a/CatchMate/domain/build.gradle.kts +++ b/CatchMate/domain/build.gradle.kts @@ -5,6 +5,9 @@ plugins { android { namespace = "com.catchmate.domain" + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } } dependencies { diff --git a/CatchMate/domain/consumer-rules.pro b/CatchMate/domain/consumer-rules.pro new file mode 100644 index 00000000..dd3a5b43 --- /dev/null +++ b/CatchMate/domain/consumer-rules.pro @@ -0,0 +1,5 @@ +# Java 9+ 문자열 최적화 관련 경고 무시 (Kotlin 2.0 대응) +-dontwarn java.lang.invoke.StringConcatFactory + +# Domain 모델 보존 +-keep class com.catchmate.domain.model.** { *; } \ No newline at end of file diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/BoardMode.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/BoardMode.kt new file mode 100644 index 00000000..8113ecf7 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/BoardMode.kt @@ -0,0 +1,19 @@ +package com.catchmate.domain.model.board + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +sealed class BoardMode : Parcelable { + @Parcelize + object New : BoardMode() // 새 게시글 등록 + + @Parcelize + data class Temp( + val boardId: Long, + ) : BoardMode() // 임시저장 불러오기 + + @Parcelize + data class Edit( + val boardInfo: GetBoardResponse, + ) : BoardMode() // 기존 게시글 수정 +} diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetBoardResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetBoardResponse.kt index 1eb6c3c9..dd88ac28 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetBoardResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetBoardResponse.kt @@ -18,7 +18,8 @@ data class GetBoardResponse( val liftUpDate: String, val bookMarked: Boolean, val buttonStatus: String, - val chatRoomId: Long?, + val myEnrollId: Long, + val chatRoomId: Long, val cheerClub: Club, val game: GameInfo, val user: UserInfo, diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetUserBoardListResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetUserBoardListResponse.kt index 07fd152b..e2ab2eb6 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetUserBoardListResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/GetUserBoardListResponse.kt @@ -1,9 +1,9 @@ package com.catchmate.domain.model.board data class GetUserBoardListResponse( - val boardInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardRequest.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardRequest.kt index e37a7618..38a02f9c 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardRequest.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardRequest.kt @@ -1,7 +1,6 @@ package com.catchmate.domain.model.board data class PostBoardRequest( - val boardId: Long? = null, val title: String?, val content: String?, val maxPerson: Int?, @@ -9,5 +8,5 @@ data class PostBoardRequest( val preferredGender: String?, val preferredAgeRange: List?, val completed: Boolean, - val gameRequest: GameRequest?, + val gameCreateRequest: GameRequest?, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardResponse.kt index e29add87..0c74e493 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PostBoardResponse.kt @@ -1,17 +1,6 @@ package com.catchmate.domain.model.board -import com.catchmate.domain.model.enroll.GameInfo -import com.catchmate.domain.model.enroll.UserInfo -import com.catchmate.domain.model.user.Club - data class PostBoardResponse( val boardId: Long, - val title: String, - val content: String, - val currentPerson: Int, - val maxPerson: Int, - val bookMarked: Boolean, - val cheerClub: Club, - val gameResponse: GameInfo, - val userResponse: UserInfo, + val createdAt: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardRequest.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardRequest.kt index 535927ea..7285182f 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardRequest.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardRequest.kt @@ -8,5 +8,5 @@ data class PutBoardRequest( val preferredGender: String?, val preferredAgeRange: List?, val completed: Boolean, - val gameRequest: GameRequest, + val gameUpdateRequest: GameRequest, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardResponse.kt index 03dac49c..ce4bf258 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/board/PutBoardResponse.kt @@ -1,20 +1,6 @@ package com.catchmate.domain.model.board -import android.os.Parcelable -import com.catchmate.domain.model.enroll.GameInfo -import com.catchmate.domain.model.enroll.UserInfo -import com.catchmate.domain.model.user.Club -import kotlinx.parcelize.Parcelize - -@Parcelize data class PutBoardResponse( val boardId: Long, - val title: String, - val content: String, - val currentPerson: Int, - val maxPerson: Int, - val bookMarked: Boolean, - val cheerClub: Club, - val gameResponse: GameInfo, - val userResponse: UserInfo, -) : Parcelable + val createdAt: String, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/ChatRoomInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/ChatRoomInfo.kt index e63c852d..a21c26eb 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/ChatRoomInfo.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/ChatRoomInfo.kt @@ -4,12 +4,7 @@ import com.catchmate.domain.model.board.Board data class ChatRoomInfo( val chatRoomId: Long, - val boardInfo: Board, - val participantCount: Int, - val lastMessageAt: String?, - val lastMessageContent: String?, - val chatRoomImage: String, - val unreadMessageCount: Int, - val isNewChatRoom: Boolean, - val isNotificationEnabled: Boolean, + val board: Board, + val lastMessage: LastMessageInfo?, + val createdAt: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/GetChattingRoomListResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/GetChattingRoomListResponse.kt index cc6071b4..2467a814 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/GetChattingRoomListResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/GetChattingRoomListResponse.kt @@ -1,9 +1,9 @@ package com.catchmate.domain.model.chatting data class GetChattingRoomListResponse( - val chatRoomInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/LastMessageInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/LastMessageInfo.kt new file mode 100644 index 00000000..55c88a63 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/chatting/LastMessageInfo.kt @@ -0,0 +1,12 @@ +package com.catchmate.domain.model.chatting + +data class LastMessageInfo( + val messageId: Long, + val chatRoomId: Long, + val senderId: Long, + val senderNickName: String, + val senderProfileImageUrl: String, + val content: String, + val messageType: String, + val createdAt: String, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/AllReceivedEnrollInfoResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/AllReceivedEnrollInfoResponse.kt index bd4c41a6..eb06b319 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/AllReceivedEnrollInfoResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/AllReceivedEnrollInfoResponse.kt @@ -1,6 +1,6 @@ package com.catchmate.domain.model.enroll data class AllReceivedEnrollInfoResponse( - val boardInfo: EnrollBoardInfo, - val enrollReceiveInfoList: List, + val boardResponse: EnrollBoardInfo, + val enrollResponses: List, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollBoardInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollBoardInfo.kt index 290fc865..81e99c33 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollBoardInfo.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollBoardInfo.kt @@ -1,18 +1,15 @@ package com.catchmate.domain.model.enroll +import com.catchmate.domain.model.user.Club + data class EnrollBoardInfo( val boardId: Long, val title: String, val content: String, - val cheerClubId: Int, val currentPerson: Int, val maxPerson: Int, - val preferredGender: String, - val preferredAgeRange: String, - val liftUpDate: String, - val gameInfo: GameInfo, - val userInfo: UserInfo, - val buttonStatus: String?, - val chatRoomId: Long, val bookMarked: Boolean, + val cheerClub: Club, + val gameResponse: GameInfo, + val userResponse: UserInfo, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollInfo.kt index 577fc3c9..35434390 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollInfo.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollInfo.kt @@ -5,6 +5,5 @@ data class EnrollInfo( val acceptStatus: String, val description: String, val requestDate: String, - val userInfo: UserInfo, - val boardInfo: EnrollBoardInfo, + val boardResponse: EnrollBoardInfo, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollUserInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollUserInfo.kt new file mode 100644 index 00000000..9872c21c --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/EnrollUserInfo.kt @@ -0,0 +1,11 @@ +package com.catchmate.domain.model.enroll + +data class EnrollUserInfo( + val userId: Long, + val nickname: String, + val profileImageUrl: String, + val gender: String, + val ageRange: String, + val favoriteClub: String, + val watchStyle: String?, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetAllReceivedEnrollResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetAllReceivedEnrollResponse.kt index c731a5a5..b79973bf 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetAllReceivedEnrollResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetAllReceivedEnrollResponse.kt @@ -1,9 +1,9 @@ package com.catchmate.domain.model.enroll data class GetAllReceivedEnrollResponse( - val enrollInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetEnrollNewCountResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetEnrollNewCountResponse.kt index 2e72b2a6..7c67ab92 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetEnrollNewCountResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetEnrollNewCountResponse.kt @@ -1,5 +1,5 @@ package com.catchmate.domain.model.enroll data class GetEnrollNewCountResponse( - val newEnrollCount: Int, + val count: Int, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetEnrollResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetEnrollResponse.kt new file mode 100644 index 00000000..c03b3050 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetEnrollResponse.kt @@ -0,0 +1,12 @@ +package com.catchmate.domain.model.enroll + +import com.catchmate.domain.model.board.Board + +data class GetEnrollResponse( + val enrollId: Long, + val acceptStatus: String, + val description: String, + val requestDate: String, + val applicant: UserInfo, + val boardResponse: Board, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetReceivedEnrollResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetReceivedEnrollResponse.kt index 52926860..73743794 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetReceivedEnrollResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetReceivedEnrollResponse.kt @@ -1,9 +1,9 @@ package com.catchmate.domain.model.enroll data class GetReceivedEnrollResponse( - val enrollInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetRequestedEnrollListResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetRequestedEnrollListResponse.kt index 0330cf2f..0cbd762f 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetRequestedEnrollListResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetRequestedEnrollListResponse.kt @@ -1,9 +1,9 @@ package com.catchmate.domain.model.enroll data class GetRequestedEnrollListResponse( - val enrollInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetRequestedEnrollResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetRequestedEnrollResponse.kt deleted file mode 100644 index 35e29c94..00000000 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/GetRequestedEnrollResponse.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.catchmate.domain.model.enroll - -data class GetRequestedEnrollResponse( - val enrollId: Long, - val description: String, -) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollAcceptResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollAcceptResponse.kt index ae792017..67fe76a8 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollAcceptResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollAcceptResponse.kt @@ -2,5 +2,5 @@ package com.catchmate.domain.model.enroll data class PatchEnrollAcceptResponse( val enrollId: Long, - val acceptStatus: String, + val message: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollRejectResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollRejectResponse.kt index 44342b68..347c8380 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollRejectResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/PatchEnrollRejectResponse.kt @@ -2,5 +2,5 @@ package com.catchmate.domain.model.enroll data class PatchEnrollRejectResponse( val enrollId: Long, - val acceptStatus: String, + val message: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfo.kt index 146dc04a..d8545cde 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfo.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfo.kt @@ -2,9 +2,8 @@ package com.catchmate.domain.model.enroll data class ReceivedEnrollInfo( val enrollId: Long, - val acceptStatus: String, val description: String, + val newEnroll: Boolean, val requestDate: String, - val userInfo: UserInfo, - val new: Boolean, + val applicant: EnrollUserInfo, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfoResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfoResponse.kt index 2997b980..68fc0d71 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfoResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enroll/ReceivedEnrollInfoResponse.kt @@ -1,5 +1,9 @@ package com.catchmate.domain.model.enroll data class ReceivedEnrollInfoResponse( - val enrollReceiveInfoList: List, + val enrollId: Long, + val description: String, + val requestDate: String, + val newEnroll: Boolean, + val applicantResponse: EnrollUserInfo, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enumclass/EnrollState.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enumclass/EnrollState.kt index 26046b15..e8e47cc9 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/enumclass/EnrollState.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/enumclass/EnrollState.kt @@ -1,7 +1,8 @@ package com.catchmate.domain.model.enumclass enum class EnrollState { - APPLY, // 신청 가능 - APPLIED, // 신청 보냄 - VIEW_CHAT, // 채팅 보기 + APPLY, // 신청 내역이 없는 경우 + CANCEL, // 신청 상태가 PENDING 인 경우 + VIEW_CHAT, // 사용자가 작성자일 경우, 신청 상태가 ACCEPTED 인 경우 + REJECTED, // 신청 상태가 REJECTED 인 경우 } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetHasUnreadNotificationResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetHasUnreadNotificationResponse.kt new file mode 100644 index 00000000..c3c85df3 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetHasUnreadNotificationResponse.kt @@ -0,0 +1,5 @@ +package com.catchmate.domain.model.notification + +data class GetHasUnreadNotificationResponse( + val hasUnread: Boolean, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetNotificationListResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetNotificationListResponse.kt new file mode 100644 index 00000000..6c30626f --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetNotificationListResponse.kt @@ -0,0 +1,9 @@ +package com.catchmate.domain.model.notification + +data class GetNotificationListResponse( + val content: List, + val pageNumber: Int, + val totalPages: Int, + val totalElements: Int, + val hasNext: Boolean, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetReceivedNotificationListResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetReceivedNotificationListResponse.kt deleted file mode 100644 index 9add6fce..00000000 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/GetReceivedNotificationListResponse.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.catchmate.domain.model.notification - -data class GetReceivedNotificationListResponse( - val notificationInfoList: List, - val totalPages: Int, - val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, -) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/NotificationInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/NotificationInfo.kt index f5cc34d8..d24dad77 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/NotificationInfo.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/notification/NotificationInfo.kt @@ -1,15 +1,11 @@ package com.catchmate.domain.model.notification -import com.catchmate.domain.model.board.Board - data class NotificationInfo( - val notificationId: Long, - val boardInfo: Board?, - val inquiryInfo: Inquiry?, - val senderProfileImageUrl: String?, + val id: Long, val title: String, - val body: String, - val createdAt: String, - val acceptStatus: String?, + val alarmType: String, var read: Boolean, + val createdAt: String, + val senderProfileImageUrl: String?, + val gameInfo: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/AdminUserInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/AdminUserInfo.kt deleted file mode 100644 index 63c8cbb8..00000000 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/AdminUserInfo.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.catchmate.domain.model.support - -import com.catchmate.domain.model.user.Club - -data class AdminUserInfo( - val userId: Long, - val profileImageUrl: String, - val nickName: String, - val clubInfo: Club, - val gender: String, - val email: String, - val socialType: String, - val joinedAt: String, -) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetInquiryResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetInquiryResponse.kt index f8a841ed..26760d9c 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetInquiryResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetInquiryResponse.kt @@ -2,10 +2,10 @@ package com.catchmate.domain.model.support data class GetInquiryResponse( val inquiryId: Long, - val inquiryType: String, + val nickname: String, + val type: String, val content: String, - val nickName: String, val answer: String, - val isCompleted: Boolean, + val status: String, val createdAt: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetNoticeListResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetNoticeListResponse.kt index c85bfa94..256b15e0 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetNoticeListResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/GetNoticeListResponse.kt @@ -1,9 +1,9 @@ package com.catchmate.domain.model.support data class GetNoticeListResponse( - val noticeInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/NoticeInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/NoticeInfo.kt index a81f6905..2b92a1b9 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/NoticeInfo.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/NoticeInfo.kt @@ -4,7 +4,6 @@ data class NoticeInfo( val noticeId: Long, val title: String, val content: String, - val userInfo: AdminUserInfo, + val writerNickname: String, val createdAt: String, - val updatedAt: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/NoticeListInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/NoticeListInfo.kt new file mode 100644 index 00000000..2d97eddd --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/NoticeListInfo.kt @@ -0,0 +1,8 @@ +package com.catchmate.domain.model.support + +data class NoticeListInfo( + val noticeId: Long, + val title: String, + val writerNickname: String, + val createdAt: String, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryRequest.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryRequest.kt index fd1aef42..f6c45891 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryRequest.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryRequest.kt @@ -1,6 +1,6 @@ package com.catchmate.domain.model.support data class PostInquiryRequest( - val inquiryType: String, + val type: String, val content: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryResponse.kt index 87084f7b..c732f2d7 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostInquiryResponse.kt @@ -1,5 +1,6 @@ package com.catchmate.domain.model.support data class PostInquiryResponse( - val state: Boolean, + val inquiryId: Long, + val createdAt: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportRequest.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportRequest.kt index 1a198d08..44e45455 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportRequest.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportRequest.kt @@ -1,6 +1,7 @@ package com.catchmate.domain.model.support data class PostUserReportRequest( - val reportType: String, - val content: String, + val reportedUserId: Long, + val reason: String, + val description: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportResponse.kt index 28478709..4c92b0fd 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/support/PostUserReportResponse.kt @@ -1,5 +1,6 @@ package com.catchmate.domain.model.support data class PostUserReportResponse( - val state: Boolean, + val reportId: Long, + val createdAt: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/BlockedUserInfo.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/BlockedUserInfo.kt new file mode 100644 index 00000000..632fe570 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/BlockedUserInfo.kt @@ -0,0 +1,9 @@ +package com.catchmate.domain.model.user + +data class BlockedUserInfo( + val blockId: Long, + val userId: Long, + val nickName: String, + val profileImageUrl: String, + val blockedAt: String?, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/DeleteBlockedUserResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/DeleteBlockedUserResponse.kt index 718ab220..a7c77424 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/DeleteBlockedUserResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/DeleteBlockedUserResponse.kt @@ -1,5 +1,6 @@ package com.catchmate.domain.model.user data class DeleteBlockedUserResponse( - val state: Boolean, + val targetUserId: Long, + val message: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetBlockedUserListResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetBlockedUserListResponse.kt index 95f596da..0c46a913 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetBlockedUserListResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetBlockedUserListResponse.kt @@ -1,9 +1,9 @@ package com.catchmate.domain.model.user data class GetBlockedUserListResponse( - val userInfoList: List, + val content: List, + val pageNumber: Int, val totalPages: Int, val totalElements: Int, - val isFirst: Boolean, - val isLast: Boolean, + val hasNext: Boolean, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUnreadInfoResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUnreadInfoResponse.kt deleted file mode 100644 index f21fe249..00000000 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUnreadInfoResponse.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.catchmate.domain.model.user - -data class GetUnreadInfoResponse( - val hasUnreadChat: Boolean, - val hasUnreadNotification: Boolean, -) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUserAlarmResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUserAlarmResponse.kt new file mode 100644 index 00000000..ce1f1f21 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUserAlarmResponse.kt @@ -0,0 +1,8 @@ +package com.catchmate.domain.model.user + +data class GetUserAlarmResponse( + val allAlarm: Boolean, + val chatAlarm: Boolean, + val enrollAlarm: Boolean, + val eventAlarm: Boolean, +) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUserProfileByIdResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUserProfileByIdResponse.kt index ff96b180..40830a85 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUserProfileByIdResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/GetUserProfileByIdResponse.kt @@ -2,15 +2,11 @@ package com.catchmate.domain.model.user data class GetUserProfileByIdResponse( val userId: Long, + val nickName: String, val email: String, val profileImageUrl: String, val gender: String, - val allAlarm: String, - val chatAlarm: String, - val enrollAlarm: String, - val eventAlarm: String, - val nickName: String, - val favoriteClub: Club, val birthDate: String, - val watchStyle: String, + val watchStyle: String?, + val club: Club, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PatchUserProfileResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PatchUserProfileResponse.kt index ec7669d9..f1d3fd02 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PatchUserProfileResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PatchUserProfileResponse.kt @@ -1,5 +1,18 @@ package com.catchmate.domain.model.user +import java.io.Serializable + data class PatchUserProfileResponse( - val state: Boolean, -) + val userId: Long, + val email: String, + val profileImageUrl: String, + val gender: String, + val allAlarm: String, + val chatAlarm: String, + val enrollAlarm: String, + val eventAlarm: String, + val nickName: String, + val club: Club, + val birthDate: String, + val watchStyle: String?, +) : Serializable diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PostUserBlockResponse.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PostUserBlockResponse.kt index 6ea9d312..0e3e9425 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PostUserBlockResponse.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/model/user/PostUserBlockResponse.kt @@ -1,5 +1,6 @@ package com.catchmate.domain.model.user data class PostUserBlockResponse( - val state: Boolean, + val targetUserId: Long, + val message: String, ) diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/BoardRepository.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/BoardRepository.kt index e34b5c42..0a6620d6 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/BoardRepository.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/BoardRepository.kt @@ -34,6 +34,7 @@ interface BoardRepository { suspend fun getUserBoardList( userId: Long, page: Int, + size: Int, ): Result suspend fun getBoard(boardId: Long): Result diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/ChattingRepository.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/ChattingRepository.kt index 474d213c..08ffd9b6 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/ChattingRepository.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/ChattingRepository.kt @@ -11,7 +11,10 @@ import com.catchmate.domain.model.chatting.PutChattingRoomAlarmResponse import okhttp3.MultipartBody interface ChattingRepository { - suspend fun getChattingRoomList(page: Int): Result + suspend fun getChattingRoomList( + page: Int, + size: Int, + ): Result suspend fun getChattingCrewList(chatRoomId: Long): Result diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/EnrollRepository.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/EnrollRepository.kt index 178b3188..5ba9ffe8 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/EnrollRepository.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/EnrollRepository.kt @@ -3,9 +3,9 @@ package com.catchmate.domain.repository import com.catchmate.domain.model.enroll.DeleteEnrollResponse import com.catchmate.domain.model.enroll.GetAllReceivedEnrollResponse import com.catchmate.domain.model.enroll.GetEnrollNewCountResponse +import com.catchmate.domain.model.enroll.GetEnrollResponse import com.catchmate.domain.model.enroll.GetReceivedEnrollResponse import com.catchmate.domain.model.enroll.GetRequestedEnrollListResponse -import com.catchmate.domain.model.enroll.GetRequestedEnrollResponse import com.catchmate.domain.model.enroll.PatchEnrollAcceptResponse import com.catchmate.domain.model.enroll.PatchEnrollRejectResponse import com.catchmate.domain.model.enroll.PostEnrollRequest @@ -21,13 +21,23 @@ interface EnrollRepository { suspend fun patchEnrollAccept(enrollId: Long): Result - suspend fun getRequestedEnroll(boardId: Long): Result + suspend fun getEnroll(enrollId: Long): Result - suspend fun getRequestedEnrollList(page: Int): Result + suspend fun getRequestedEnrollList( + page: Int, + size: Int, + ): Result - suspend fun getReceivedEnroll(boardId: Long): Result - - suspend fun getAllReceivedEnroll(page: Int): Result + suspend fun getReceivedEnroll( + boardId: Long, + page: Int, + size: Int, + ): Result + + suspend fun getAllReceivedEnroll( + page: Int, + size: Int, + ): Result suspend fun getEnrollNewCount(): Result diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/NotificationRepository.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/NotificationRepository.kt index f522bd6c..d1c940e5 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/NotificationRepository.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/NotificationRepository.kt @@ -1,15 +1,20 @@ package com.catchmate.domain.repository -import com.catchmate.domain.model.notification.DeleteReceivedNotificationResponse -import com.catchmate.domain.model.notification.GetReceivedNotificationListResponse +import com.catchmate.domain.model.notification.GetHasUnreadNotificationResponse +import com.catchmate.domain.model.notification.GetNotificationListResponse import com.catchmate.domain.model.notification.GetReceivedNotificationResponse interface NotificationRepository { // 받은 알림 목록 get - suspend fun getReceivedNotificationList(page: Int): Result + suspend fun getNotificationList( + page: Int, + size: Int, + ): Result + + suspend fun getHasUnreadNotification(): Result // 알림 상세 get suspend fun getReceivedNotification(notificationId: Long): Result - suspend fun deleteReceivedNotification(notificationId: Long): Result + suspend fun deleteNotification(notificationId: Long): Result } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/SupportRepository.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/SupportRepository.kt index f0aca5b0..0d162fbe 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/SupportRepository.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/SupportRepository.kt @@ -13,12 +13,12 @@ interface SupportRepository { suspend fun postInquiry(request: PostInquiryRequest): Result - suspend fun portUserReport( - reportedUserId: Long, - request: PostUserReportRequest, - ): Result + suspend fun postUserReport(request: PostUserReportRequest): Result - suspend fun getNoticeList(page: Int): Result + suspend fun getNoticeList( + page: Int, + size: Int, + ): Result suspend fun getNoticeDetail(noticeId: Long): Result } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/UserRepository.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/UserRepository.kt index c9c37edd..7109e250 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/repository/UserRepository.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/repository/UserRepository.kt @@ -4,7 +4,7 @@ import com.catchmate.domain.model.user.DeleteBlockedUserResponse import com.catchmate.domain.model.user.DeleteUserAccountResponse import com.catchmate.domain.model.user.GetBlockedUserListResponse import com.catchmate.domain.model.user.GetCheckNicknameResponse -import com.catchmate.domain.model.user.GetUnreadInfoResponse +import com.catchmate.domain.model.user.GetUserAlarmResponse import com.catchmate.domain.model.user.GetUserProfileByIdResponse import com.catchmate.domain.model.user.GetUserProfileResponse import com.catchmate.domain.model.user.PatchUserAlarmResponse @@ -22,11 +22,14 @@ interface UserRepository { suspend fun getUserProfileById(profileUserId: Long): Result - suspend fun getBlockedUserList(page: Int): Result + suspend fun getBlockedUserList( + page: Int, + size: Int, + ): Result - suspend fun getUnreadInfo(): Result + suspend fun getUserAlarmState(): Result - suspend fun postUserBlock(blockedUserId: Long): Result + suspend fun postUserBlock(targetUserId: Long): Result suspend fun postUserAdditionalInfo(postUserAdditionalInfoRequest: PostUserAdditionalInfoRequest): Result diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/board/GetUserBoardListUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/board/GetUserBoardListUseCase.kt index b41e4856..2c6c7ca8 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/board/GetUserBoardListUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/board/GetUserBoardListUseCase.kt @@ -12,5 +12,6 @@ class GetUserBoardListUseCase suspend fun getUserBoardList( userId: Long, page: Int, - ): Result = boardRepository.getUserBoardList(userId, page) + size: Int, + ): Result = boardRepository.getUserBoardList(userId, page, size) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/chatting/GetChattingRoomListUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/chatting/GetChattingRoomListUseCase.kt index 69a5e387..78f04cc7 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/chatting/GetChattingRoomListUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/chatting/GetChattingRoomListUseCase.kt @@ -9,5 +9,8 @@ class GetChattingRoomListUseCase constructor( private val chattingRepository: ChattingRepository, ) { - suspend fun getChattingRoomList(page: Int): Result = chattingRepository.getChattingRoomList(page) + suspend fun getChattingRoomList( + page: Int, + size: Int, + ): Result = chattingRepository.getChattingRoomList(page, size) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetAllReceivedEnrollUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetAllReceivedEnrollUseCase.kt index bf1630a2..ffcaa287 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetAllReceivedEnrollUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetAllReceivedEnrollUseCase.kt @@ -9,5 +9,8 @@ class GetAllReceivedEnrollUseCase constructor( private val enrollRepository: EnrollRepository, ) { - suspend fun getAllReceivedEnroll(page: Int): Result = enrollRepository.getAllReceivedEnroll(page) + suspend fun getAllReceivedEnroll( + page: Int, + size: Int, + ): Result = enrollRepository.getAllReceivedEnroll(page, size) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetEnrollUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetEnrollUseCase.kt new file mode 100644 index 00000000..272db9f2 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetEnrollUseCase.kt @@ -0,0 +1,13 @@ +package com.catchmate.domain.usecase.enroll + +import com.catchmate.domain.model.enroll.GetEnrollResponse +import com.catchmate.domain.repository.EnrollRepository +import javax.inject.Inject + +class GetEnrollUseCase + @Inject + constructor( + private val enrollRepository: EnrollRepository, + ) { + suspend operator fun invoke(enrollId: Long): Result = enrollRepository.getEnroll(enrollId) + } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetReceivedEnrollUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetReceivedEnrollUseCase.kt index dcc9e79f..a37a26f0 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetReceivedEnrollUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetReceivedEnrollUseCase.kt @@ -9,5 +9,9 @@ class GetReceivedEnrollUseCase constructor( private val enrollRepository: EnrollRepository, ) { - suspend fun getReceivedEnroll(boardId: Long): Result = enrollRepository.getReceivedEnroll(boardId) + suspend fun getReceivedEnroll( + boardId: Long, + page: Int, + size: Int, + ): Result = enrollRepository.getReceivedEnroll(boardId, page, size) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetRequestedEnrollListUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetRequestedEnrollListUseCase.kt index 88140b7d..d1edeb46 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetRequestedEnrollListUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetRequestedEnrollListUseCase.kt @@ -9,6 +9,8 @@ class GetRequestedEnrollListUseCase constructor( private val enrollRepository: EnrollRepository, ) { - suspend fun getRequestedEnrollList(page: Int): Result = - enrollRepository.getRequestedEnrollList(page) + suspend fun getRequestedEnrollList( + page: Int, + size: Int, + ): Result = enrollRepository.getRequestedEnrollList(page, size) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetRequestedEnrollUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetRequestedEnrollUseCase.kt deleted file mode 100644 index 2a4c3c8c..00000000 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/enroll/GetRequestedEnrollUseCase.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.catchmate.domain.usecase.enroll - -import com.catchmate.domain.model.enroll.GetRequestedEnrollResponse -import com.catchmate.domain.repository.EnrollRepository -import javax.inject.Inject - -class GetRequestedEnrollUseCase - @Inject - constructor( - private val enrollRepository: EnrollRepository, - ) { - suspend operator fun invoke(boardId: Long): Result = enrollRepository.getRequestedEnroll(boardId) - } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/DeleteNotificationUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/DeleteNotificationUseCase.kt new file mode 100644 index 00000000..cd832314 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/DeleteNotificationUseCase.kt @@ -0,0 +1,12 @@ +package com.catchmate.domain.usecase.notification + +import com.catchmate.domain.repository.NotificationRepository +import javax.inject.Inject + +class DeleteNotificationUseCase + @Inject + constructor( + private val notificationRepository: NotificationRepository, + ) { + suspend operator fun invoke(notificationId: Long): Result = notificationRepository.deleteNotification(notificationId) + } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/DeleteReceivedNotificationUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/DeleteReceivedNotificationUseCase.kt deleted file mode 100644 index fe8006b1..00000000 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/DeleteReceivedNotificationUseCase.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.catchmate.domain.usecase.notification - -import com.catchmate.domain.model.notification.DeleteReceivedNotificationResponse -import com.catchmate.domain.repository.NotificationRepository -import javax.inject.Inject - -class DeleteReceivedNotificationUseCase - @Inject - constructor( - private val notificationRepository: NotificationRepository, - ) { - suspend fun deleteReceivedNotification(notificationId: Long): Result = - notificationRepository.deleteReceivedNotification(notificationId) - } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetHasUnreadNotificationUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetHasUnreadNotificationUseCase.kt new file mode 100644 index 00000000..7dafdddc --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetHasUnreadNotificationUseCase.kt @@ -0,0 +1,13 @@ +package com.catchmate.domain.usecase.notification + +import com.catchmate.domain.model.notification.GetHasUnreadNotificationResponse +import com.catchmate.domain.repository.NotificationRepository +import javax.inject.Inject + +class GetHasUnreadNotificationUseCase + @Inject + constructor( + private val notificationRepository: NotificationRepository, + ) { + suspend operator fun invoke(): Result = notificationRepository.getHasUnreadNotification() + } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetNotificationListUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetNotificationListUseCase.kt new file mode 100644 index 00000000..d2aed030 --- /dev/null +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetNotificationListUseCase.kt @@ -0,0 +1,16 @@ +package com.catchmate.domain.usecase.notification + +import com.catchmate.domain.model.notification.GetNotificationListResponse +import com.catchmate.domain.repository.NotificationRepository +import javax.inject.Inject + +class GetNotificationListUseCase + @Inject + constructor( + private val notificationRepository: NotificationRepository, + ) { + suspend operator fun invoke( + page: Int, + size: Int, + ): Result = notificationRepository.getNotificationList(page, size) + } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetReceivedNotificationListUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetReceivedNotificationListUseCase.kt deleted file mode 100644 index b40fc3b9..00000000 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/notification/GetReceivedNotificationListUseCase.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.catchmate.domain.usecase.notification - -import com.catchmate.domain.model.notification.GetReceivedNotificationListResponse -import com.catchmate.domain.repository.NotificationRepository -import javax.inject.Inject - -class GetReceivedNotificationListUseCase - @Inject - constructor( - private val notificationRepository: NotificationRepository, - ) { - suspend fun getReceivedNotificationList(page: Int): Result = - notificationRepository.getReceivedNotificationList(page) - } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/GetNoticeListUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/GetNoticeListUseCase.kt index 38047b15..06fcbf94 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/GetNoticeListUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/GetNoticeListUseCase.kt @@ -9,5 +9,8 @@ class GetNoticeListUseCase constructor( private val supportRepository: SupportRepository, ) { - suspend operator fun invoke(page: Int): Result = supportRepository.getNoticeList(page) + suspend operator fun invoke( + page: Int, + size: Int, + ): Result = supportRepository.getNoticeList(page, size) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/PostUserReportUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/PostUserReportUseCase.kt index 40eab627..f05c3a1f 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/PostUserReportUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/support/PostUserReportUseCase.kt @@ -10,8 +10,6 @@ class PostUserReportUseCase constructor( private val supportRepository: SupportRepository, ) { - suspend operator fun invoke( - reportedUserId: Long, - request: PostUserReportRequest, - ): Result = supportRepository.portUserReport(reportedUserId, request) + suspend operator fun invoke(request: PostUserReportRequest): Result = + supportRepository.postUserReport(request) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/DeleteBlockedUserUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/DeleteBlockedUserUseCase.kt index 844716fb..6050b224 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/DeleteBlockedUserUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/DeleteBlockedUserUseCase.kt @@ -9,6 +9,5 @@ class DeleteBlockedUserUseCase constructor( private val userRepository: UserRepository, ) { - suspend operator fun invoke(blockedUserId: Long): Result = - userRepository.deleteBlockedUser(blockedUserId) + suspend operator fun invoke(targetUserId: Long): Result = userRepository.deleteBlockedUser(targetUserId) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetBlockedUserListUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetBlockedUserListUseCase.kt index 4f00e51c..6476276b 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetBlockedUserListUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetBlockedUserListUseCase.kt @@ -9,5 +9,8 @@ class GetBlockedUserListUseCase constructor( private val userRepository: UserRepository, ) { - suspend operator fun invoke(page: Int): Result = userRepository.getBlockedUserList(page) + suspend operator fun invoke( + page: Int, + size: Int, + ): Result = userRepository.getBlockedUserList(page, size) } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetUnreadInfoUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetUserAlarmResponseUseCase.kt similarity index 52% rename from CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetUnreadInfoUseCase.kt rename to CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetUserAlarmResponseUseCase.kt index 15003a02..df987257 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetUnreadInfoUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/GetUserAlarmResponseUseCase.kt @@ -1,13 +1,13 @@ package com.catchmate.domain.usecase.user -import com.catchmate.domain.model.user.GetUnreadInfoResponse +import com.catchmate.domain.model.user.GetUserAlarmResponse import com.catchmate.domain.repository.UserRepository import javax.inject.Inject -class GetUnreadInfoUseCase +class GetUserAlarmResponseUseCase @Inject constructor( private val userRepository: UserRepository, ) { - suspend operator fun invoke(): Result = userRepository.getUnreadInfo() + suspend operator fun invoke(): Result = userRepository.getUserAlarmState() } diff --git a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/PostUserBlockUseCase.kt b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/PostUserBlockUseCase.kt index 8120c93c..41761c13 100644 --- a/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/PostUserBlockUseCase.kt +++ b/CatchMate/domain/src/main/java/com/catchmate/domain/usecase/user/PostUserBlockUseCase.kt @@ -9,5 +9,5 @@ class PostUserBlockUseCase constructor( private val userRepository: UserRepository, ) { - suspend operator fun invoke(blockedUserId: Long): Result = userRepository.postUserBlock(blockedUserId) + suspend operator fun invoke(targetUserId: Long): Result = userRepository.postUserBlock(targetUserId) } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/util/DateUtils.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/util/DateUtils.kt index 7b7fdbae..5c11060b 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/util/DateUtils.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/util/DateUtils.kt @@ -173,4 +173,14 @@ object DateUtils { val now = Instant.now() return gameDate.isBefore(now) } + + fun formatNotificationGameInfo(gameInfo: String): Triple { + val list = gameInfo.split("·", "vs").map { it.trim() } // 1: date, 2: region, 3: homeClubName, 4: awayClubName 공백제거 필요 + + val inputDateFormat = SimpleDateFormat("yyyy-MM-dd") + val formattedDate = inputDateFormat.parse(list[0]) + val outputDateFormat = SimpleDateFormat("MM.dd", Locale.KOREAN) + + return Triple(outputDateFormat.format(formattedDate), "", list[1]) + } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/activity/MainActivity.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/activity/MainActivity.kt index 95fafdb2..89fc115b 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/activity/MainActivity.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/activity/MainActivity.kt @@ -67,14 +67,12 @@ class MainActivity : AppCompatActivity() { } initNavController() initBottomNavigationView() - // 채팅 및 알림 뱃지 표시 중단 -// observeChatNotifications() + observeResponse() } - private fun observeChatNotifications() { - mainViewModel.getUnreadInfoResponse.observe(this) { info -> - updateChatBadge(info.hasUnreadChat) - updateHomeNotificationBadge(info.hasUnreadNotification) + private fun observeResponse() { + mainViewModel.getHasUnreadNotificationResponse.observe(this) { response -> + updateHomeNotificationBadge(response.hasUnread) } } @@ -237,7 +235,7 @@ class MainActivity : AppCompatActivity() { } fun refreshNotificationStatus() { - mainViewModel.getUnreadInfo() + mainViewModel.getHasUnreadNotification() } private fun updateHomeNotificationBadge(hasUnreadNotification: Boolean) { diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingHomeFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingHomeFragment.kt index 5a3397e6..9e79a24d 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingHomeFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingHomeFragment.kt @@ -18,7 +18,6 @@ import com.catchmate.presentation.interaction.OnChattingRoomSelectedListener import com.catchmate.presentation.interaction.OnItemSwipeListener import com.catchmate.presentation.interaction.OnListItemAllRemovedListener import com.catchmate.presentation.util.ReissueUtil.NAVIGATE_CODE_REISSUE -import com.catchmate.presentation.view.activity.MainActivity import com.catchmate.presentation.view.base.BaseFragment import com.catchmate.presentation.viewmodel.ChattingHomeViewModel import com.catchmate.presentation.viewmodel.LocalDataViewModel @@ -35,7 +34,7 @@ class ChattingHomeFragment : private val chattingHomeViewModel: ChattingHomeViewModel by viewModels() private val localDataViewModel: LocalDataViewModel by viewModels() private var currentPage: Int = 0 - private var isLastPage = false + private var hasNext = true private var isLoading = false private var isFirstLoad = true private var deletedItemPos: Int = -1 @@ -71,7 +70,7 @@ class ChattingHomeFragment : Log.d("ChattingHomeFragment", "onResume: 채팅방 목록 새로고침") // 페이지 초기화 currentPage = 0 - isLastPage = false + hasNext = true isLoading = false chattingRoomListAdapter.submitList(emptyList()) @@ -95,11 +94,11 @@ class ChattingHomeFragment : private fun initViewModel() { localDataViewModel.accessToken.observe(viewLifecycleOwner) { token -> - chattingHomeViewModel.connectToWebSocket(token) +// chattingHomeViewModel.connectToWebSocket(token) } chattingHomeViewModel.getChattingRoomListResponse.observe(viewLifecycleOwner) { response -> isLoading = false - if (response.isFirst && response.totalElements == 0) { + if (!response.hasNext && response.totalElements == 0) { binding.layoutChattingHomeNoList.visibility = View.VISIBLE binding.rvChattingHome.visibility = View.GONE } else { @@ -107,15 +106,15 @@ class ChattingHomeFragment : binding.layoutChattingHomeNoList.visibility = View.GONE if (currentPage == 0) { // 새 리스트로 교체 - chattingRoomListAdapter.submitList(response.chatRoomInfoList) + chattingRoomListAdapter.submitList(response.content) } else { // 페이징 시 기존 리스트에 추가 val currentList = chattingRoomListAdapter.currentList.toMutableList() - currentList.addAll(response.chatRoomInfoList) + currentList.addAll(response.content) chattingRoomListAdapter.submitList(currentList) } - isLastPage = response.isLast - Log.i("API 응답", "${response.isFirst}, ${response.isLast}, ${response.totalElements}, $currentPage") + hasNext = response.hasNext + Log.i("API 응답", "${response.hasNext}, ${response.totalElements}, $currentPage") } } chattingHomeViewModel.navigateToLogin.observe(viewLifecycleOwner) { isTrue -> @@ -172,7 +171,7 @@ class ChattingHomeFragment : (recyclerView.layoutManager as LinearLayoutManager) .findLastCompletelyVisibleItemPosition() val itemTotalCount = recyclerView.adapter!!.itemCount - if (lastVisibleItemPosition + 1 >= itemTotalCount && !isLastPage && !isLoading) { + if (lastVisibleItemPosition + 1 >= itemTotalCount && hasNext && !isLoading) { currentPage += 1 getChattingRoomList() } @@ -190,7 +189,7 @@ class ChattingHomeFragment : } private fun getChattingRoomList() { - if (isLoading || isLastPage) return + if (isLoading || !hasNext) return isLoading = true chattingHomeViewModel.getChattingRoomList(currentPage) } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomFragment.kt index e4d7a84e..c3197788 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomFragment.kt @@ -99,7 +99,7 @@ class ChattingRoomFragment : BaseFragment(FragmentC } chattingRoomViewModel.chattingRoomInfo.observe(viewLifecycleOwner) { info -> if (info != null) { - isNotificationEnabled = info.isNotificationEnabled +// isNotificationEnabled = info.isNotificationEnabled initChatRoomInfo(info) initHeader(info) } @@ -204,22 +204,22 @@ class ChattingRoomFragment : BaseFragment(FragmentC private fun initChatRoomInfo(info: ChatRoomInfo) { binding.cgivChattingRoom.apply { val isCheerTeam = - info.boardInfo.gameResponse.homeClub - ?.clubId == info.boardInfo.cheerClub.clubId + info.board.gameResponse.homeClub + ?.clubId == info.board.cheerClub.clubId setHomeTeamImageView( - info.boardInfo.gameResponse.homeClub + info.board.gameResponse.homeClub ?.clubId ?: 0, isCheerTeam, ) setAwayTeamImageView( - info.boardInfo.gameResponse.awayClub + info.board.gameResponse.awayClub ?.clubId ?: 0, !isCheerTeam, ) - val (date, time) = formatISODateTime(info.boardInfo.gameResponse.gameStartDate!!) + val (date, time) = formatISODateTime(info.board.gameResponse.gameStartDate!!) setGameDateTextView(date) setGameTimeTextView(time) -// setGamePlaceTextView(info.boardInfo.gameResponse.location) + setGamePlaceTextView(info.board.gameResponse.location!!) } } @@ -285,18 +285,18 @@ class ChattingRoomFragment : BaseFragment(FragmentC sideSheetBinding.apply { // 게시글 정보 - val dateTimePair = formatISODateTime(info.boardInfo.gameResponse.gameStartDate!!) + val dateTimePair = formatISODateTime(info.board.gameResponse.gameStartDate!!) tvSideSheetDate.text = dateTimePair.first tvSideSheetTime.text = dateTimePair.second - tvSideSheetPlace.text = info.boardInfo.gameResponse.location - tvSideSheetCountBadge.text = "${info.participantCount}/${info.boardInfo.maxPerson}" - tvSideSheetTitle.text = info.boardInfo.title + tvSideSheetPlace.text = info.board.gameResponse.location + tvSideSheetCountBadge.text = "${info.board.currentPerson}/${info.board.maxPerson}" + tvSideSheetTitle.text = info.board.title val isCheerTeam = - info.boardInfo.cheerClub.clubId == - info.boardInfo.gameResponse.homeClub + info.board.cheerClub.clubId == + info.board.gameResponse.homeClub ?.clubId setTeamViewResources( - info.boardInfo.gameResponse.homeClub + info.board.gameResponse.homeClub ?.clubId ?: 0, isCheerTeam, ivSideSheetHomeTeam, @@ -305,7 +305,7 @@ class ChattingRoomFragment : BaseFragment(FragmentC requireContext(), ) setTeamViewResources( - info.boardInfo.gameResponse.awayClub + info.board.gameResponse.awayClub ?.clubId ?: 0, !isCheerTeam, ivSideSheetAwayTeam, @@ -315,7 +315,7 @@ class ChattingRoomFragment : BaseFragment(FragmentC ) // 참여자 정보 - var crewAdapter = ChattingCrewListAdapter(userId, info.boardInfo.userResponse.userId, "chattingRoom") + var crewAdapter = ChattingCrewListAdapter(userId, info.board.userResponse.userId, "chattingRoom") rvSideSheetParticipantList.apply { adapter = crewAdapter layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) @@ -327,16 +327,16 @@ class ChattingRoomFragment : BaseFragment(FragmentC sideSheetDialog.dismiss() showChattingRoomLeaveDialog() } - if (userId == info.boardInfo.userResponse.userId) { + if (userId == info.board.userResponse.userId) { ivSideSheetSettings.visibility = View.VISIBLE ivSideSheetSettings.setOnClickListener { // 채팅방 이미지 url, 참여자 목록, 로그인 유저 id, 게시글 작성자 id, 채팅방 id 넘김 val bundle = Bundle().apply { - putString("chattingRoomImage", info.chatRoomImage) +// putString("chattingRoomImage", info.chatRoomImage) putParcelable("chattingCrewList", chattingRoomViewModel.getChattingCrewListResponse.value) putLong("loginUserId", userId) - putLong("writerId", info.boardInfo.userResponse.userId) + putLong("writerId", info.board.userResponse.userId) putLong("chatRoomId", chatRoomId) } findNavController().navigate(R.id.action_chattingRoomFragment_to_chattingSettingFragment, bundle) @@ -356,7 +356,7 @@ class ChattingRoomFragment : BaseFragment(FragmentC bundle.putLong( "boardId", chattingRoomViewModel.chattingRoomInfo.value - ?.boardInfo + ?.board ?.boardId!!, ) findNavController().navigate(R.id.action_chattingRoomFragment_to_readPostFragment, bundle) @@ -369,8 +369,8 @@ class ChattingRoomFragment : BaseFragment(FragmentC imgbtnHeaderMenuBack.setOnClickListener { setOnBackPressedAction() } - tvHeaderMenuTitle.text = info.boardInfo.title - tvHeaderMenuMemberCount.text = info.participantCount.toString() + tvHeaderMenuTitle.text = info.board.title + tvHeaderMenuMemberCount.text = info.board.currentPerson.toString() } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomListAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomListAdapter.kt index 4dd18c6c..2c214b7a 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomListAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/chatting/ChattingRoomListAdapter.kt @@ -47,59 +47,76 @@ class ChattingRoomListAdapter( fun bind(chatRoomInfo: ChatRoomInfo) { binding.apply { root.setOnClickListener { - onChattingRoomSelectedListener.onChattingRoomSelected(chatRoomInfo.chatRoomId, chatRoomInfo.isNewChatRoom) + onChattingRoomSelectedListener.onChattingRoomSelected(chatRoomInfo.chatRoomId, chatRoomInfo.lastMessage == null) } // 채팅방 이미지가 변경된 적 없는 경우 chatRoomImage에 cheerTeamId가 String으로 담겨옴 // 해당 변수를 int로 변환할 때 예외 처리를 통해 변경된 적 있을 경우의 imageUrl을 imageView에 표시 - try { - val clubId = chatRoomInfo.chatRoomImage.toInt() - val logoResource = convertTeamLogo(clubId) - ivChattingItemLogo.visibility = View.VISIBLE - Glide - .with(root.context) - .load(logoResource) - .into(ivChattingItemLogo) - DrawableCompat - .setTint( - ivChattingItemBg.drawable, - convertTeamColor( - root.context, - clubId, - true, - "chattingHome", - ), - ) - } catch (e: Exception) { - ivChattingItemLogo.visibility = View.GONE - Glide - .with(root.context) - .load(chatRoomInfo.chatRoomImage) - .into(ivChattingItemBg) - } +// try { +// val clubId = chatRoomInfo.chatRoomImage.toInt() +// val logoResource = convertTeamLogo(clubId) +// ivChattingItemLogo.visibility = View.VISIBLE +// Glide +// .with(root.context) +// .load(logoResource) +// .into(ivChattingItemLogo) +// DrawableCompat +// .setTint( +// ivChattingItemBg.drawable, +// convertTeamColor( +// root.context, +// clubId, +// true, +// "chattingHome", +// ), +// ) +// } catch (e: Exception) { +// ivChattingItemLogo.visibility = View.GONE +// Glide +// .with(root.context) +// .load(chatRoomInfo.chatRoomImage) +// .into(ivChattingItemBg) +// } + val clubId = chatRoomInfo.board.cheerClub.clubId + val logoResource = convertTeamLogo(clubId) + ivChattingItemLogo.visibility = View.VISIBLE + Glide + .with(root.context) + .load(logoResource) + .into(ivChattingItemLogo) + DrawableCompat + .setTint( + ivChattingItemBg.drawable, + convertTeamColor( + root.context, + clubId, + true, + "chattingHome", + ), + ) - tvChattingItemTitle.text = chatRoomInfo.boardInfo.title - if (chatRoomInfo.isNewChatRoom) { + tvChattingItemTitle.text = chatRoomInfo.board.title + if (chatRoomInfo.lastMessage == null) { tvChattingItemNew.visibility = View.VISIBLE tvChattingItemPeopleCount.visibility = View.GONE } else { tvChattingItemNew.visibility = View.GONE tvChattingItemPeopleCount.visibility = View.VISIBLE - tvChattingItemPeopleCount.text = chatRoomInfo.participantCount.toString() + tvChattingItemPeopleCount.text = chatRoomInfo.board.currentPerson.toString() } - if (chatRoomInfo.lastMessageAt == null && chatRoomInfo.lastMessageContent == null) { + if (chatRoomInfo.lastMessage == null) { tvChattingItemLastChat.text = root.context.getString(R.string.chatting_start_message) tvChattingItemTime.text = "방금" tvChattingItemUnreadMessageCount.visibility = View.GONE } else { - tvChattingItemLastChat.text = chatRoomInfo.lastMessageContent - tvChattingItemTime.text = formatLastChatTime(chatRoomInfo.lastMessageAt!!) - if (chatRoomInfo.unreadMessageCount == 0) { - tvChattingItemUnreadMessageCount.visibility = View.GONE - } else { - tvChattingItemUnreadMessageCount.visibility = View.VISIBLE - tvChattingItemUnreadMessageCount.text = chatRoomInfo.unreadMessageCount.toString() - } + tvChattingItemLastChat.text = chatRoomInfo.lastMessage?.content + tvChattingItemTime.text = formatLastChatTime(chatRoomInfo.lastMessage?.createdAt!!) +// if (chatRoomInfo.unreadMessageCount == 0) { +// tvChattingItemUnreadMessageCount.visibility = View.GONE +// } else { +// tvChattingItemUnreadMessageCount.visibility = View.VISIBLE +// tvChattingItemUnreadMessageCount.text = chatRoomInfo.unreadMessageCount.toString() +// } } } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/home/HomeFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/home/HomeFragment.kt index ebc93cb1..fb0d491e 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/home/HomeFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/home/HomeFragment.kt @@ -75,31 +75,25 @@ class HomeFragment : getBoardList() isFirstLoad = false } -// (requireActivity() as MainActivity).refreshNotificationStatus() + (requireActivity() as MainActivity).refreshNotificationStatus() } @OptIn(ExperimentalBadgeUtils::class) fun updateNotificationBadge(hasUnreadNotification: Boolean) { + notificationBadgeDrawable?.isVisible = hasUnreadNotification if (hasUnreadNotification) { if (notificationBadgeDrawable == null) { notificationBadgeDrawable = BadgeDrawable.create(requireContext()) notificationBadgeDrawable?.apply { backgroundColor = getColor(requireContext(), R.color.system_red) // 알림 색상 지정 - isVisible = true clearNumber() horizontalOffset = 40 verticalOffset = 30 } - } else { - notificationBadgeDrawable?.isVisible = true } - notificationBadgeDrawable?.let { badge -> BadgeUtils.attachBadgeDrawable(badge, binding.layoutHeaderHome.imgbtnHeaderHomeNotification) } - } else { - // 뱃지 숨기기 - notificationBadgeDrawable?.isVisible = false } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/AccountInfoFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/AccountInfoFragment.kt index 9f39a6b6..d1df7713 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/AccountInfoFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/AccountInfoFragment.kt @@ -54,8 +54,8 @@ class AccountInfoFragment : BaseFragment(FragmentAcc tvAccountInfoEmail.text = email val targetResource = when (provider) { - "kakao" -> R.drawable.vec_login_kakao - "naver" -> R.drawable.vec_login_naver + "KAKAO" -> R.drawable.vec_login_kakao + "NAVER" -> R.drawable.vec_login_naver else -> R.drawable.vec_login_google } Glide diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedSettingFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedSettingFragment.kt index 4a457c8b..3d6004cd 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedSettingFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedSettingFragment.kt @@ -9,7 +9,7 @@ import androidx.navigation.NavOptions import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import com.catchmate.domain.model.user.GetUserProfileResponse +import com.catchmate.domain.model.user.BlockedUserInfo import com.catchmate.presentation.R import com.catchmate.presentation.databinding.FragmentBlockedSettingBinding import com.catchmate.presentation.databinding.LayoutSimpleDialogBinding @@ -28,10 +28,10 @@ class BlockedSettingFragment : private val blockedSettingViewModel: BlockedSettingViewModel by viewModels() private var deletedUserId = -1L private var currentPage: Int = 0 - private var isLastPage = false + private var hasNext = true private var isLoading = false private var isApiCalled = false - private var blockedUserList: MutableList = mutableListOf() + private var blockedUserList: MutableList = mutableListOf() override fun onViewCreated( view: View, @@ -65,7 +65,7 @@ class BlockedSettingFragment : (recyclerView.layoutManager as LinearLayoutManager) .findLastCompletelyVisibleItemPosition() val itemTotalCount = recyclerView.adapter!!.itemCount - if (lastVisibleItemPosition + 1 >= itemTotalCount && !isLastPage && !isLoading) { + if (lastVisibleItemPosition + 1 >= itemTotalCount && hasNext && !isLoading) { currentPage += 1 getBlockedUserList() } @@ -78,23 +78,23 @@ class BlockedSettingFragment : private fun initViewModel() { blockedSettingViewModel.getBlockedUserListResponse.observe(viewLifecycleOwner) { response -> - if (response.isFirst && response.isLast && response.totalElements == 0) { + if (!response.hasNext && response.totalElements == 0) { binding.rvBlockedUserListBlockedSetting.visibility = View.GONE binding.layoutBlockedSettingNoList.visibility = View.VISIBLE } else { binding.rvBlockedUserListBlockedSetting.visibility = View.VISIBLE binding.layoutBlockedSettingNoList.visibility = View.GONE if (isApiCalled) { - blockedUserList.addAll(response.userInfoList) + blockedUserList.addAll(response.content) } blockedUserAdapter.submitList(blockedUserList) - isLastPage = response.isLast + hasNext = response.hasNext isLoading = false } isApiCalled = false } blockedSettingViewModel.deleteBlockedUserResponse.observe(viewLifecycleOwner) { response -> - if (response.state) { + if (response != null) { blockedSettingViewModel.deleteUserFromList(deletedUserId) } } @@ -118,7 +118,7 @@ class BlockedSettingFragment : } private fun getBlockedUserList() { - if (isLoading || isLastPage) return + if (isLoading || !hasNext) return isLoading = true blockedSettingViewModel.getBlockedUserList(currentPage) isApiCalled = true diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedUserListAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedUserListAdapter.kt index 2d047fb7..71e8d2c0 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedUserListAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/BlockedUserListAdapter.kt @@ -7,18 +7,18 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide -import com.catchmate.domain.model.user.GetUserProfileResponse +import com.catchmate.domain.model.user.BlockedUserInfo import com.catchmate.presentation.R import com.catchmate.presentation.databinding.ItemChattingParticipantBinding import com.catchmate.presentation.interaction.OnBlockedUserSelectedListener class BlockedUserListAdapter( private val onBlockedUserSelectedListener: OnBlockedUserSelectedListener, -) : ListAdapter(diffUtil) { +) : ListAdapter(diffUtil) { inner class BlockedUserViewHolder( private val binding: ItemChattingParticipantBinding, ) : RecyclerView.ViewHolder(binding.root) { - fun bind(userInfo: GetUserProfileResponse) { + fun bind(userInfo: BlockedUserInfo) { binding.apply { tvChattingParticipantKickOut.visibility = View.VISIBLE tvChattingParticipantKickOut.text = binding.root.context.getString(R.string.mypage_setting_unblock) @@ -60,15 +60,15 @@ class BlockedUserListAdapter( companion object { val diffUtil = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: GetUserProfileResponse, - newItem: GetUserProfileResponse, + oldItem: BlockedUserInfo, + newItem: BlockedUserInfo, ): Boolean = oldItem.userId == newItem.userId override fun areContentsTheSame( - oldItem: GetUserProfileResponse, - newItem: GetUserProfileResponse, + oldItem: BlockedUserInfo, + newItem: BlockedUserInfo, ): Boolean = oldItem.userId == newItem.userId } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/EditProfileFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/EditProfileFragment.kt index 30061556..507c43bd 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/EditProfileFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/EditProfileFragment.kt @@ -18,6 +18,8 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import androidx.core.graphics.drawable.toBitmap +import androidx.core.os.bundleOf +import androidx.fragment.app.setFragmentResult import androidx.fragment.app.viewModels import androidx.lifecycle.lifecycleScope import androidx.navigation.NavOptions @@ -132,8 +134,9 @@ class EditProfileFragment : } } editProfileViewModel.patchUserProfileResponse.observe(viewLifecycleOwner) { response -> - Log.i("PROFILE PATCH STATE", response.state.toString()) - if (response.state) { + Log.i("PROFILE PATCH STATE", "successed ${response.nickName}") + response?.let { + setFragmentResult("patchedUserInfo", bundleOf("userInfo" to response)) findNavController().popBackStack() } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageFragment.kt index 02e690f6..30c4bd18 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageFragment.kt @@ -1,14 +1,18 @@ package com.catchmate.presentation.view.mypage +import android.os.Build import android.os.Bundle import android.util.Log import android.view.View +import androidx.annotation.RequiresApi import androidx.core.graphics.drawable.DrawableCompat +import androidx.fragment.app.setFragmentResultListener import androidx.fragment.app.viewModels import androidx.navigation.NavOptions import androidx.navigation.fragment.findNavController import com.bumptech.glide.Glide import com.catchmate.domain.model.user.GetUserProfileResponse +import com.catchmate.domain.model.user.PatchUserProfileResponse import com.catchmate.presentation.R import com.catchmate.presentation.databinding.FragmentMyPageBinding import com.catchmate.presentation.util.AgeUtils @@ -26,30 +30,52 @@ class MyPageFragment : BaseFragment(FragmentMyPageBinding private val myPageViewModel: MyPageViewModel by viewModels() private val localDataViewModel: LocalDataViewModel by viewModels() + @RequiresApi(Build.VERSION_CODES.TIRAMISU) override fun onViewCreated( view: View, savedInstanceState: Bundle?, ) { super.onViewCreated(view, savedInstanceState) enableDoubleBackPressedExit = true + initViewModel() localDataViewModel.getAccessToken() - initHeader() - initViews() + initHeader(null, null) + + setFragmentResultListener("patchedUserInfo") { _, bundle -> + val userInfo = bundle.getSerializable("userInfo", PatchUserProfileResponse::class.java) + + userInfo?.let { patchResponse -> + val updatedProfile = + GetUserProfileResponse( + patchResponse.userId, + patchResponse.nickName, + patchResponse.email, + patchResponse.profileImageUrl, + patchResponse.gender, + patchResponse.birthDate, + patchResponse.watchStyle, + patchResponse.club, + ) + myPageViewModel.updateUserProfile(updatedProfile) + initHeader(patchResponse.email, patchResponse.nickName) + } + } } - private fun initHeader() { + private fun initHeader( + email: String?, + nickName: String?, + ) { binding.layoutHeaderMyPage.apply { tvSettingHeaderTitle.setText(R.string.mypage_title) imgbtnSettingHeaderSetting.setOnClickListener { + val currentEmail = email ?: myPageViewModel.userProfile.value?.email + val currentNickName = nickName ?: myPageViewModel.userProfile.value?.nickName val bundle = Bundle().apply { - putString("email", myPageViewModel.userProfile.value?.email) - putString("nickname", myPageViewModel.userProfile.value?.nickName) -// putString("allAlarm", myPageViewModel.userProfile.value?.allAlarm) -// putString("chatAlarm", myPageViewModel.userProfile.value?.chatAlarm) -// putString("enrollAlarm", myPageViewModel.userProfile.value?.enrollAlarm) -// putString("eventAlarm", myPageViewModel.userProfile.value?.eventAlarm) + putString("email", currentEmail) + putString("nickname", currentNickName) } findNavController().navigate(R.id.action_myPageFragment_to_myPageSettingFragment, bundle) } @@ -89,17 +115,19 @@ class MyPageFragment : BaseFragment(FragmentMyPageBinding private fun initViewModel() { myPageViewModel.userProfile.observe(viewLifecycleOwner) { response -> initProfile(response) + initViews() + initHeader(response.email, response.nickName) + } + myPageViewModel.newCount.observe(viewLifecycleOwner) { response -> + if (response.count == 0) { + binding.tvMyPageReceivedJoinUnreadCount.visibility = View.INVISIBLE + } else { + binding.tvMyPageReceivedJoinUnreadCount.apply { + visibility = View.VISIBLE + text = response.count.toString() + } + } } -// myPageViewModel.newCount.observe(viewLifecycleOwner) { response -> -// if (response.newEnrollCount == 0) { -// binding.tvMyPageReceivedJoinUnreadCount.visibility = View.INVISIBLE -// } else { -// binding.tvMyPageReceivedJoinUnreadCount.apply { -// visibility = View.VISIBLE -// text = response.newEnrollCount.toString() -// } -// } -// } localDataViewModel.accessToken.observe(viewLifecycleOwner) { token -> if (token.isNullOrEmpty()) { binding.apply { @@ -110,7 +138,7 @@ class MyPageFragment : BaseFragment(FragmentMyPageBinding } } else { myPageViewModel.getUserProfile() -// myPageViewModel.getEnrollNewCount() + myPageViewModel.getEnrollNewCount() } } myPageViewModel.navigateToLogin.observe(viewLifecycleOwner) { isTrue -> @@ -149,7 +177,7 @@ class MyPageFragment : BaseFragment(FragmentMyPageBinding } layoutMyPageReceivedJoin.setOnClickListener { val bundle = Bundle() - bundle.putInt("newCount", myPageViewModel.newCount.value?.newEnrollCount ?: 0) + bundle.putInt("newCount", myPageViewModel.newCount.value?.count ?: 0) findNavController().navigate(R.id.action_myPageFragment_to_receivedJoinFragment, bundle) } tvMyPageInformation.setOnClickListener { diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageSettingFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageSettingFragment.kt index 289d8940..10cc415b 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageSettingFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPageSettingFragment.kt @@ -10,10 +10,6 @@ import com.catchmate.presentation.view.base.BaseFragment class MyPageSettingFragment : BaseFragment(FragmentMyPageSettingBinding::inflate) { private val email by lazy { arguments?.getString("email") ?: "" } private val nickname by lazy { arguments?.getString("nickname") ?: "" } - private val allAlarm by lazy { arguments?.getString("allAlarm") ?: "" } - private val chatAlarm by lazy { arguments?.getString("chatAlarm") ?: "" } - private val enrollAlarm by lazy { arguments?.getString("enrollAlarm") ?: "" } - private val eventAlarm by lazy { arguments?.getString("eventAlarm") ?: "" } override fun onViewCreated( view: View, @@ -55,14 +51,7 @@ class MyPageSettingFragment : BaseFragment(Fragmen findNavController().navigate(R.id.action_myPageSettingFragment_to_termsAndPoliciesFragment) } tvMyPageSettingNotificationSetting.setOnClickListener { - val bundle = - Bundle().apply { - putString("allAlarm", allAlarm) - putString("chatAlarm", chatAlarm) - putString("enrollAlarm", enrollAlarm) - putString("eventAlarm", eventAlarm) - } - findNavController().navigate(R.id.action_myPageSettingFragment_to_notificationSettingFragment, bundle) + findNavController().navigate(R.id.action_myPageSettingFragment_to_notificationSettingFragment) } tvMyPageSettingAnnouncement.setOnClickListener { findNavController().navigate(R.id.action_myPageSettingFragment_to_announcementFragment) diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPostFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPostFragment.kt index e493fbf9..ee3baaff 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPostFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/MyPostFragment.kt @@ -43,7 +43,7 @@ class MyPostFragment : private var userInfo: GetUserProfileResponse? = null private var currentPage: Int = 0 - private var isLastPage = false + private var hasNext = true private var isLoading = false private var isApiCalled = false private var myPostList: MutableList = mutableListOf() @@ -175,24 +175,24 @@ class MyPostFragment : } } myPostViewModel.getUserBoardListResponse.observe(viewLifecycleOwner) { response -> - if (response.isFirst && response.isLast && response.totalElements == 0) { + if (!response.hasNext && response.totalElements == 0) { binding.rvMyPost.visibility = View.GONE binding.layoutMyPostNoList.visibility = View.VISIBLE } else { binding.rvMyPost.visibility = View.VISIBLE binding.layoutMyPostNoList.visibility = View.GONE if (isApiCalled) { - myPostList.addAll(response.boardInfoList) + myPostList.addAll(response.content) } val adapter = binding.rvMyPost.adapter as MyPostAdapter adapter.updatePostList(myPostList) - isLastPage = response.isLast + hasNext = response.hasNext isLoading = false } isApiCalled = false } myPostViewModel.postUserBlockResponse.observe(viewLifecycleOwner) { response -> - if (response.state) { + if (response != null) { binding.rvMyPost.visibility = View.GONE binding.layoutMyPostBlockedUser.visibility = View.VISIBLE Snackbar.make(requireView(), R.string.mypage_mypost_user_block_toast, Snackbar.LENGTH_SHORT).show() @@ -221,7 +221,7 @@ class MyPostFragment : (recyclerView.layoutManager as LinearLayoutManager) .findLastCompletelyVisibleItemPosition() val itemTotalCount = recyclerView.adapter!!.itemCount - if (lastVisibleItemPosition + 1 >= itemTotalCount && !isLastPage && !isLoading) { + if (lastVisibleItemPosition + 1 >= itemTotalCount && hasNext && !isLoading) { currentPage += 1 getMyPostList() } @@ -232,7 +232,7 @@ class MyPostFragment : } private fun getMyPostList() { - if (isLoading || isLastPage) return + if (isLoading || !hasNext) return isLoading = true myPostViewModel.getUserBoardList(userInfo?.userId!!, currentPage) isApiCalled = true diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/NotificationSettingFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/NotificationSettingFragment.kt index b51933f2..5d7ae288 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/NotificationSettingFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/NotificationSettingFragment.kt @@ -25,16 +25,6 @@ class NotificationSettingFragment : BaseFragment - reponse?.let { - Log.i("설정완료", "${reponse.alarmType} / ${reponse.enabled}") + notificationSettingViewModel.getUserAlarmResponse.observe(viewLifecycleOwner) { response -> + response?.let { + isAllChecked = response.allAlarm + isChatChecked = response.chatAlarm + isEnrollChecked = response.enrollAlarm + isEventChecked = response.eventAlarm + initView() + } + } + notificationSettingViewModel.patchUserAlarmResponse.observe(viewLifecycleOwner) { response -> + response?.let { + Log.i("설정완료", "${response.alarmType} / ${response.enabled}") } } notificationSettingViewModel.navigateToLogin.observe(viewLifecycleOwner) { isTrue -> diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollAdapter.kt index 2f1fa76b..8f8a441c 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollAdapter.kt @@ -9,12 +9,12 @@ import android.widget.TextView import androidx.core.graphics.drawable.DrawableCompat import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide -import com.catchmate.domain.model.enroll.ReceivedEnrollInfo +import com.catchmate.domain.model.enroll.ReceivedEnrollInfoResponse import com.catchmate.presentation.R import com.catchmate.presentation.databinding.ItemReceivedEnrollBinding import com.catchmate.presentation.interaction.OnReceivedEnrollResultSelectedListener -import com.catchmate.presentation.util.AgeUtils.convertBirthDateToAge -import com.catchmate.presentation.util.ClubUtils.convertClubIdToName +import com.catchmate.presentation.util.AgeUtils +import com.catchmate.presentation.util.ClubUtils.convertClubNameToId import com.catchmate.presentation.util.DateUtils.formatDateTimeToEnrollDateTime import com.catchmate.presentation.util.GenderUtils.convertBoardGender import com.catchmate.presentation.util.ResourceUtil.convertTeamColor @@ -25,9 +25,9 @@ class ReceivedEnrollAdapter( private val layoutInflater: LayoutInflater, private val onReceivedEnrollResultSelectedListener: OnReceivedEnrollResultSelectedListener, ) : RecyclerView.Adapter() { - private var enrollList: MutableList = mutableListOf() + private var enrollList: MutableList = mutableListOf() - fun updateEnrollList(newList: List) { + fun updateEnrollList(newList: List) { enrollList = newList.toMutableList() notifyDataSetChanged() } @@ -70,33 +70,33 @@ class ReceivedEnrollAdapter( holder.apply { Glide .with(context) - .load(info.userInfo.profileImageUrl) + .load(info.applicantResponse.profileImageUrl) .error(R.drawable.vec_all_default_profile) .into(ivEnrollUserProfile) - tvEnrollUserNickname.text = info.userInfo.nickName - tvEnrollUserCheerTeam.text = convertClubIdToName(info.userInfo.club.clubId) + tvEnrollUserNickname.text = info.applicantResponse.nickname + tvEnrollUserCheerTeam.text = info.applicantResponse.favoriteClub DrawableCompat .setTint( tvEnrollUserCheerTeam.background, convertTeamColor( context, - info.userInfo.club.clubId, + convertClubNameToId(info.applicantResponse.favoriteClub), true, "receivedEnrollAdapter", ), ) - if (info.userInfo.watchStyle != null) { + if (info.applicantResponse.watchStyle != null) { tvEnrollUserWatchStyle.visibility = View.VISIBLE - tvEnrollUserWatchStyle.text = info.userInfo.watchStyle + tvEnrollUserWatchStyle.text = info.applicantResponse.watchStyle } else { tvEnrollUserWatchStyle.visibility = View.GONE } - tvEnrollUserGender.text = convertBoardGender(context, info.userInfo.gender) - tvEnrollUserAge.text = convertBirthDateToAge(info.userInfo.birthDate) + tvEnrollUserGender.text = convertBoardGender(context, info.applicantResponse.gender) + tvEnrollUserAge.text = AgeUtils.convertBirthDateToAge(info.applicantResponse.ageRange) tvEnrollSavedDateTime.text = formatDateTimeToEnrollDateTime(info.requestDate) edtEnrollDescription.setText(info.description) diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollScrollDialogFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollScrollDialogFragment.kt index d2de45a2..f2a1a4da 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollScrollDialogFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedEnrollScrollDialogFragment.kt @@ -84,7 +84,7 @@ class ReceivedEnrollScrollDialogFragment : receivedEnrollScrollDialogViewModel.getReceivedEnrollResponse.observe(viewLifecycleOwner) { response -> response?.let { val adapter = binding.rvReceivedEnrollScrollDialog.adapter as ReceivedEnrollAdapter - adapter.updateEnrollList(response.enrollInfoList.first().enrollReceiveInfoList) + adapter.updateEnrollList(response.content) } } } @@ -93,7 +93,7 @@ class ReceivedEnrollScrollDialogFragment : receivedEnrollScrollDialogViewModel.patchEnrollReject(enrollId) receivedEnrollScrollDialogViewModel.patchEnrollReject.observe(viewLifecycleOwner) { response -> if (response != null) { - Log.i("STATUS", response.acceptStatus) + Log.i("STATUS", response.message) dismiss() } } @@ -103,7 +103,7 @@ class ReceivedEnrollScrollDialogFragment : receivedEnrollScrollDialogViewModel.patchEnrollAccept(enrollId) receivedEnrollScrollDialogViewModel.patchEnrollAccept.observe(viewLifecycleOwner) { response -> if (response != null) { - Log.i("STATUS", response.acceptStatus) + Log.i("STATUS", response.message) dismiss() } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinAdapter.kt index 277265a0..0eb62d63 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinAdapter.kt @@ -31,7 +31,7 @@ class ReceivedJoinAdapter( val tvGameTime: TextView val tvGamePlace: TextView val tvBoardTitle: TextView - val imgbtnMove: ImageButton + val imgBtnMove: ImageButton val rvProfile: RecyclerView init { @@ -40,7 +40,7 @@ class ReceivedJoinAdapter( tvGameTime = itemBinding.tvReceivedJoinItemTime tvGamePlace = itemBinding.tvReceivedJoinItemPlace tvBoardTitle = itemBinding.tvReceivedJoinItemTitle - imgbtnMove = itemBinding.imgbtnReceivedJoinItemMove + imgBtnMove = itemBinding.imgbtnReceivedJoinItemMove rvProfile = itemBinding.rvReceivedJoinItemProfile rvProfile.apply { @@ -69,14 +69,14 @@ class ReceivedJoinAdapter( holder: ReceivedJoinViewHolder, position: Int, ) { - val boardInfo = list[position].boardInfo - val enrollReceivedInfoList = list[position].enrollReceiveInfoList + val boardInfo = list[position].boardResponse + val enrollReceivedInfoList = list[position].enrollResponses holder.apply { - val dateTime = DateUtils.formatISODateTime(boardInfo.gameInfo.gameStartDate!!) + val dateTime = DateUtils.formatISODateTime(boardInfo.gameResponse.gameStartDate!!) tvGameDate.text = dateTime.first tvGameTime.text = dateTime.second - tvGamePlace.text = boardInfo.gameInfo.location + tvGamePlace.text = boardInfo.gameResponse.location tvBoardTitle.text = boardInfo.title val adapter = rvProfile.adapter as ReceivedJoinProfileAdapter diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinFragment.kt index 89dfcf68..37ee68e0 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinFragment.kt @@ -24,7 +24,7 @@ class ReceivedJoinFragment : private var newCount: Int = -1 private val receivedJoinViewModel: ReceivedJoinViewModel by viewModels() private var currentPage: Int = 0 - private var isLastPage = false + private var hasNext = true private var isLoading = false private var isApiCalled = false private var receivedJoinList: MutableList = mutableListOf() @@ -76,7 +76,7 @@ class ReceivedJoinFragment : (recyclerView.layoutManager as LinearLayoutManager) .findLastCompletelyVisibleItemPosition() val itemTotalCount = recyclerView.adapter!!.itemCount - if (lastVisibleItemPosition + 1 >= itemTotalCount && !isLastPage && !isLoading) { + if (lastVisibleItemPosition + 1 >= itemTotalCount && hasNext && !isLoading) { currentPage += 1 getAllReceivedEnroll() } @@ -87,7 +87,7 @@ class ReceivedJoinFragment : } private fun getAllReceivedEnroll() { - if (isLoading || isLastPage) return + if (isLoading || !hasNext) return isLoading = true receivedJoinViewModel.getAllReceivedEnroll(currentPage) isApiCalled = true @@ -95,18 +95,18 @@ class ReceivedJoinFragment : private fun initViewModel() { receivedJoinViewModel.getAllReceivedEnrollResponse.observe(viewLifecycleOwner) { response -> - if (response.isFirst && response.isLast && response.totalElements == 0) { + if (!response.hasNext && response.totalElements == 0) { binding.rvReceivedJoinList.visibility = View.GONE binding.layoutReceivedJoinNoList.visibility = View.VISIBLE } else { binding.rvReceivedJoinList.visibility = View.VISIBLE binding.layoutReceivedJoinNoList.visibility = View.GONE if (isApiCalled) { - receivedJoinList.addAll(response.enrollInfoList) + receivedJoinList.addAll(response.content) } val adapter = binding.rvReceivedJoinList.adapter as ReceivedJoinAdapter adapter.updateList(receivedJoinList) - isLastPage = response.isLast + hasNext = response.hasNext isLoading = false } isApiCalled = false diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinProfileAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinProfileAdapter.kt index 22e90dc3..a5774cc2 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinProfileAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/ReceivedJoinProfileAdapter.kt @@ -13,7 +13,7 @@ import com.catchmate.domain.model.enroll.ReceivedEnrollInfo import com.catchmate.presentation.R import com.catchmate.presentation.databinding.ItemProfileBinding import com.catchmate.presentation.util.AgeUtils -import com.catchmate.presentation.util.ClubUtils +import com.catchmate.presentation.util.ClubUtils.convertClubNameToId import com.catchmate.presentation.util.GenderUtils import com.catchmate.presentation.util.ResourceUtil.convertTeamColor import de.hdodenhof.circleimageview.CircleImageView @@ -74,38 +74,38 @@ class ReceivedJoinProfileAdapter( ) { val info = enrollInfoList[position] holder.apply { - if (info.new) { + if (info.newEnroll) { tvProfileNewBadge.visibility = View.VISIBLE } else { tvProfileNewBadge.visibility = View.INVISIBLE } Glide .with(context) - .load(info.userInfo.profileImageUrl) + .load(info.applicant.profileImageUrl) .error(R.drawable.vec_all_default_profile) .into(ivProfileImage) - tvProfileNickname.text = info.userInfo.nickName - tvProfileTeam.text = ClubUtils.convertClubIdToName(info.userInfo.club.clubId) + tvProfileNickname.text = info.applicant.nickname + tvProfileTeam.text = info.applicant.favoriteClub DrawableCompat .setTint( tvProfileTeam.background, convertTeamColor( context, - info.userInfo.club.clubId, + convertClubNameToId(info.applicant.favoriteClub), true, "receivedJoinProfileAdapter", ), ) - if (info.userInfo.watchStyle != null) { + if (info.applicant.watchStyle != null) { tvProfileCheerStyle.visibility = View.VISIBLE - tvProfileCheerStyle.text = info.userInfo.watchStyle + tvProfileCheerStyle.text = info.applicant.watchStyle } else { tvProfileCheerStyle.visibility = View.GONE } - tvProfileGender.text = GenderUtils.convertBoardGender(context, info.userInfo.gender) - tvProfileAge.text = AgeUtils.convertBirthDateToAge(info.userInfo.birthDate) + tvProfileGender.text = GenderUtils.convertBoardGender(context, info.applicant.gender) + tvProfileAge.text = AgeUtils.convertBirthDateToAge(info.applicant.ageRange) } } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinAdapter.kt index 83b6d402..74980257 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinAdapter.kt @@ -76,28 +76,28 @@ class SentJoinAdapter( ) { val enrollInfo = enrollInfoList[position] holder.apply { - if (enrollInfo.boardInfo.currentPerson == enrollInfo.boardInfo.maxPerson) { - tvItemCount.text = "${enrollInfo.boardInfo.currentPerson}/${enrollInfo.boardInfo.maxPerson} 마감" + if (enrollInfo.boardResponse.currentPerson == enrollInfo.boardResponse.maxPerson) { + tvItemCount.text = "${enrollInfo.boardResponse.currentPerson}/${enrollInfo.boardResponse.maxPerson} 마감" tvItemCount.setBackgroundResource(R.drawable.shape_all_rect_r12_grey100) tvItemCount.setTextColor(ContextCompat.getColor(context, R.color.grey500)) } else { - tvItemCount.text = "${enrollInfo.boardInfo.currentPerson}/${enrollInfo.boardInfo.maxPerson}" + tvItemCount.text = "${enrollInfo.boardResponse.currentPerson}/${enrollInfo.boardResponse.maxPerson}" tvItemCount.setBackgroundResource(R.drawable.shape_all_rect_r12_brand50) tvItemCount.setTextColor(ContextCompat.getColor(context, R.color.brand500)) } - val dateTimePair = DateUtils.formatISODateTime(enrollInfo.boardInfo.gameInfo.gameStartDate!!) + val dateTimePair = DateUtils.formatISODateTime(enrollInfo.boardResponse.gameResponse.gameStartDate!!) tvItemDate.text = dateTimePair.first tvItemTime.text = dateTimePair.second - tvItemPlace.text = enrollInfo.boardInfo.gameInfo.location - tvItemTitle.text = enrollInfo.boardInfo.title + tvItemPlace.text = enrollInfo.boardResponse.gameResponse.location + tvItemTitle.text = enrollInfo.boardResponse.title val isCheerTeam = - enrollInfo.boardInfo.gameInfo.homeClub - ?.clubId == enrollInfo.boardInfo.cheerClubId + enrollInfo.boardResponse.gameResponse.homeClub + ?.clubId == enrollInfo.boardResponse.cheerClub.clubId ResourceUtil.setTeamViewResources( - enrollInfo.boardInfo.gameInfo.homeClub + enrollInfo.boardResponse.gameResponse.homeClub ?.clubId ?: 0, isCheerTeam, ivItemHomeTeamBg, @@ -106,7 +106,7 @@ class SentJoinAdapter( context, ) ResourceUtil.setTeamViewResources( - enrollInfo.boardInfo.gameInfo.awayClub + enrollInfo.boardResponse.gameResponse.awayClub ?.clubId ?: 0, !isCheerTeam, ivItemAwayTeamBg, @@ -116,7 +116,7 @@ class SentJoinAdapter( ) cvItemLayout.setOnClickListener { - onPostItemClickListener.onPostItemClicked(enrollInfo.boardInfo.boardId) + onPostItemClickListener.onPostItemClicked(enrollInfo.boardResponse.boardId) } } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinFragment.kt index 1a3eab0a..769bec95 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/mypage/SentJoinFragment.kt @@ -24,7 +24,7 @@ class SentJoinFragment : private val sentJoinViewModel: SentJoinViewModel by viewModels() private var currentPage: Int = 0 - private var isLastPage = false + private var hasNext = true private var isLoading = false private var isApiCalled = false private var isFirstLoad = true @@ -70,7 +70,7 @@ class SentJoinFragment : (recyclerView.layoutManager as LinearLayoutManager) .findLastCompletelyVisibleItemPosition() val itemTotalCount = recyclerView.adapter!!.itemCount - if (lastVisibleItemPosition + 1 >= itemTotalCount && !isLastPage && !isLoading) { + if (lastVisibleItemPosition + 1 >= itemTotalCount && hasNext && !isLoading) { currentPage += 1 getRequestedEnrollList() } @@ -82,18 +82,18 @@ class SentJoinFragment : private fun initViewModel() { sentJoinViewModel.requestedEnrollList.observe(viewLifecycleOwner) { response -> - if (response.isFirst && response.isLast && response.totalElements == 0) { + if (!response.hasNext && response.totalElements == 0) { binding.rvSentJoinPostList.visibility = View.GONE binding.layoutSentJoinNoList.visibility = View.VISIBLE } else { binding.rvSentJoinPostList.visibility = View.VISIBLE binding.layoutSentJoinNoList.visibility = View.GONE if (isApiCalled) { - enrollList.addAll(response.enrollInfoList) + enrollList.addAll(response.content) } val adapter = binding.rvSentJoinPostList.adapter as SentJoinAdapter adapter.updateList(enrollList) - isLastPage = response.isLast + hasNext = response.hasNext isLoading = false } isApiCalled = false @@ -118,7 +118,7 @@ class SentJoinFragment : } private fun getRequestedEnrollList() { - if (isLoading || isLastPage) return + if (isLoading || !hasNext) return isLoading = true sentJoinViewModel.getRequestedEnrollList(currentPage) isApiCalled = true diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationAdapter.kt index 0606bfe2..9ca47cfb 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationAdapter.kt @@ -16,6 +16,7 @@ import com.catchmate.presentation.interaction.OnItemSwipeListener import com.catchmate.presentation.interaction.OnListItemAllRemovedListener import com.catchmate.presentation.interaction.OnNotificationItemClickListener import com.catchmate.presentation.util.DateUtils +import com.catchmate.presentation.util.DateUtils.formatNotificationGameInfo import de.hdodenhof.circleimageview.CircleImageView class NotificationAdapter( @@ -72,15 +73,19 @@ class NotificationAdapter( itemBinding.root.setOnClickListener { val pos = absoluteAdapterPosition val currentNotice = notificationList[pos] - if (currentNotice.boardInfo == null) { - itemClickListener.onNotificationItemClick( - currentNotice.notificationId, - pos, - null, - null, - currentNotice.inquiryInfo?.inquiryId, - ) - } else { + itemClickListener.onNotificationItemClick( + currentNotice.id, + pos, + ) +// if (currentNotice.boardInfo == null) { +// itemClickListener.onNotificationItemClick( +// currentNotice.notificationId, +// pos, +// null, +// null, +// currentNotice.inquiryInfo?.inquiryId, +// ) +// } else { // val chatRoomId = currentNotice.boardInfo?.chatRoomId // itemClickListener.onNotificationItemClick( // currentNotice.notificationId, @@ -93,7 +98,7 @@ class NotificationAdapter( // }, // null, // ) - } +// } } } } @@ -118,24 +123,33 @@ class NotificationAdapter( position: Int, ) { val info = notificationList[position] - if (info.boardInfo == null) { - Glide - .with(context) - .load(R.drawable.ic_notification_samsung_device) - .into(holder.ivNotificationItemProfile) - val (date, _) = info.createdAt.split("T") - holder.tvNotificationItemDate.text = date.replace("-", ".") - } else { - Glide - .with(context) - .load(info.senderProfileImageUrl) - .into(holder.ivNotificationItemProfile) - val dateTime: Pair = DateUtils.formatISODateTimeToDateTime(info.boardInfo!!.gameResponse.gameStartDate!!) - holder.tvNotificationItemDate.text = dateTime.first + " | " - holder.tvNotificationItemTime.text = dateTime.second + " | " - holder.tvNotificationItemPlace.text = info.boardInfo!!.gameResponse.location - } - holder.tvNotificationItemTitle.text = info.body +// if (info.boardInfo == null) { +// Glide +// .with(context) +// .load(R.drawable.ic_notification_samsung_device) +// .into(holder.ivNotificationItemProfile) +// val (date, _) = info.createdAt.split("T") +// holder.tvNotificationItemDate.text = date.replace("-", ".") +// } else { +// Glide +// .with(context) +// .load(info.senderProfileImageUrl) +// .into(holder.ivNotificationItemProfile) +// val dateTime: Pair = DateUtils.formatISODateTimeToDateTime(info.boardInfo!!.gameResponse.gameStartDate!!) +// holder.tvNotificationItemDate.text = dateTime.first + " | " +// holder.tvNotificationItemTime.text = dateTime.second + " | " +// holder.tvNotificationItemPlace.text = info.boardInfo!!.gameResponse.location +// } + Glide + .with(context) + .load(info.senderProfileImageUrl) + .error(R.drawable.ic_notification_samsung_device) + .into(holder.ivNotificationItemProfile) + holder.tvNotificationItemTitle.text = info.title + val triple = formatNotificationGameInfo(info.gameInfo) + holder.tvNotificationItemDate.text = triple.first + " | " + holder.tvNotificationItemTime.text = triple.second + " | " + holder.tvNotificationItemPlace.text = triple.third if (info.read) { holder.layoutNotification.setBackgroundColor(ContextCompat.getColor(context, R.color.grey50)) holder.tvNotificationItemTitle.setTextColor(ContextCompat.getColor(context, R.color.grey500)) diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationFragment.kt index 3256202d..0fd6074d 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/NotificationFragment.kt @@ -31,7 +31,7 @@ class NotificationFragment : private val notificationViewModel: NotificationViewModel by viewModels() private var currentPage: Int = 0 - private var isLastPage = false + private var hasNext = true private var isLoading = false private var isApiCalled = false private var isFirstLoad = true @@ -65,32 +65,32 @@ class NotificationFragment : } private fun getNotificationList() { - if (isLoading || isLastPage) return + if (isLoading || !hasNext) return isLoading = true - notificationViewModel.getReceivedNotificationList(currentPage) + notificationViewModel.getNotificationList(currentPage) isApiCalled = true } private fun initViewModel() { notificationViewModel.receivedNotificationList.observe(viewLifecycleOwner) { response -> - if (response.isFirst && response.isLast && response.totalElements == 0) { + if (!response.hasNext && response.totalElements == 0) { binding.rvNotificationList.visibility = View.GONE binding.layoutNotificationNoList.visibility = View.VISIBLE } else { binding.rvNotificationList.visibility = View.VISIBLE binding.layoutNotificationNoList.visibility = View.GONE if (isApiCalled) { - notificationList.addAll(response.notificationInfoList) + notificationList.addAll(response.content) } val adapter = binding.rvNotificationList.adapter as NotificationAdapter adapter.updateNotificationList(notificationList) - isLastPage = response.isLast + hasNext = response.hasNext isLoading = false } isApiCalled = false } notificationViewModel.deletedNotificationResponse.observe(viewLifecycleOwner) { response -> - if (response.state) { + if (response == 200) { val adapter = binding.rvNotificationList.adapter as NotificationAdapter adapter.removeItem(deletedItemPos) } else { @@ -145,7 +145,7 @@ class NotificationFragment : (recyclerView.layoutManager as LinearLayoutManager) .findLastCompletelyVisibleItemPosition() val itemTotalCount = recyclerView.adapter!!.itemCount - if (lastVisibleItemPosition + 1 >= itemTotalCount && !isLastPage && !isLoading) { + if (lastVisibleItemPosition + 1 >= itemTotalCount && hasNext && !isLoading) { currentPage += 1 getNotificationList() } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/SwipeDeleteCallback.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/SwipeDeleteCallback.kt index cecb2883..9ca39fce 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/SwipeDeleteCallback.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/notification/SwipeDeleteCallback.kt @@ -30,7 +30,7 @@ class SwipeDeleteCallback( ) { // swipe 발생시킨 아이템 position val deletedPos = viewHolder.absoluteAdapterPosition - val deletedItemId = data[deletedPos].notificationId + val deletedItemId = data[deletedPos].id if (direction == ItemTouchHelper.LEFT) { // adapter에서 아이템 제거 diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/AddPostFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/AddPostFragment.kt index 68f9cc7e..1f094d00 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/AddPostFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/AddPostFragment.kt @@ -10,8 +10,8 @@ import androidx.core.widget.doOnTextChanged import androidx.fragment.app.viewModels import androidx.navigation.NavOptions import androidx.navigation.fragment.findNavController +import com.catchmate.domain.model.board.BoardMode import com.catchmate.domain.model.board.GameRequest -import com.catchmate.domain.model.board.GetBoardResponse import com.catchmate.domain.model.board.PostBoardRequest import com.catchmate.domain.model.board.PutBoardRequest import com.catchmate.domain.model.enroll.GameInfo @@ -45,8 +45,7 @@ class AddPostFragment : OnCheerTeamSelectedListener, OnPlaceSelectedListener { private val addPostViewModel: AddPostViewModel by viewModels() - private val isEditMode by lazy { arguments?.getBoolean("isEditMode") ?: false } - private var isTempSave = false + private var currentMode: BoardMode = BoardMode.New private var isTempDialogShown = false private var isAgeRegardlessChecked = false @@ -62,15 +61,31 @@ class AddPostFragment : ) { super.onViewCreated(view, savedInstanceState) initViewModel() + + currentMode = + ( + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + arguments?.getParcelable("boardMode", BoardMode::class.java) + } else { + @Suppress("DEPRECATION") + arguments?.getParcelable("boardMode") as? BoardMode + } + ) ?: BoardMode.New + // getBoardInfo()로 받아온 board Data가 존재하고, isEditMode == true일 때 게시글 수정 모드이므로 viewmodel에 의해 보드 데이터 셋팅됨 - addPostViewModel.setBoardInfo(getBoardInfo()) + if (currentMode is BoardMode.Edit) { + addPostViewModel.setBoardInfo((currentMode as BoardMode.Edit).boardInfo) + } + + initHeader() + initBottomSheets() initFooter() initAdditionalInfoEdt() initAgeChip() initTitleTextView() initKeyboardAction() - if (!isEditMode) { + if (currentMode is BoardMode.New) { addPostViewModel.getTempBoard() onBackPressedAction = { val isAllFieldsEmpty = checkInputFieldsEmpty() @@ -139,17 +154,10 @@ class AddPostFragment : } } - private fun getBoardInfo(): GetBoardResponse? = - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - arguments?.getParcelable("boardInfo", GetBoardResponse::class.java) - } else { - arguments?.getParcelable("boardInfo") as GetBoardResponse? - } - private fun initHeader() { binding.layoutAddPostHeader.run { tvHeaderTextTitle.visibility = View.GONE - if (isEditMode) { + if (currentMode is BoardMode.Edit) { tvHeaderTextSub.visibility = View.GONE imgbtnHeaderTextBack.setOnClickListener { findNavController().popBackStack() @@ -187,8 +195,6 @@ class AddPostFragment : info.game, ) } - initHeader() - initBottomSheets() } addPostViewModel.homeTeamName.observe(viewLifecycleOwner) { homeTeamName -> if (homeTeamName != null) { @@ -234,7 +240,7 @@ class AddPostFragment : addPostViewModel.postBoardResponse.observe(viewLifecycleOwner) { response -> if (response != null) { Log.i("boardWriteResponse", "$response") - if (!isTempSave) { // 게시글 등록일 때 + if (currentMode is BoardMode.New) { // 게시글 등록일 때 val bundle = Bundle() bundle.putLong("boardId", response.boardId) val navOptions = @@ -243,7 +249,7 @@ class AddPostFragment : .setPopUpTo(R.id.addPostFragment, true) .build() findNavController().navigate(R.id.action_addPostFragment_to_readPostFragment, bundle, navOptions) - } else { // 임시 저장일 때 + } else if (currentMode is BoardMode.Temp) { // 임시 저장일 때 Snackbar.make(requireView(), R.string.temporary_storage_sucess_toast_msg, Snackbar.LENGTH_SHORT).show() findNavController().popBackStack() } @@ -305,40 +311,51 @@ class AddPostFragment : location, ) - if (isEditMode) { - // 업데이트 모드 - val boardEditRequest = - PutBoardRequest( - title, - content, - maxPerson, - cheerClubId, - preferredGender, - preferredAgeRange, - true, - gameRequest, - ) - addPostViewModel.putBoard(addPostViewModel.boardInfo.value?.boardId!!, boardEditRequest) - } else { - isTempSave = false - val boardWriteRequest = - PostBoardRequest( - boardId = - if (addPostViewModel.isTempMode.value == true) { // 임시 저장 게시물을 정식 게시글로 등록 - addPostViewModel.getTempBoardResponse.value?.boardId - } else { // 새 게시글을 등록 - null - }, - title = title, - content = content, - maxPerson = maxPerson, - cheerClubId = cheerClubId, - preferredGender = preferredGender, - preferredAgeRange = preferredAgeRange, - completed = true, - gameRequest = gameRequest, - ) - addPostViewModel.postBoard(boardWriteRequest) + when (currentMode) { + BoardMode.New -> { // 새 게시글을 등록하는 경우 + val boardWriteRequest = + PostBoardRequest( + title = title, + content = content, + maxPerson = maxPerson, + cheerClubId = cheerClubId, + preferredGender = preferredGender, + preferredAgeRange = preferredAgeRange, + completed = true, + gameCreateRequest = gameRequest, + ) + addPostViewModel.postBoard(boardWriteRequest) + } + + is BoardMode.Edit -> { // 기존 게시글 수정 + val boardEditRequest = + PutBoardRequest( + title, + content, + maxPerson, + cheerClubId, + preferredGender, + preferredAgeRange, + true, + gameRequest, + ) + addPostViewModel.putBoard((currentMode as BoardMode.Edit).boardInfo.boardId, boardEditRequest) + } + + is BoardMode.Temp -> { // 임시저장 게시글 등록 + val boardRequest = + PutBoardRequest( + title, + content, + maxPerson, + cheerClubId, + preferredGender, + preferredAgeRange, + true, + gameRequest, + ) + addPostViewModel.putBoard((currentMode as BoardMode.Temp).boardId, boardRequest) + } } } } @@ -418,15 +435,8 @@ class AddPostFragment : ) } - // addPostViewModel.isTempMode.value == true이면 임시저장boarddata의 boardId, false이면 null val tempBoard = PostBoardRequest( - boardId = - if (addPostViewModel.isTempMode.value == true) { // 임시 저장했던 글을 덮어쓰기 - addPostViewModel.getTempBoardResponse.value?.boardId - } else { // 새로운 글을 임시저장 - null - }, title = title, content = content, maxPerson = maxPerson, @@ -434,9 +444,9 @@ class AddPostFragment : preferredGender = preferredGender, preferredAgeRange = preferredAgeRange, completed = false, - gameRequest = gameRequest, + gameCreateRequest = gameRequest, ) - isTempSave = true + currentMode = BoardMode.Temp(addPostViewModel.getTempBoardResponse.value?.boardId!!) addPostViewModel.postBoard(tempBoard) } } @@ -547,7 +557,7 @@ class AddPostFragment : binding.apply { tvAddPostPeopleCount.setOnClickListener { val peopleCountBottomSheet = - if (isEditMode) { // 수정 시 currentPerson 값 전달해서 현재 참여한 인원보다 적은 수 선택할 수 없게 지정 + if (currentMode is BoardMode.Edit) { // 수정 시 currentPerson 값 전달해서 현재 참여한 인원보다 적은 수 선택할 수 없게 지정 PostHeadCountBottomSheetFragment( addPostViewModel.boardInfo.value?.maxPerson, addPostViewModel.boardInfo.value?.currentPerson, @@ -721,6 +731,7 @@ class AddPostFragment : tempBoard.cheerClub?.clubId, tempBoard.game, ) + currentMode = BoardMode.Temp(tempBoard.boardId) dialog.dismiss() } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/ReadPostFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/ReadPostFragment.kt index 2376f96a..db1379ae 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/ReadPostFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/post/ReadPostFragment.kt @@ -17,6 +17,7 @@ import androidx.fragment.app.viewModels import androidx.navigation.NavOptions import androidx.navigation.fragment.findNavController import com.bumptech.glide.Glide +import com.catchmate.domain.model.board.BoardMode import com.catchmate.domain.model.board.GetBoardResponse import com.catchmate.domain.model.enroll.PostEnrollRequest import com.catchmate.domain.model.enumclass.EnrollState @@ -116,8 +117,7 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB R.id.menuitem_post_update -> { val bundle = Bundle().apply { - putParcelable("boardInfo", readPostViewModel.getBoardResponse.value) - putBoolean("isEditMode", true) + putParcelable("boardMode", BoardMode.Edit(readPostViewModel.getBoardResponse.value!!)) } findNavController().navigate(R.id.action_readPostFragment_to_addPostFragment, bundle) Log.d("UPDATE", "") @@ -197,7 +197,9 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB } btnLikedFooterRegister.setOnClickListener { when (readPostViewModel.boardEnrollState.value) { - EnrollState.APPLY -> { + EnrollState.APPLY, + EnrollState.REJECTED, + -> { if (isFinishedGame) { showFinishedGameAlertDialog() } else { @@ -205,9 +207,15 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB } } - EnrollState.APPLIED -> { - // 신청 확인 버튼 클릭 시 내가 보낸 신청 불러오는 api 호출 후 옵저버에서 신청 정보 다이얼로그 표시 처리 - readPostViewModel.getRequestedEnroll(boardId) + EnrollState.CANCEL -> { + // 신청 확인 버튼 클릭 시 + // 현재 페이지에서 신청 이루어진 경우라면 직관 신청 등록 response의 enrollId로, + // 이전에 신청한 적 있는 게시글인 경우라면 게시글 불러오기 response의 myEnrollId + if (readPostViewModel.getBoardResponse.value?.myEnrollId == null) { + readPostViewModel.getEnroll(readPostViewModel.postEnrollResponse.value?.enrollId!!) + } else { + readPostViewModel.getEnroll(readPostViewModel.getBoardResponse.value?.myEnrollId!!) + } } EnrollState.VIEW_CHAT -> { @@ -251,13 +259,15 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB readPostViewModel.boardEnrollState.observe(viewLifecycleOwner) { state -> binding.layoutReadPostFooter.btnLikedFooterRegister.apply { when (state) { - EnrollState.APPLY -> { + EnrollState.APPLY, + EnrollState.REJECTED, + -> { setText(R.string.post_register) setBackgroundResource(R.drawable.shape_all_submit_button) setTextColor(ContextCompat.getColor(requireContext(), R.color.grey0)) } - EnrollState.APPLIED -> { + EnrollState.CANCEL -> { setText(R.string.post_check_register) setBackgroundResource(R.drawable.shape_all_team_toggle_selected_bg) setTextColor(ContextCompat.getColor(requireContext(), R.color.brand500)) @@ -274,7 +284,7 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB readPostViewModel.postEnrollResponse.observe(viewLifecycleOwner) { response -> if (response != null) { Log.i("직관 신청 성공", "${response.enrollId} / ${response.requestAt}") - readPostViewModel.setBoardEnrollState(EnrollState.APPLIED) + readPostViewModel.setBoardEnrollState(EnrollState.CANCEL) Snackbar.make(requireView(), R.string.post_enroll_success, Snackbar.LENGTH_SHORT).show() } } @@ -283,7 +293,7 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB setFragmentResult("deleteBoardResultKey", bundleOf("position" to position)) findNavController().popBackStack() } - readPostViewModel.getRequestedEnroll.observe(viewLifecycleOwner) { response -> + readPostViewModel.getEnroll.observe(viewLifecycleOwner) { response -> if (response != null) { showEnrollRequestDialog() } @@ -393,8 +403,9 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB when (post.buttonStatus) { EnrollState.APPLY.toString() -> readPostViewModel.setBoardEnrollState(EnrollState.APPLY) - EnrollState.APPLIED.toString() -> readPostViewModel.setBoardEnrollState(EnrollState.APPLIED) + EnrollState.CANCEL.toString() -> readPostViewModel.setBoardEnrollState(EnrollState.CANCEL) EnrollState.VIEW_CHAT.toString() -> readPostViewModel.setBoardEnrollState(EnrollState.VIEW_CHAT) + EnrollState.REJECTED.toString() -> readPostViewModel.setBoardEnrollState(EnrollState.REJECTED) else -> Log.d("BUTTON STATUS NULL", "BUTTON STATUS NULL") } } @@ -559,17 +570,19 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB val dialog = builder.create() dialogBinding.apply { - val enrollInfo = readPostViewModel.getRequestedEnroll.value!! - val boardInfo = readPostViewModel.getBoardResponse.value!! + val enrollInfo = readPostViewModel.getEnroll.value!! - val dateTimePair = DateUtils.formatISODateTimeToDateTime(boardInfo.game.gameStartDate!!) + val dateTimePair = DateUtils.formatISODateTimeToDateTime(enrollInfo.boardResponse.gameResponse.gameStartDate!!) tvApplicationDetailDialogDate.text = dateTimePair.first tvApplicationDetailDialogTime.text = dateTimePair.second - tvApplicationDetailDialogPlace.text = boardInfo.game.location + tvApplicationDetailDialogPlace.text = enrollInfo.boardResponse.gameResponse.location - val isCheerTeam = boardInfo.game.homeClub?.clubId == boardInfo.cheerClub.clubId + val isCheerTeam = + enrollInfo.boardResponse.gameResponse.homeClub + ?.clubId == enrollInfo.boardResponse.cheerClub.clubId setTeamViewResources( - boardInfo.game.homeClub?.clubId ?: 0, + enrollInfo.boardResponse.gameResponse.homeClub + ?.clubId ?: 0, isCheerTeam, ivApplicationDetailDialogHomeTeamBg, ivApplicationDetailDialogHomeTeamLogo, @@ -577,7 +590,8 @@ class ReadPostFragment : BaseFragment(FragmentReadPostB requireContext(), ) setTeamViewResources( - boardInfo.game.awayClub?.clubId ?: 0, + enrollInfo.boardResponse.gameResponse.awayClub + ?.clubId ?: 0, !isCheerTeam, ivApplicationDetailDialogAwayTeamBg, ivApplicationDetailDialogAwayTeamLogo, diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementDetailFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementDetailFragment.kt index d885619d..6983a36d 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementDetailFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementDetailFragment.kt @@ -46,7 +46,7 @@ class AnnouncementDetailFragment : BaseFragment = mutableListOf() + private var announcementList: MutableList = mutableListOf() override fun onViewCreated( view: View, @@ -64,7 +64,7 @@ class AnnouncementFragment : (recyclerView.layoutManager as LinearLayoutManager) .findLastCompletelyVisibleItemPosition() val itemTotalCount = recyclerView.adapter!!.itemCount - if (lastVisibleItemPosition + 1 >= itemTotalCount && !isLastPage && !isLoading) { + if (lastVisibleItemPosition + 1 >= itemTotalCount && hasNext && !isLoading) { currentPage += 1 getNoticeList() } @@ -77,17 +77,17 @@ class AnnouncementFragment : private fun initViewModel() { announcementViewModel.getNoticeListResponse.observe(viewLifecycleOwner) { response -> - if (response.isFirst && response.isLast && response.totalElements == 0) { + if (!response.hasNext && response.totalElements == 0) { binding.rvAnnouncement.visibility = View.GONE binding.layoutAnnouncementNoList.visibility = View.VISIBLE } else { binding.rvAnnouncement.visibility = View.VISIBLE binding.layoutAnnouncementNoList.visibility = View.GONE if (isApiCalled) { - announcementList.addAll(response.noticeInfoList) + announcementList.addAll(response.content) } - announcementListAdapter?.submitList(response.noticeInfoList) - isLastPage = response.isLast + announcementListAdapter?.submitList(response.content) + hasNext = response.hasNext isLoading = false } isApiCalled = false @@ -112,7 +112,7 @@ class AnnouncementFragment : } private fun getNoticeList() { - if (isLoading || isLastPage) return + if (isLoading || !hasNext) return isLoading = true announcementViewModel.getNoticeList(currentPage) isApiCalled = true diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementListAdapter.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementListAdapter.kt index c4c83e74..0c401b19 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementListAdapter.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/AnnouncementListAdapter.kt @@ -5,20 +5,20 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.catchmate.domain.model.support.NoticeInfo +import com.catchmate.domain.model.support.NoticeListInfo import com.catchmate.presentation.databinding.ItemAnnouncementBinding import com.catchmate.presentation.interaction.OnAnnouncementItemClickListener import com.catchmate.presentation.util.DateUtils.formatInquiryAnsweredDate class AnnouncementListAdapter( private val onAnnouncementItemClickListener: OnAnnouncementItemClickListener, -) : ListAdapter(diffUtil) { +) : ListAdapter(diffUtil) { inner class AnnouncementViewHolder( private val binding: ItemAnnouncementBinding, ) : RecyclerView.ViewHolder(binding.root) { - fun bind(data: NoticeInfo) { + fun bind(data: NoticeListInfo) { binding.tvTitleItemAnnouncement.text = data.title - binding.tvTeamAndDateInfoAnnouncement.text = "${data.userInfo.nickName} | ${formatInquiryAnsweredDate(data.updatedAt)}" + binding.tvTeamAndDateInfoAnnouncement.text = "${data.writerNickname} | ${formatInquiryAnsweredDate(data.createdAt)}" binding.cvItemAnnouncement.setOnClickListener { onAnnouncementItemClickListener.onAnnouncementItemClick(data.noticeId) } @@ -46,15 +46,15 @@ class AnnouncementListAdapter( companion object { val diffUtil = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: NoticeInfo, - newItem: NoticeInfo, + oldItem: NoticeListInfo, + newItem: NoticeListInfo, ): Boolean = oldItem == newItem override fun areContentsTheSame( - oldItem: NoticeInfo, - newItem: NoticeInfo, + oldItem: NoticeListInfo, + newItem: NoticeListInfo, ): Boolean = oldItem == newItem } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ReportFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ReportFragment.kt index 3f48bbeb..083b5349 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ReportFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ReportFragment.kt @@ -45,10 +45,11 @@ class ReportFragment : BaseFragment(FragmentReportBinding // 신고 버튼 클릭 시 선택된 신고 타입과 edt 값(있으면) 넘기기 val request = PostUserReportRequest( + userId, getSelectedReportType(), edtContentReport.text.toString(), ) - reportViewModel.postUserReport(userId, request) + reportViewModel.postUserReport(request) } } @@ -82,7 +83,7 @@ class ReportFragment : BaseFragment(FragmentReportBinding private fun initViewModel() { reportViewModel.postUserReportResponse.observe(viewLifecycleOwner) { response -> - if (response.state) { + if (response != null) { Snackbar.make(requireView(), R.string.report_toast, Snackbar.LENGTH_SHORT).show() findNavController().popBackStack() } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ServiceCenterAnswerFragment.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ServiceCenterAnswerFragment.kt index d7863fbb..9064bfc9 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ServiceCenterAnswerFragment.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/view/support/ServiceCenterAnswerFragment.kt @@ -43,7 +43,7 @@ class ServiceCenterAnswerFragment : BaseFragment get() = _putBoardResponse - private var _isTempMode = MutableLiveData() - val isTempMode: LiveData - get() = _isTempMode - private var _getTempBoardResponse = MutableLiveData() val getTempBoardResponse: LiveData get() = _getTempBoardResponse @@ -128,10 +124,7 @@ class AddPostViewModel result .onSuccess { response -> response?.let { data -> - _isTempMode.value = true _getTempBoardResponse.value = data - } ?: run { - _isTempMode.value = false } }.onFailure { exception -> when (exception) { diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/AnnouncementViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/AnnouncementViewModel.kt index 62a15afa..bf74368b 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/AnnouncementViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/AnnouncementViewModel.kt @@ -29,9 +29,12 @@ class AnnouncementViewModel val navigateToLogin: LiveData get() = _navigateToLogin - fun getNoticeList(page: Int) { + fun getNoticeList( + page: Int = 0, + size: Int = 10, + ) { viewModelScope.launch { - val result = getNoticeListUseCase(page) + val result = getNoticeListUseCase(page, size) result .onSuccess { response -> _getNoticeListResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/BlockedSettingViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/BlockedSettingViewModel.kt index 0d314386..81d0d9f7 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/BlockedSettingViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/BlockedSettingViewModel.kt @@ -37,26 +37,29 @@ class BlockedSettingViewModel get() = _navigateToLogin fun deleteUserFromList(userId: Long) { - val userList = _getBlockedUserListResponse.value?.userInfoList!! + val userList = _getBlockedUserListResponse.value?.content!! val newUserList = userList.filter { it.userId != userId }.toMutableList() val updatedResponse = _getBlockedUserListResponse.value?.copy( - userInfoList = newUserList, + content = newUserList, ) ?: GetBlockedUserListResponse( - userInfoList = newUserList, + content = newUserList, + pageNumber = 1, totalPages = 1, - totalElements = 1, - isFirst = true, - isLast = true, + totalElements = newUserList.size, + hasNext = false, ) _getBlockedUserListResponse.postValue(updatedResponse) } - fun getBlockedUserList(page: Int) { + fun getBlockedUserList( + page: Int = 0, + size: Int = 10, + ) { viewModelScope.launch { - val result = getBlockedUserListUseCase(page) + val result = getBlockedUserListUseCase(page, size) result .onSuccess { response -> _getBlockedUserListResponse.value = response @@ -70,9 +73,9 @@ class BlockedSettingViewModel } } - fun deleteBlockedUser(blockedUserId: Long) { + fun deleteBlockedUser(targetUserId: Long) { viewModelScope.launch { - val result = deleteBlockedUserUseCase(blockedUserId) + val result = deleteBlockedUserUseCase(targetUserId) result .onSuccess { response -> _deleteBlockedUserResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ChattingHomeViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ChattingHomeViewModel.kt index 6de8a0a1..653327d5 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ChattingHomeViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ChattingHomeViewModel.kt @@ -10,6 +10,7 @@ import androidx.lifecycle.viewModelScope import com.catchmate.domain.exception.ReissueFailureException import com.catchmate.domain.model.chatting.DeleteChattingRoomResponse import com.catchmate.domain.model.chatting.GetChattingRoomListResponse +import com.catchmate.domain.model.chatting.LastMessageInfo import com.catchmate.domain.usecase.chatting.GetChattingRoomListUseCase import com.catchmate.domain.usecase.chatting.LeaveChattingRoomUseCase import com.catchmate.presentation.BuildConfig @@ -100,37 +101,37 @@ class ChattingHomeViewModel } private fun handleWebSocketOpened() { - topic = - stompClient?.topic("/topic/chatList")!!.subscribe { msg -> - Log.i("✅ New Msg", msg.payload) - val jsonObject = JSONObject(msg.payload) - val chatRoomId = jsonObject.getString("chatRoomId").toLong() - val content = jsonObject.getString("content") - val sentTime = jsonObject.getString("sendTime") - updateLastChat(chatRoomId, content, sentTime) - } +// topic = +// stompClient?.topic("/topic/chatList")!!.subscribe { msg -> +// Log.i("✅ New Msg", msg.payload) +// val jsonObject = JSONObject(msg.payload) +// val chatRoomId = jsonObject.getString("chatRoomId").toLong() +// val content = jsonObject.getString("content") +// val sentTime = jsonObject.getString("sendTime") +// updateLastChat(chatRoomId, content, sentTime) +// } } - private fun updateLastChat( - chatRoomId: Long, - newContent: String, - newSentTime: String, - ) { - val currentResponse = _getChattingRoomListResponse.value - val currentList = (currentResponse?.chatRoomInfoList ?: emptyList()).toMutableList() - val targetIndex = currentList.indexOfFirst { it.chatRoomId == chatRoomId } - if (currentList.isNotEmpty() && targetIndex != -1) { // 해당하는 채팅방이 현재 목록에 있을때만 반영되도록 - currentList[targetIndex] = - currentList[targetIndex].copy( - lastMessageContent = newContent, - lastMessageAt = newSentTime, - isNewChatRoom = false, - unreadMessageCount = currentList[targetIndex].unreadMessageCount + 1, - ) - val updatedResponse = currentResponse?.copy(chatRoomInfoList = currentList)!! - _getChattingRoomListResponse.postValue(updatedResponse) - } - } +// private fun updateLastChat( +// chatRoomId: Long, +// newContent: String, +// newSentTime: String, +// ) { +// val currentResponse = _getChattingRoomListResponse.value +// val currentList = (currentResponse?.chatRoomInfoList ?: emptyList()).toMutableList() +// val targetIndex = currentList.indexOfFirst { it.chatRoomId == chatRoomId } +// if (currentList.isNotEmpty() && targetIndex != -1) { // 해당하는 채팅방이 현재 목록에 있을때만 반영되도록 +// currentList[targetIndex] = +// currentList[targetIndex].copy( +// lastMessageContent = newContent, +// lastMessageAt = newSentTime, +// isNewChatRoom = false, +// unreadMessageCount = currentList[targetIndex].unreadMessageCount + 1, +// ) +// val updatedResponse = currentResponse?.copy(chatRoomInfoList = currentList)!! +// _getChattingRoomListResponse.postValue(updatedResponse) +// } +// } override fun onCleared() { super.onCleared() @@ -138,9 +139,12 @@ class ChattingHomeViewModel stompClient?.disconnect() } - fun getChattingRoomList(page: Int) { + fun getChattingRoomList( + page: Int = 0, + size: Int = 20, + ) { viewModelScope.launch { - val result = getChattingRoomListUseCase.getChattingRoomList(page) + val result = getChattingRoomListUseCase.getChattingRoomList(page, size) result .onSuccess { response -> _getChattingRoomListResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MainViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MainViewModel.kt index b672b2e3..cd83c9a3 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MainViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MainViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.catchmate.domain.exception.ReissueFailureException -import com.catchmate.domain.model.user.GetUnreadInfoResponse -import com.catchmate.domain.usecase.user.GetUnreadInfoUseCase +import com.catchmate.domain.model.notification.GetHasUnreadNotificationResponse +import com.catchmate.domain.usecase.notification.GetHasUnreadNotificationUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import javax.inject.Inject @@ -15,11 +15,11 @@ import javax.inject.Inject class MainViewModel @Inject constructor( - private val getUnreadInfoUseCase: GetUnreadInfoUseCase, + private val getHasUnreadNotificationUseCase: GetHasUnreadNotificationUseCase, ) : ViewModel() { - private val _getUnreadInfoResponse = MutableLiveData() - val getUnreadInfoResponse: LiveData - get() = _getUnreadInfoResponse + private val _getHasUnreadNotificationResponse = MutableLiveData() + val getHasUnreadNotificationResponse: LiveData + get() = _getHasUnreadNotificationResponse private val _isGuestLogin = MutableLiveData() val isGuestLogin: LiveData get() = _isGuestLogin @@ -36,12 +36,12 @@ class MainViewModel _isGuestLogin.value = isGuest } - fun getUnreadInfo() { + fun getHasUnreadNotification() { viewModelScope.launch { - val result = getUnreadInfoUseCase() + val result = getHasUnreadNotificationUseCase() result - .onSuccess { unreadInfo -> - _getUnreadInfoResponse.value = unreadInfo + .onSuccess { response -> + _getHasUnreadNotificationResponse.value = response }.onFailure { exception -> if (exception is ReissueFailureException) { _navigateToLogin.value = true diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPageViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPageViewModel.kt index ed1a8086..2e1cee1c 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPageViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPageViewModel.kt @@ -36,7 +36,12 @@ class MyPageViewModel val navigateToLogin: LiveData get() = _navigateToLogin + fun updateUserProfile(profile: GetUserProfileResponse) { + _userProfile.value = profile + } + fun getUserProfile() { + if (_userProfile.value != null) return viewModelScope.launch { val result = getUserProfileUseCase.getUserProfile() result diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPostViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPostViewModel.kt index 18cf2d3d..e6e3c04e 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPostViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/MyPostViewModel.kt @@ -43,10 +43,11 @@ class MyPostViewModel fun getUserBoardList( userId: Long, - page: Int, + page: Int = 0, + size: Int = 10, ) { viewModelScope.launch { - val result = getUserBoardListUseCase.getUserBoardList(userId, page) + val result = getUserBoardListUseCase.getUserBoardList(userId, page, size) result .onSuccess { response -> _getUserBoardListResponse.value = response @@ -60,9 +61,9 @@ class MyPostViewModel } } - fun postUserBlock(blockedUserId: Long) { + fun postUserBlock(targetUserId: Long) { viewModelScope.launch { - val result = postUserBlockUseCase(blockedUserId) + val result = postUserBlockUseCase(targetUserId) result .onSuccess { response -> _postUserBlockResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationSettingViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationSettingViewModel.kt index 9b6fdd41..4a4ab024 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationSettingViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationSettingViewModel.kt @@ -5,7 +5,9 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.catchmate.domain.exception.ReissueFailureException +import com.catchmate.domain.model.user.GetUserAlarmResponse import com.catchmate.domain.model.user.PatchUserAlarmResponse +import com.catchmate.domain.usecase.user.GetUserAlarmResponseUseCase import com.catchmate.domain.usecase.user.PatchUserAlarmUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch @@ -16,11 +18,16 @@ class NotificationSettingViewModel @Inject constructor( private val patchUserAlarmUseCase: PatchUserAlarmUseCase, + private val getUserAlarmResponseUseCase: GetUserAlarmResponseUseCase, ) : ViewModel() { private val _patchUserAlarmResponse = MutableLiveData() val patchUserAlarmResponse: LiveData get() = _patchUserAlarmResponse + private val _getUserAlarmResponse = MutableLiveData() + val getUserAlarmResponse: LiveData + get() = _getUserAlarmResponse + private val _errorMessage = MutableLiveData() val errorMessage: LiveData get() = _errorMessage @@ -47,4 +54,20 @@ class NotificationSettingViewModel } } } + + fun getUserAlarm() { + viewModelScope.launch { + val result = getUserAlarmResponseUseCase() + result + .onSuccess { response -> + _getUserAlarmResponse.value = response + }.onFailure { exception -> + if (exception is ReissueFailureException) { + _navigateToLogin.value = true + } else { + _errorMessage.value = exception.message + } + } + } + } } diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationViewModel.kt index 030c8dc0..e78a30e9 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/NotificationViewModel.kt @@ -5,11 +5,10 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.catchmate.domain.exception.ReissueFailureException -import com.catchmate.domain.model.notification.DeleteReceivedNotificationResponse -import com.catchmate.domain.model.notification.GetReceivedNotificationListResponse +import com.catchmate.domain.model.notification.GetNotificationListResponse import com.catchmate.domain.model.notification.GetReceivedNotificationResponse -import com.catchmate.domain.usecase.notification.DeleteReceivedNotificationUseCase -import com.catchmate.domain.usecase.notification.GetReceivedNotificationListUseCase +import com.catchmate.domain.usecase.notification.DeleteNotificationUseCase +import com.catchmate.domain.usecase.notification.GetNotificationListUseCase import com.catchmate.domain.usecase.notification.GetReceivedNotificationUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch @@ -19,20 +18,20 @@ import javax.inject.Inject class NotificationViewModel @Inject constructor( - private val getReceivedNotificationListUseCase: GetReceivedNotificationListUseCase, + private val getNotificationListUseCase: GetNotificationListUseCase, private val getReceivedNotificationUseCase: GetReceivedNotificationUseCase, - private val deleteReceivedNotificationUseCase: DeleteReceivedNotificationUseCase, + private val deleteNotificationUseCase: DeleteNotificationUseCase, ) : ViewModel() { - private val _receivedNotificationList = MutableLiveData() - val receivedNotificationList: LiveData + private val _receivedNotificationList = MutableLiveData() + val receivedNotificationList: LiveData get() = _receivedNotificationList private val _receivedNotification = MutableLiveData() val receivedNotification: LiveData get() = _receivedNotification - private val _deletedNotificationResponse = MutableLiveData() - val deletedNotificationResponse: LiveData + private val _deletedNotificationResponse = MutableLiveData() + val deletedNotificationResponse: LiveData get() = _deletedNotificationResponse private val _errorMessage = MutableLiveData() @@ -43,9 +42,12 @@ class NotificationViewModel val navigateToLogin: LiveData get() = _navigateToLogin - fun getReceivedNotificationList(page: Int) { + fun getNotificationList( + page: Int = 0, + size: Int = 10, + ) { viewModelScope.launch { - val result = getReceivedNotificationListUseCase.getReceivedNotificationList(page) + val result = getNotificationListUseCase(page, size) result .onSuccess { response -> _receivedNotificationList.value = response @@ -77,7 +79,7 @@ class NotificationViewModel fun deleteNotification(notificationId: Long) { viewModelScope.launch { - val result = deleteReceivedNotificationUseCase.deleteReceivedNotification(notificationId) + val result = deleteNotificationUseCase(notificationId) result .onSuccess { response -> _deletedNotificationResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReadPostViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReadPostViewModel.kt index 033ded46..e2deb876 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReadPostViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReadPostViewModel.kt @@ -10,7 +10,7 @@ import com.catchmate.domain.exception.ReissueFailureException import com.catchmate.domain.model.board.GetBoardResponse import com.catchmate.domain.model.board.PatchBoardLiftUpResponse import com.catchmate.domain.model.enroll.DeleteEnrollResponse -import com.catchmate.domain.model.enroll.GetRequestedEnrollResponse +import com.catchmate.domain.model.enroll.GetEnrollResponse import com.catchmate.domain.model.enroll.PostEnrollRequest import com.catchmate.domain.model.enroll.PostEnrollResponse import com.catchmate.domain.model.enumclass.EnrollState @@ -19,7 +19,7 @@ import com.catchmate.domain.usecase.board.GetBoardUseCase import com.catchmate.domain.usecase.board.PatchBoardLiftUpUseCase import com.catchmate.domain.usecase.board.PostBoardLikeUseCase import com.catchmate.domain.usecase.enroll.DeleteEnrollUseCase -import com.catchmate.domain.usecase.enroll.GetRequestedEnrollUseCase +import com.catchmate.domain.usecase.enroll.GetEnrollUseCase import com.catchmate.domain.usecase.enroll.PostEnrollUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch @@ -34,7 +34,7 @@ class ReadPostViewModel private val postBoardLikeUseCase: PostBoardLikeUseCase, private val postEnrollUseCase: PostEnrollUseCase, private val patchBoardLiftUpUseCase: PatchBoardLiftUpUseCase, - private val getRequestedEnrollUseCase: GetRequestedEnrollUseCase, + private val getEnrollUseCase: GetEnrollUseCase, private val deleteEnrollUseCase: DeleteEnrollUseCase, ) : ViewModel() { private val _getBoardResponse = MutableLiveData() @@ -61,9 +61,9 @@ class ReadPostViewModel val patchBoardLiftUpResponse: LiveData get() = _patchBoardLiftUpResponse - private val _getRequestedEnroll = MutableLiveData() - val getRequestedEnroll: LiveData - get() = _getRequestedEnroll + private val _getEnroll = MutableLiveData() + val getEnroll: LiveData + get() = _getEnroll private val _deleteEnrollResponse = MutableLiveData() val deleteEnrollResponse: LiveData @@ -178,12 +178,12 @@ class ReadPostViewModel } } - fun getRequestedEnroll(boardId: Long) { + fun getEnroll(enrollId: Long) { viewModelScope.launch { - val result = getRequestedEnrollUseCase(boardId) + val result = getEnrollUseCase(enrollId) result .onSuccess { response -> - _getRequestedEnroll.value = response + _getEnroll.value = response }.onFailure { exception -> when (exception) { is ReissueFailureException -> { diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedEnrollScrollDialogViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedEnrollScrollDialogViewModel.kt index 6e24cc87..0b3f70f6 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedEnrollScrollDialogViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedEnrollScrollDialogViewModel.kt @@ -43,9 +43,13 @@ class ReceivedEnrollScrollDialogViewModel val navigateToLogin: LiveData get() = _navigateToLogin - fun getReceivedEnroll(boardId: Long) { + fun getReceivedEnroll( + boardId: Long, + page: Int = 0, + size: Int = 10, + ) { viewModelScope.launch { - val result = getReceivedEnrollUseCase.getReceivedEnroll(boardId) + val result = getReceivedEnrollUseCase.getReceivedEnroll(boardId, page, size) result .onSuccess { response -> _getReceivedEnrollResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedJoinViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedJoinViewModel.kt index b596a72e..80612c13 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedJoinViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReceivedJoinViewModel.kt @@ -29,9 +29,12 @@ class ReceivedJoinViewModel val navigateToLogin: LiveData get() = _navigateToLogin - fun getAllReceivedEnroll(page: Int) { + fun getAllReceivedEnroll( + page: Int = 0, + size: Int = 10, + ) { viewModelScope.launch { - val result = getAllReceivedEnrollUseCase.getAllReceivedEnroll(page) + val result = getAllReceivedEnrollUseCase.getAllReceivedEnroll(page, size) result .onSuccess { response -> _getAllReceivedEnrollResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReportViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReportViewModel.kt index 81450bef..29b8c9cb 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReportViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/ReportViewModel.kt @@ -30,12 +30,9 @@ class ReportViewModel val navigateToLogin: LiveData get() = _navigateToLogin - fun postUserReport( - reportedUserId: Long, - request: PostUserReportRequest, - ) { + fun postUserReport(request: PostUserReportRequest) { viewModelScope.launch { - val result = postUserReportUseCase(reportedUserId, request) + val result = postUserReportUseCase(request) result .onSuccess { response -> _postUserReportResponse.value = response diff --git a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/SentJoinViewModel.kt b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/SentJoinViewModel.kt index 0fa49c64..0fb66697 100644 --- a/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/SentJoinViewModel.kt +++ b/CatchMate/presentation/src/main/java/com/catchmate/presentation/viewmodel/SentJoinViewModel.kt @@ -29,9 +29,12 @@ class SentJoinViewModel val navigateToLogin: LiveData get() = _navigateToLogin - fun getRequestedEnrollList(page: Int) { + fun getRequestedEnrollList( + page: Int = 0, + size: Int = 10, + ) { viewModelScope.launch { - val result = getRequestedEnrollListUseCase.getRequestedEnrollList(page) + val result = getRequestedEnrollListUseCase.getRequestedEnrollList(page, size) result .onSuccess { response -> _requestedEnrollList.value = response