-
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 #10 from Nexters/feature/#9_my-page
#9: 마이페이지 구현
- Loading branch information
Showing
55 changed files
with
1,067 additions
and
36 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
package com.keyme.data.remote.api | ||
|
||
import com.keyme.domain.entity.response.SampleResponse | ||
import com.keyme.domain.entity.response.keymetest.KeymeTestResultStatisticsResponse | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
|
||
interface KeymeApi { | ||
|
||
@GET("main/sample") | ||
suspend fun getSample(): SampleResponse | ||
|
||
@GET("tests/{id}/statistics") | ||
suspend fun getKeymeTestResultStatistics( | ||
@Path("id") questionId: String, | ||
): KeymeTestResultStatisticsResponse | ||
} |
81 changes: 81 additions & 0 deletions
81
data/src/main/java/com/keyme/data/remote/datasource/ResultCircleDataSource.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,81 @@ | ||
package com.keyme.data.remote.datasource | ||
|
||
import com.keyme.domain.entity.response.Circle | ||
import com.keyme.domain.entity.response.ResultCircleResponse | ||
import javax.inject.Inject | ||
|
||
class ResultCircleDataSource @Inject constructor() { | ||
fun getSample(): ResultCircleResponse { | ||
return ResultCircleResponse().apply { | ||
data = circleDummy() | ||
} | ||
} | ||
} | ||
|
||
private fun circleDummy(): List<Circle> { | ||
return listOf( | ||
Circle( | ||
x = -0.633232604611031, | ||
y = -0.47732413442115296, | ||
r = 0.09460444572843042, | ||
level = 1, | ||
ex = mapOf("datum" to 1), | ||
), | ||
Circle( | ||
x = -0.7720311587589236, | ||
y = 0.19946176418549022, | ||
r = 0.13379089020993573, | ||
level = 1, | ||
ex = mapOf("datum" to 2), | ||
), | ||
Circle( | ||
x = -0.43168871955473165, | ||
y = -0.6391381648617572, | ||
r = 0.16385970662353394, | ||
level = 1, | ||
ex = mapOf("datum" to 3), | ||
), | ||
Circle( | ||
x = 0.595447603036083, | ||
y = 0.5168251295666467, | ||
r = 0.21154197162246005, | ||
level = 1, | ||
ex = mapOf("datum" to 5), | ||
), | ||
Circle( | ||
x = -0.5480911056188739, | ||
y = 0.5115139053491098, | ||
r = 0.2502998363185337, | ||
level = 1, | ||
ex = mapOf("datum" to 7), | ||
), | ||
Circle( | ||
x = 0.043747233552068686, | ||
y = -0.6848366902134195, | ||
r = 0.31376744998074435, | ||
level = 1, | ||
ex = mapOf("datum" to 11), | ||
), | ||
Circle( | ||
x = 0.04298737651230445, | ||
y = 0.5310431146935967, | ||
r = 0.34110117996070605, | ||
level = 1, | ||
ex = mapOf("datum" to 13), | ||
), | ||
Circle( | ||
x = -0.3375943908160698, | ||
y = -0.09326467617622711, | ||
r = 0.39006412239133215, | ||
level = 1, | ||
ex = mapOf("datum" to 17), | ||
), | ||
Circle( | ||
x = 0.46484095011516874, | ||
y = -0.09326467617622711, | ||
r = 0.4123712185399064, | ||
level = 1, | ||
ex = mapOf("datum" to 19), | ||
), | ||
) | ||
} |
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
data/src/main/java/com/keyme/data/remote/repositoryimpl/ResultCircleRepositoryImpl.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.keyme.data.remote.repositoryimpl | ||
|
||
import com.keyme.data.remote.datasource.ResultCircleDataSource | ||
import com.keyme.domain.entity.response.ResultCircleResponse | ||
import com.keyme.domain.repository.ResultCircleRepository | ||
import javax.inject.Inject | ||
|
||
class ResultCircleRepositoryImpl @Inject constructor( | ||
private val resultCircleDataSource: ResultCircleDataSource, | ||
) : ResultCircleRepository { | ||
|
||
override suspend fun getDummy(): ResultCircleResponse { | ||
return resultCircleDataSource.getSample().apply { | ||
statusCode = "200" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...main/java/com/keyme/data/remote/repositoryimpl/keymetest/KeymeTestResultRepositoryImpl.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.keyme.data.remote.repositoryimpl.keymetest | ||
|
||
import com.keyme.data.remote.api.KeymeApi | ||
import com.keyme.domain.entity.response.keymetest.KeymeTestResultStatisticsResponse | ||
import com.keyme.domain.repository.keymetest.KeymeTestResultRepository | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class KeymeTestResultRepositoryImpl @Inject constructor( | ||
private val keymeApi: KeymeApi, | ||
) : KeymeTestResultRepository { | ||
|
||
override suspend fun getStatistics(questionId: String): KeymeTestResultStatisticsResponse { | ||
return keymeApi.getKeymeTestResultStatistics(questionId = questionId) | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/keyme/domain/entity/response/ResultCircleResponse.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,7 @@ | ||
package com.keyme.domain.entity.response | ||
|
||
import com.keyme.domain.entity.BaseResponse | ||
|
||
class ResultCircleResponse : BaseResponse<List<Circle>>() | ||
|
||
data class Circle(val x: Double, val y: Double, val r: Double, val level: Int, val ex: Map<String, Int>) |
25 changes: 25 additions & 0 deletions
25
domain/src/main/java/com/keyme/domain/entity/response/keymetest/KeymeTestResultStatistics.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,25 @@ | ||
package com.keyme.domain.entity.response.keymetest | ||
|
||
import com.keyme.domain.entity.BaseResponse | ||
|
||
class KeymeTestResultStatisticsResponse : BaseResponse<KeymeTestResultStatistics>() | ||
|
||
data class KeymeTestResultStatistics( | ||
val averageRate: Int, | ||
val questionsStatistics: List<QuestionsStatistic>, | ||
val solvedCount: Int, | ||
) | ||
|
||
data class Category( | ||
val color: String, | ||
val imageUrl: String, | ||
val name: String, | ||
) | ||
|
||
data class QuestionsStatistic( | ||
val averageScore: Int, | ||
val category: Category, | ||
val description: String, | ||
val keyword: String, | ||
val questionId: Int, | ||
) |
8 changes: 8 additions & 0 deletions
8
domain/src/main/java/com/keyme/domain/repository/ResultCircleRepository.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.keyme.domain.repository | ||
|
||
import com.keyme.domain.entity.response.ResultCircleResponse | ||
|
||
interface ResultCircleRepository { | ||
|
||
suspend fun getDummy(): ResultCircleResponse | ||
} |
8 changes: 8 additions & 0 deletions
8
domain/src/main/java/com/keyme/domain/repository/keymetest/KeymeTestResultRepository.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.keyme.domain.repository.keymetest | ||
|
||
import com.keyme.domain.entity.response.keymetest.KeymeTestResultStatisticsResponse | ||
|
||
interface KeymeTestResultRepository { | ||
|
||
suspend fun getStatistics(questionId: String): KeymeTestResultStatisticsResponse | ||
} |
17 changes: 17 additions & 0 deletions
17
domain/src/main/java/com/keyme/domain/usecase/GetResultCircleUseCase.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.keyme.domain.usecase | ||
|
||
import com.keyme.domain.entity.ApiResult | ||
import com.keyme.domain.entity.apiResult | ||
import com.keyme.domain.entity.response.Circle | ||
import com.keyme.domain.repository.ResultCircleRepository | ||
import javax.inject.Inject | ||
|
||
class GetResultCircleUseCase @Inject constructor( | ||
private val resultCircleRepository: ResultCircleRepository, | ||
) { | ||
suspend operator fun invoke(): ApiResult<List<Circle>> { | ||
return apiResult { | ||
resultCircleRepository.getDummy() | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...n/src/main/java/com/keyme/domain/usecase/keymetest/GetKeymeTestResultStatisticsUseCase.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.keyme.domain.usecase.keymetest | ||
|
||
import com.keyme.domain.entity.ApiResult | ||
import com.keyme.domain.entity.apiResult | ||
import com.keyme.domain.entity.response.keymetest.KeymeTestResultStatistics | ||
import com.keyme.domain.repository.keymetest.KeymeTestResultRepository | ||
import javax.inject.Inject | ||
|
||
class GetKeymeTestResultStatisticsUseCase @Inject constructor( | ||
private val keymeTestResultRepository: KeymeTestResultRepository, | ||
) { | ||
suspend operator fun invoke(questionId: String): ApiResult<KeymeTestResultStatistics> { | ||
return apiResult { | ||
keymeTestResultRepository.getStatistics(questionId) | ||
} | ||
} | ||
} |
Oops, something went wrong.