-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from Project-Unifest/feature/waiting-tab-conn…
…ection [feat] [#229] 웨이팅 탭 api들 연결
- Loading branch information
Showing
20 changed files
with
409 additions
and
58 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
19 changes: 19 additions & 0 deletions
19
core/data/src/main/kotlin/com/unifest/android/core/data/mapper/MyWaitingMapper.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,19 @@ | ||
package com.unifest.android.core.data.mapper | ||
|
||
import com.unifest.android.core.model.MyWaitingModel | ||
import com.unifest.android.core.network.response.MyWaiting | ||
|
||
internal fun MyWaiting.toModel(): MyWaitingModel { | ||
return MyWaitingModel( | ||
boothId = boothId, | ||
waitingId = waitingId, | ||
partySize = partySize, | ||
tel = tel, | ||
deviceId = deviceId, | ||
createdAt = createdAt, | ||
updatedAt = updatedAt, | ||
status = status, | ||
waitingOrder = waitingOrder, | ||
boothName = boothName, | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
core/data/src/main/kotlin/com/unifest/android/core/data/repository/WaitingRepository.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,8 @@ | ||
package com.unifest.android.core.data.repository | ||
|
||
import com.unifest.android.core.model.MyWaitingModel | ||
|
||
interface WaitingRepository { | ||
suspend fun getMyWaitingList(): Result<List<MyWaitingModel>> | ||
suspend fun cancelBoothWaiting(waitingId: Long): Result<Unit> | ||
} |
30 changes: 30 additions & 0 deletions
30
core/data/src/main/kotlin/com/unifest/android/core/data/repository/WaitingRepositoryImpl.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,30 @@ | ||
package com.unifest.android.core.data.repository | ||
|
||
import android.content.Context | ||
import com.unifest.android.core.common.getDeviceId | ||
import com.unifest.android.core.data.mapper.toModel | ||
import com.unifest.android.core.data.util.runSuspendCatching | ||
import com.unifest.android.core.network.request.WaitingRequest | ||
import com.unifest.android.core.network.service.UnifestService | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import javax.inject.Inject | ||
|
||
class WaitingRepositoryImpl @Inject constructor( | ||
@ApplicationContext private val context: Context, | ||
private val service: UnifestService, | ||
) : WaitingRepository { | ||
override suspend fun getMyWaitingList() = runSuspendCatching { | ||
service.getMyWaitingList( | ||
deviceId = getDeviceId(context), | ||
).data?.map { it.toModel() } ?: emptyList() | ||
} | ||
|
||
override suspend fun cancelBoothWaiting(waitingId: Long): Result<Unit> = runSuspendCatching { | ||
service.cancelBoothWaiting( | ||
WaitingRequest( | ||
waitingId = waitingId, | ||
deviceId = getDeviceId(context), | ||
), | ||
).data.toModel() | ||
} | ||
} |
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
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
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
17 changes: 17 additions & 0 deletions
17
core/model/src/main/kotlin/com/unifest/android/core/model/MyWaitingModel.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,17 @@ | ||
package com.unifest.android.core.model | ||
|
||
import androidx.compose.runtime.Stable | ||
|
||
@Stable | ||
data class MyWaitingModel( | ||
val boothId: Long = 0L, | ||
val waitingId: Long = 0L, | ||
val partySize: Long = 0L, | ||
val tel: String = "", | ||
val deviceId: String = "", | ||
val createdAt: String = "", | ||
val updatedAt: String = "", | ||
val status: String = "", | ||
val waitingOrder: Long = 0L, | ||
val boothName: String = "", | ||
) |
12 changes: 12 additions & 0 deletions
12
core/network/src/main/kotlin/com/unifest/android/core/network/request/WaitingRequest.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,12 @@ | ||
package com.unifest.android.core.network.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class WaitingRequest( | ||
@SerialName("waitingId") | ||
val waitingId: Long, | ||
@SerialName("deviceId") | ||
val deviceId: String, | ||
) |
38 changes: 38 additions & 0 deletions
38
core/network/src/main/kotlin/com/unifest/android/core/network/response/MyWaitingResponse.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,38 @@ | ||
package com.unifest.android.core.network.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MyWaitingResponse( | ||
@SerialName("code") | ||
val code: String, | ||
@SerialName("message") | ||
val message: String, | ||
@SerialName("data") | ||
val data: List<MyWaiting>? = null, | ||
) | ||
|
||
@Serializable | ||
data class MyWaiting( | ||
@SerialName("boothId") | ||
val boothId: Long = 0L, | ||
@SerialName("waitingId") | ||
val waitingId: Long = 0L, | ||
@SerialName("partySize") | ||
val partySize: Long = 0L, | ||
@SerialName("tel") | ||
val tel: String = "", | ||
@SerialName("deviceId") | ||
val deviceId: String = "", | ||
@SerialName("createdAt") | ||
val createdAt: String = "", | ||
@SerialName("updatedAt") | ||
val updatedAt: String = "", | ||
@SerialName("status") | ||
val status: String = "", | ||
@SerialName("waitingOrder") | ||
val waitingOrder: Long = 0L, | ||
@SerialName("boothName") | ||
val boothName: String = "", | ||
) |
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
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
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
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
Oops, something went wrong.