-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
core/data/src/main/java/com/mashup/core/data/repository/PushHistoryRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.mashup.core.data.repository | ||
|
||
import com.mashup.core.network.Response | ||
import com.mashup.core.network.dao.PushHistoryDao | ||
import com.mashup.core.network.dto.PushHistoryResponse | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class PushHistoryRepository @Inject constructor( | ||
private val pushHistoryDao: PushHistoryDao | ||
) { | ||
suspend fun getPushHistory( | ||
page: Int, | ||
size: Int, | ||
sort: String? = null | ||
): Response<PushHistoryResponse> = | ||
pushHistoryDao.getPushHistory(page, size, sort) | ||
|
||
suspend fun getPushHistoryCheck( | ||
page: Int, | ||
size: Int, | ||
sort : String?= null | ||
) : Response<PushHistoryResponse> = | ||
pushHistoryDao.getPushHistoryCheck(page, size, sort) | ||
} |
23 changes: 23 additions & 0 deletions
23
core/network/src/main/java/com/mashup/core/network/dao/PushHistoryDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.mashup.core.network.dao | ||
|
||
import com.mashup.core.network.Response | ||
import com.mashup.core.network.dto.PushHistoryResponse | ||
import retrofit2.http.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Query | ||
|
||
interface PushHistoryDao { | ||
@GET("/api/v1/push-histories") | ||
suspend fun getPushHistory( | ||
@Query("page") page: Int, | ||
@Query("size") size: Int, | ||
@Query("sort") sort: String?, | ||
): Response<PushHistoryResponse> | ||
|
||
@POST("/api/v1/push-histories/check") | ||
suspend fun getPushHistoryCheck( | ||
@Query("page") page: Int, | ||
@Query("size") size: Int, | ||
@Query("sort") sort: String?, | ||
): Response<PushHistoryResponse> | ||
} |
14 changes: 14 additions & 0 deletions
14
core/network/src/main/java/com/mashup/core/network/dto/PushHistoryResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.mashup.core.network.dto | ||
|
||
data class PushHistoryResponse( | ||
val read: List<Notice>, | ||
val unread: List<Notice> | ||
) { | ||
data class Notice( | ||
val pushType: String, | ||
val title: String, | ||
val body: String, | ||
val linkType: String, | ||
val sendTime: String, | ||
) | ||
} |