Skip to content

Commit

Permalink
🧸 알림 API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-xyz committed Jul 13, 2024
1 parent 6fd7ebd commit 79e77db
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/src/main/java/com/mashup/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.mashup.core.model.Platform
import com.mashup.core.network.adapter.PlatformJsonAdapter
import com.mashup.core.network.dao.MetaDao
import com.mashup.core.network.dao.PopupDao
import com.mashup.core.network.dao.PushHistoryDao
import com.mashup.core.network.dao.StorageDao
import com.mashup.data.network.API_HOST
import com.mashup.network.CustomDateAdapter
Expand Down Expand Up @@ -154,4 +155,12 @@ class NetworkModule {
): MetaDao {
return retrofit.create()
}

@Provides
@Singleton
fun providePushHistoryDao(
retrofit: Retrofit
): PushHistoryDao {
return retrofit.create()
}
}
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)
}
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>
}
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,
)
}

0 comments on commit 79e77db

Please sign in to comment.