-
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 #24 from Nexters/feature/implement-onboarding-api
Feature/implement onboarding api
- Loading branch information
Showing
24 changed files
with
474 additions
and
117 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
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
16 changes: 16 additions & 0 deletions
16
.../src/main/java/com/goalpanzi/mission_mate/core/domain/usecase/GetJoinedMissionsUseCase.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,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()) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../java/com/goalpanzi/mission_mate/core/domain/usecase/GetMissionByInvitationCodeUseCase.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,18 @@ | ||
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.MissionDetailResponse | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
import javax.inject.Inject | ||
|
||
class GetMissionByInvitationCodeUseCase @Inject constructor( | ||
private val onboardingRepository: OnboardingRepository | ||
) { | ||
operator fun invoke( | ||
invitationCode: String | ||
): Flow<NetworkResult<MissionDetailResponse>> = flow { | ||
emit(onboardingRepository.getMissionByInvitationCode(invitationCode)) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...domain/src/main/java/com/goalpanzi/mission_mate/core/domain/usecase/JoinMissionUseCase.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.goalpanzi.mission_mate.core.domain.usecase | ||
|
||
import com.goalpanzi.mission_mate.core.domain.repository.OnboardingRepository | ||
import com.luckyoct.core.model.base.NetworkResult | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
import javax.inject.Inject | ||
|
||
class JoinMissionUseCase @Inject constructor( | ||
private val onboardingRepository: OnboardingRepository | ||
) { | ||
operator fun invoke( | ||
invitationCode: String | ||
): Flow<NetworkResult<Unit>> = flow { | ||
emit(onboardingRepository.joinMission(invitationCode)) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
core/model/src/main/java/com/luckyoct/core/model/request/JoinMissionRequest.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.luckyoct.core.model.request | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class JoinMissionRequest( | ||
val invitationCode : 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
9 changes: 9 additions & 0 deletions
9
core/model/src/main/java/com/luckyoct/core/model/response/MissionResponse.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,9 @@ | ||
package com.luckyoct.core.model.response | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MissionResponse( | ||
val missionId : Long, | ||
val description : String | ||
) |
9 changes: 9 additions & 0 deletions
9
core/model/src/main/java/com/luckyoct/core/model/response/MissionsResponse.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,9 @@ | ||
package com.luckyoct.core.model.response | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MissionsResponse( | ||
val profile : ProfileResponse, | ||
val missions : List<MissionResponse> | ||
) |
9 changes: 9 additions & 0 deletions
9
core/model/src/main/java/com/luckyoct/core/model/response/ProfileResponse.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,9 @@ | ||
package com.luckyoct.core.model.response | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ProfileResponse( | ||
val nickname : String, | ||
val characterType : String | ||
) |
17 changes: 17 additions & 0 deletions
17
...etwork/src/main/java/com/goalpanzi/mission_mate/core/network/service/OnboardingService.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 |
---|---|---|
@@ -1,14 +1,31 @@ | ||
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.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Query | ||
|
||
interface OnboardingService { | ||
@POST("/api/missions") | ||
suspend fun createMission( | ||
@Body request: CreateMissionRequest | ||
): Response<MissionDetailResponse> | ||
|
||
@GET("/api/missions") | ||
suspend fun getMissionByInvitationCode( | ||
@Query("invitationCode") invitationCode : String | ||
) : Response<MissionDetailResponse> | ||
|
||
@POST("/api/mission-members") | ||
suspend fun joinMission( | ||
@Body request : JoinMissionRequest | ||
) : Response<Unit> | ||
|
||
@GET("/api/mission-members/me") | ||
suspend fun getJoinedMissions() : Response<MissionsResponse> | ||
} |
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
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
...ding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/model/JoinResultEvent.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,6 @@ | ||
package com.goalpanzi.mission_mate.feature.onboarding.model | ||
|
||
sealed class JoinResultEvent { | ||
data class Success(val missionId : Long) : JoinResultEvent() | ||
data object Error : JoinResultEvent() | ||
} |
18 changes: 16 additions & 2 deletions
18
...rding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/model/MissionUiModel.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 |
---|---|---|
@@ -1,8 +1,22 @@ | ||
package com.goalpanzi.mission_mate.feature.onboarding.model | ||
|
||
import com.luckyoct.core.model.response.MissionDetailResponse | ||
|
||
data class MissionUiModel( | ||
val missionId : Long, | ||
val missionTitle : String, | ||
val missionPeriod : String, | ||
val missionDays : String, | ||
val missionTime : String | ||
val missionDays : List<String>, | ||
val missionTime : VerificationTimeType, | ||
val missionBoardCount : Int | ||
) | ||
|
||
fun MissionDetailResponse.toMissionUiModel() = | ||
MissionUiModel( | ||
missionId = missionId, | ||
missionTitle = description, | ||
missionPeriod = missionPeriod, | ||
missionDays = missionDaysOfWeek, | ||
missionTime = VerificationTimeType.valueOf(timeOfDay), | ||
missionBoardCount = boardCount | ||
) |
8 changes: 8 additions & 0 deletions
8
...rc/main/java/com/goalpanzi/mission_mate/feature/onboarding/model/OnboardingResultEvent.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.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() | ||
} |
8 changes: 8 additions & 0 deletions
8
...rding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/model/ProfileUiModel.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.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() | ||
} |
Oops, something went wrong.