Skip to content

Commit

Permalink
feat 온보딩-선택지 제공 화면에서 내가 참여한 미션 조회 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
eshc123 committed Aug 12, 2024
1 parent 7a3ed05 commit 94c2b0f
Show file tree
Hide file tree
Showing 15 changed files with 261 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.luckyoct.core.model.base.NetworkResult
import com.luckyoct.core.model.request.CreateMissionRequest
import com.luckyoct.core.model.request.JoinMissionRequest
import com.luckyoct.core.model.response.MissionDetailResponse
import com.luckyoct.core.model.response.MissionsResponse
import javax.inject.Inject

class OnboardingRepositoryImpl @Inject constructor(
Expand All @@ -22,4 +23,8 @@ class OnboardingRepositoryImpl @Inject constructor(
override suspend fun joinMission(invitationCode: String): NetworkResult<Unit> = handleResult {
onboardingService.joinMission(JoinMissionRequest(invitationCode))
}

override suspend fun getJoinedMissions(): NetworkResult<MissionsResponse> = handleResult {
onboardingService.getJoinedMissions()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.goalpanzi.mission_mate.core.network.ResultHandler
import com.luckyoct.core.model.base.NetworkResult
import com.luckyoct.core.model.request.CreateMissionRequest
import com.luckyoct.core.model.response.MissionDetailResponse
import com.luckyoct.core.model.response.MissionsResponse

interface OnboardingRepository : ResultHandler {
suspend fun createMission(
Expand All @@ -17,4 +18,6 @@ interface OnboardingRepository : ResultHandler {
suspend fun joinMission(
invitationCode: String
) : NetworkResult<Unit>

suspend fun getJoinedMissions() : NetworkResult<MissionsResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.goalpanzi.mission_mate.core.domain.usecase

import com.goalpanzi.mission_mate.core.domain.repository.OnboardingRepository
import com.luckyoct.core.model.base.NetworkResult
import com.luckyoct.core.model.response.MissionsResponse
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class GetJoinedMissionsUseCase @Inject constructor(
private val onboardingRepository: OnboardingRepository
) {
operator fun invoke(): Flow<NetworkResult<MissionsResponse>> = flow {
emit(onboardingRepository.getJoinedMissions())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.luckyoct.core.model.response

import kotlinx.serialization.Serializable

@Serializable
data class MissionResponse(
val missionId : Long,
val description : String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.luckyoct.core.model.response

import kotlinx.serialization.Serializable

@Serializable
data class MissionsResponse(
val profile : ProfileResponse,
val missions : List<MissionResponse>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.luckyoct.core.model.response

import kotlinx.serialization.Serializable

@Serializable
data class ProfileResponse(
val nickname : String,
val characterType : String
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.goalpanzi.mission_mate.core.network.service
import com.luckyoct.core.model.request.CreateMissionRequest
import com.luckyoct.core.model.request.JoinMissionRequest
import com.luckyoct.core.model.response.MissionDetailResponse
import com.luckyoct.core.model.response.MissionsResponse
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query
Expand All @@ -25,4 +25,7 @@ interface OnboardingService {
suspend fun joinMission(
@Body request : JoinMissionRequest
) : Response<Unit>

@GET("/api/mission-members/me")
suspend fun getJoinedMissions() : Response<MissionsResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ internal fun MainNavHost(
onboardingNavGraph(
onClickBoardSetup = { navigator.navigationToBoardSetup() },
onClickInvitationCode = { navigator.navigationToInvitationCode() },
onClickSetting = { }
onClickSetting = { },
onNavigateMissionBoard = { missionId ->

}
)
boardSetupNavGraph(
onSuccess = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ fun NavController.navigateToInvitationCode() {
fun NavGraphBuilder.onboardingNavGraph(
onClickBoardSetup: () -> Unit,
onClickInvitationCode: () -> Unit,
onClickSetting: () -> Unit
onClickSetting: () -> Unit,
onNavigateMissionBoard : (Long) -> Unit
) {
composable<RouteModel.Onboarding> {
OnboardingRoute(
onClickBoardSetup = onClickBoardSetup,
onClickInvitationCode = onClickInvitationCode,
onClickSetting = onClickSetting
onClickSetting = onClickSetting,
onNavigateMissionBoard = onNavigateMissionBoard
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.goalpanzi.mission_mate.feature.onboarding.model

import com.luckyoct.core.model.response.MissionResponse

sealed class OnboardingResultEvent {
data class SuccessWithJoinedMissions(val mission : MissionResponse) : OnboardingResultEvent()
data object Error : OnboardingResultEvent()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.goalpanzi.mission_mate.feature.onboarding.model

import com.luckyoct.core.model.response.ProfileResponse

sealed class OnboardingUiModel {
data object Loading : OnboardingUiModel()
data class Success(val profileResponse: ProfileResponse) : OnboardingUiModel()
}
Loading

0 comments on commit 94c2b0f

Please sign in to comment.