-
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 branch 'develop' into feature/53_self_study_data
- Loading branch information
Showing
8 changed files
with
119 additions
and
7 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
13 changes: 13 additions & 0 deletions
13
data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSource.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.msg.data.remote.datasource.self_study | ||
|
||
interface SelfStudyDataSource { | ||
suspend fun banSelfStudy( | ||
role: String, | ||
userId: Long | ||
) | ||
|
||
suspend fun banCancelSelfStudy( | ||
role: String, | ||
userId: Long | ||
) | ||
} |
23 changes: 23 additions & 0 deletions
23
data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSourceImpl.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.msg.data.remote.datasource.self_study | ||
|
||
import com.msg.data.remote.network.SelfStudyApi | ||
import com.msg.data.remote.util.safeApiCall | ||
import javax.inject.Inject | ||
|
||
class SelfStudyDataSourceImpl @Inject constructor( | ||
private val selfStudyApi: SelfStudyApi | ||
): SelfStudyDataSource { | ||
override suspend fun banSelfStudy(role: String, userId: Long) = safeApiCall { | ||
selfStudyApi.banSelfStudy( | ||
role = role, | ||
userId = userId | ||
) | ||
} | ||
|
||
override suspend fun banCancelSelfStudy(role: String, userId: Long) = safeApiCall { | ||
selfStudyApi.banCancelSelfStudy( | ||
role = role, | ||
userId = userId | ||
) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
data/src/main/java/com/msg/data/remote/datasource/student_info/StudentInfoDataSource.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,20 @@ | ||
package com.msg.data.remote.datasource.student_info | ||
|
||
import com.msg.data.remote.dto.student_info.SearchStudentInfoResponse | ||
import com.msg.data.remote.dto.student_info.StudentInfoRequest | ||
import com.msg.data.remote.dto.student_info.StudentInfoResponse | ||
|
||
interface StudentInfoDataSource { | ||
suspend fun getAllStudentInfo(): List<StudentInfoResponse> | ||
|
||
suspend fun getSearchStudentInfo( | ||
name: String?, | ||
gender: String?, | ||
classNum: String?, | ||
grade: String?, | ||
role: String?, | ||
selfStudy: Boolean?, | ||
): List<SearchStudentInfoResponse> | ||
|
||
suspend fun modifyStudentInfo(body: StudentInfoRequest) | ||
} |
38 changes: 38 additions & 0 deletions
38
data/src/main/java/com/msg/data/remote/datasource/student_info/StudentInfoDataSourceImpl.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.msg.data.remote.datasource.student_info | ||
|
||
import com.msg.data.remote.dto.student_info.SearchStudentInfoResponse | ||
import com.msg.data.remote.dto.student_info.StudentInfoRequest | ||
import com.msg.data.remote.dto.student_info.StudentInfoResponse | ||
import com.msg.data.remote.network.StudentInfoApi | ||
import com.msg.data.remote.util.safeApiCall | ||
import javax.inject.Inject | ||
|
||
class StudentInfoDataSourceImpl @Inject constructor( | ||
private val studentInfoApi: StudentInfoApi | ||
): StudentInfoDataSource { | ||
override suspend fun getAllStudentInfo(): List<StudentInfoResponse> = safeApiCall { | ||
studentInfoApi.getAllStudentInfo() | ||
} | ||
|
||
override suspend fun getSearchStudentInfo( | ||
name: String?, | ||
gender: String?, | ||
classNum: String?, | ||
grade: String?, | ||
role: String?, | ||
selfStudy: Boolean?, | ||
): List<SearchStudentInfoResponse> = safeApiCall { | ||
studentInfoApi.getSearchStudentInfo( | ||
name = name, | ||
gender = gender, | ||
classNum = classNum, | ||
grade = grade, | ||
role = role, | ||
selfStudy = selfStudy | ||
) | ||
} | ||
|
||
override suspend fun modifyStudentInfo(body: StudentInfoRequest) = safeApiCall { | ||
studentInfoApi.modifyStudentInfo(body) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
data/src/main/java/com/msg/data/remote/dto/student_info/SelfStudyStatus.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.msg.data.remote.dto.student_info | ||
|
||
enum class SelfStudyStatus { | ||
CAN, | ||
APPLIED, | ||
CANT, | ||
IMPOSSIBLE | ||
} |
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