-
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 #357 from 6QuizOnTheBlock/and/feat#348-student_man…
…age_detail And/feat#348 student manage detail
- Loading branch information
Showing
23 changed files
with
759 additions
and
19 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
12 changes: 12 additions & 0 deletions
12
android/core/model/src/main/java/com/sixkids/model/MemberDetail.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.sixkids.model | ||
|
||
data class MemberDetail( | ||
val name: String = "", | ||
val photo: String = "", | ||
val isolationPoint: Double = 0.0, | ||
// val isolationPoint: Int = -1, | ||
val exp: Int = -1, | ||
val challengeCount: Int = -1, | ||
val relayCount: Int = -1, | ||
val postCount: Int = -1, | ||
) |
11 changes: 11 additions & 0 deletions
11
android/core/model/src/main/java/com/sixkids/model/StudentRelation.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,11 @@ | ||
package com.sixkids.model | ||
|
||
data class StudentRelation( | ||
val id: Long = -1, | ||
val name: String = "", | ||
val relationPoint: Int = 0, | ||
val tagGreetingCount: Int = 0, | ||
val groupCount: Int = 0, | ||
val receiveCount: Int = 0, | ||
val sendCount: Int = 0, | ||
) |
26 changes: 26 additions & 0 deletions
26
android/data/src/main/java/com/sixkids/data/api/MemberOrgService.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,40 @@ | ||
package com.sixkids.data.api | ||
|
||
import com.sixkids.data.model.response.StudentDetailResponse | ||
import com.sixkids.data.model.response.StudentHomeResponse | ||
import com.sixkids.data.model.response.StudentRelationDetailResponse | ||
import com.sixkids.data.model.response.StudentWithRelationScoreResponse | ||
import com.sixkids.data.network.ApiResponse | ||
import com.sixkids.data.network.ApiResult | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
import retrofit2.http.Query | ||
|
||
interface MemberOrgService { | ||
@GET("organizations/{id}/home") | ||
suspend fun getStudentHomeInfo( | ||
@Path("id") organizationId: Long | ||
): ApiResult<ApiResponse<StudentHomeResponse>> | ||
|
||
@GET("organizations/{id}") | ||
suspend fun getMemberDetail( | ||
@Path("id") organizationId: Long, | ||
@Query("memberId") memberId: Long | ||
): ApiResult<ApiResponse<StudentDetailResponse>> | ||
|
||
@GET("organizations/{id}/relations") | ||
suspend fun getRelationSimple( | ||
@Path("id") organizationId: Long, | ||
@Query("memberId") memberId: Int, | ||
@Query("limit") relationType: Int? = null | ||
): ApiResult<ApiResponse<List<StudentWithRelationScoreResponse>>> | ||
|
||
@GET("organizations/{id}/relation") | ||
suspend fun getRelationDetail( | ||
@Path("id") organizationId: Long, | ||
@Query("sourceMemberId") sourceMemberId: Int, | ||
@Query("targetMemberId") targetMemberId: Int | ||
): ApiResult<ApiResponse<StudentRelationDetailResponse>> | ||
|
||
|
||
} |
26 changes: 26 additions & 0 deletions
26
android/data/src/main/java/com/sixkids/data/model/response/StudentDetailResponse.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,26 @@ | ||
package com.sixkids.data.model.response | ||
|
||
import com.sixkids.model.MemberDetail | ||
|
||
data class StudentDetailResponse( | ||
val name: String = "", | ||
val photo: String = "", | ||
//todo 등수로 바꾸기 | ||
val isolationPoint: Double = 0.0, | ||
val exp: Int = -1, | ||
val challengeCount: Int = -1, | ||
val relayCount: Int = -1, | ||
val postCount: Int = -1, | ||
) | ||
|
||
internal fun StudentDetailResponse.toModel(): MemberDetail { | ||
return MemberDetail( | ||
name = this.name, | ||
photo = this.photo, | ||
isolationPoint = this.isolationPoint, | ||
exp = this.exp, | ||
challengeCount = this.challengeCount, | ||
relayCount = this.relayCount, | ||
postCount = this.postCount, | ||
) | ||
} |
23 changes: 23 additions & 0 deletions
23
android/data/src/main/java/com/sixkids/data/model/response/StudentRelationDetailResponse.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,23 @@ | ||
package com.sixkids.data.model.response | ||
|
||
import com.sixkids.model.StudentRelation | ||
|
||
data class StudentRelationDetailResponse( | ||
val memberId: Long = -1, | ||
val memberName: String = "", | ||
val relationPoint: Int = 0, | ||
val tagGreetingCount: Int = 0, | ||
val groupCount: Int = 0, | ||
val receiveCount: Int = 0, | ||
val sendCount: Int = 0, | ||
) | ||
|
||
internal fun StudentRelationDetailResponse.toModel() = StudentRelation( | ||
id = memberId, | ||
name = memberName, | ||
relationPoint = relationPoint, | ||
tagGreetingCount = tagGreetingCount, | ||
groupCount = groupCount, | ||
receiveCount = receiveCount, | ||
sendCount = sendCount, | ||
) |
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
12 changes: 12 additions & 0 deletions
12
.../domain/src/main/java/com/sixkids/domain/usecase/organization/GetMemberRelationUseCase.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.sixkids.domain.usecase.organization | ||
|
||
import com.sixkids.domain.repository.OrganizationRepository | ||
import javax.inject.Inject | ||
|
||
class GetMemberRelationUseCase @Inject constructor( | ||
private val organizationRepository: OrganizationRepository | ||
){ | ||
suspend operator fun invoke(orgId: Long, studentId: Long, limit: Int?) = runCatching { | ||
organizationRepository.getStudentRelation(orgId, studentId, limit) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...d/domain/src/main/java/com/sixkids/domain/usecase/organization/GetStudentDetailUseCase.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,13 @@ | ||
package com.sixkids.domain.usecase.organization | ||
|
||
import com.sixkids.domain.repository.OrganizationRepository | ||
import javax.inject.Inject | ||
|
||
class GetStudentDetailUseCase @Inject constructor( | ||
private val organizationRepository: OrganizationRepository | ||
) { | ||
suspend operator fun invoke(orgId: Long, studentId: Long) = runCatching { | ||
organizationRepository.getStudentDetail(orgId, studentId) | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...domain/src/main/java/com/sixkids/domain/usecase/organization/GetStudentRelationUseCase.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.sixkids.domain.usecase.organization | ||
|
||
import com.sixkids.domain.repository.OrganizationRepository | ||
import javax.inject.Inject | ||
|
||
class GetStudentRelationUseCase @Inject constructor( | ||
private val organizationRepository: OrganizationRepository | ||
){ | ||
suspend operator fun invoke(orgId: Long, sourceMemberId: Long, targetMemberId: Long) = runCatching { | ||
organizationRepository.getStudentRelationDetail(orgId, sourceMemberId, targetMemberId) | ||
} | ||
} |
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.
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ android { | |
|
||
dependencies { | ||
implementation(projects.core.designsystem) | ||
implementation(libs.accompanist.pager) | ||
} |
21 changes: 21 additions & 0 deletions
21
...ent/src/main/java/com/sixkids/teacher/managestudent/detail/ManageStudentDetailContract.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,21 @@ | ||
package com.sixkids.teacher.managestudent.detail | ||
|
||
import com.sixkids.model.MemberDetail | ||
import com.sixkids.model.MemberSimpleWithScore | ||
import com.sixkids.model.StudentRelation | ||
import com.sixkids.ui.base.SideEffect | ||
import com.sixkids.ui.base.UiState | ||
|
||
data class ManageStudentDetailState( | ||
val memberDetail: MemberDetail = MemberDetail(), | ||
val studentList: List<MemberSimpleWithScore> = emptyList(), | ||
val relation: StudentRelation = StudentRelation(), | ||
val isDialogShowing: Boolean = false, | ||
): UiState | ||
|
||
sealed interface ManageStudentDetailEffect : SideEffect{ | ||
data class NavigateToChallenge(val studentId: Long) : ManageStudentDetailEffect | ||
data class NavigateToRelay(val studentId: Long) : ManageStudentDetailEffect | ||
data class NavigateToPost(val studentId: Long) : ManageStudentDetailEffect | ||
data class HandleException(val throwable: Throwable, val retry: () -> Unit) : ManageStudentDetailEffect | ||
} |
Oops, something went wrong.