From cdec12736899ebf63076eef7af1eaed2d03fc436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EA=B0=80=EB=9E=8C?= <84944117+ImGaram@users.noreply.github.com> Date: Mon, 18 Sep 2023 09:11:18 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20::=20=EC=9E=90=EC=8A=B5=20?= =?UTF-8?q?=EC=8B=A0=EC=B2=AD=20data=20source=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../self_study/SelfStudyDataSource.kt | 34 +++++++++++++ .../self_study/SelfStudyDataSourceImpl.kt | 51 ++++++++++++++++++- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSource.kt b/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSource.kt index ed3e883b..71ad35c8 100644 --- a/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSource.kt +++ b/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSource.kt @@ -1,6 +1,25 @@ package com.msg.data.remote.datasource.self_study +import com.msg.data.remote.dto.self_study.SelfStudyInfoResponse +import com.msg.data.remote.dto.self_study.SelfStudyListResponse + interface SelfStudyDataSource { + suspend fun selfStudyInfo( + role: String + ): SelfStudyInfoResponse + + suspend fun selfStudyList( + role: String + ): List + + suspend fun searchSelfStudyStudent( + role: String, + name: String?, + gender: String?, + classNum: String?, + grade: Int? + ): List + suspend fun banSelfStudy( role: String, userId: Long @@ -10,4 +29,19 @@ interface SelfStudyDataSource { role: String, userId: Long ) + + suspend fun selfStudy(role: String) + + suspend fun cancelSelfStudy(role: String) + + suspend fun changeSelfStudyLimit( + role: String, + limit: Int + ) + + suspend fun checkSelfStudy( + role: String, + memberId: String, + selfStudyCheck: Boolean + ) } \ No newline at end of file diff --git a/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSourceImpl.kt b/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSourceImpl.kt index 9f8bbb40..63d72372 100644 --- a/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSourceImpl.kt +++ b/data/src/main/java/com/msg/data/remote/datasource/self_study/SelfStudyDataSourceImpl.kt @@ -1,5 +1,7 @@ package com.msg.data.remote.datasource.self_study +import com.msg.data.remote.dto.self_study.SelfStudyInfoResponse +import com.msg.data.remote.dto.self_study.SelfStudyListResponse import com.msg.data.remote.network.SelfStudyApi import com.msg.data.remote.util.safeApiCall import javax.inject.Inject @@ -7,10 +9,34 @@ import javax.inject.Inject class SelfStudyDataSourceImpl @Inject constructor( private val selfStudyApi: SelfStudyApi ): SelfStudyDataSource { + override suspend fun selfStudyInfo(role: String): SelfStudyInfoResponse = safeApiCall { + selfStudyApi.selfStudyInfo(role = role) + } + + override suspend fun selfStudyList(role: String): List = safeApiCall { + selfStudyApi.selfStudyList(role = role) + } + + override suspend fun searchSelfStudyStudent( + role: String, + name: String?, + gender: String?, + classNum: String?, + grade: Int? + ): List = safeApiCall { + selfStudyApi.searchSelfStudyStudent( + role = role, + name = name, + gender = gender, + classNum = classNum, + grade = grade + ) + } + override suspend fun banSelfStudy(role: String, userId: Long) = safeApiCall { selfStudyApi.banSelfStudy( role = role, - userId = userId + userId =userId ) } @@ -20,4 +46,27 @@ class SelfStudyDataSourceImpl @Inject constructor( userId = userId ) } + + override suspend fun selfStudy(role: String) = safeApiCall { + selfStudyApi.selfStudy(role = role) + } + + override suspend fun cancelSelfStudy(role: String) = safeApiCall { + selfStudyApi.cancelSelfStudy(role = role) + } + + override suspend fun changeSelfStudyLimit(role: String, limit: Int) = safeApiCall { + selfStudyApi.changeSelfStudyLimit( + role = role, + limit = limit + ) + } + + override suspend fun checkSelfStudy(role: String, memberId: String, selfStudyCheck: Boolean) = safeApiCall { + selfStudyApi.checkSelfStudy( + role = role, + memberId = memberId, + selfStudyCheck = selfStudyCheck + ) + } } \ No newline at end of file