Skip to content

Commit

Permalink
✨ :: 자습 신청 data source 함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ImGaram committed Sep 18, 2023
1 parent ec7d119 commit cdec127
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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<SelfStudyListResponse>

suspend fun searchSelfStudyStudent(
role: String,
name: String?,
gender: String?,
classNum: String?,
grade: Int?
): List<SelfStudyListResponse>

suspend fun banSelfStudy(
role: String,
userId: Long
Expand All @@ -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
)
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
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

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<SelfStudyListResponse> = safeApiCall {
selfStudyApi.selfStudyList(role = role)
}

override suspend fun searchSelfStudyStudent(
role: String,
name: String?,
gender: String?,
classNum: String?,
grade: Int?
): List<SelfStudyListResponse> = 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
)
}

Expand All @@ -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
)
}
}

0 comments on commit cdec127

Please sign in to comment.