Skip to content

Commit

Permalink
Merge pull request #203 from GSM-MSG/refactor/#202_refactor_asynchron…
Browse files Browse the repository at this point in the history
…ous_fuction

🔀 :: (#202) 비동기 함수 처리 키워드 및 로직 수정
  • Loading branch information
Chaejongin12 authored Jun 2, 2024
2 parents 7fea3ee + c16cc39 commit d687748
Show file tree
Hide file tree
Showing 42 changed files with 232 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import java.util.UUID


interface ActivityRepository {
suspend fun addStudentActivityInfo(body: StudentActivityModel): Flow<Unit>
suspend fun editStudentActivityInfo(id: UUID, body: StudentActivityModel): Flow<Unit>
suspend fun approveStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun rejectStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun deleteStudentActivityInfo(id: UUID): Flow<Unit>
suspend fun getMyStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
suspend fun getStudentActivityInfoList(page: Int, size: Int, id: UUID): Flow<GetStudentActivityListResponse>
suspend fun getEntireStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
suspend fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse>
fun addStudentActivityInfo(body: StudentActivityModel): Flow<Unit>
fun editStudentActivityInfo(id: UUID, body: StudentActivityModel): Flow<Unit>
fun approveStudentActivityInfo(id: UUID): Flow<Unit>
fun rejectStudentActivityInfo(id: UUID): Flow<Unit>
fun deleteStudentActivityInfo(id: UUID): Flow<Unit>
fun getMyStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
fun getStudentActivityInfoList(page: Int, size: Int, id: UUID): Flow<GetStudentActivityListResponse>
fun getEntireStudentActivityInfoList(page: Int, size: Int): Flow<GetStudentActivityListResponse>
fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ import javax.inject.Inject
class ActivityRepositoryImpl @Inject constructor(
private val activityDataSource: ActivityDataSource
) : ActivityRepository {
override suspend fun addStudentActivityInfo(body: StudentActivityModel): Flow<Unit> {
override fun addStudentActivityInfo(body: StudentActivityModel): Flow<Unit> {
return activityDataSource.addStudentActivityInfo(
body = body
)
}

override suspend fun editStudentActivityInfo(id: UUID, body: StudentActivityModel): Flow<Unit> {
override fun editStudentActivityInfo(id: UUID, body: StudentActivityModel): Flow<Unit> {
return activityDataSource.editStudentActivityInfo(
id = id,
body = body
)
}

override suspend fun approveStudentActivityInfo(id: UUID): Flow<Unit> {
override fun approveStudentActivityInfo(id: UUID): Flow<Unit> {
return activityDataSource.approveStudentActivityInfo(
id = id
)
}

override suspend fun rejectStudentActivityInfo(id: UUID): Flow<Unit> {
override fun rejectStudentActivityInfo(id: UUID): Flow<Unit> {
return activityDataSource.rejectStudentActivityInfo(
id = id
)
}

override suspend fun deleteStudentActivityInfo(id: UUID): Flow<Unit> {
override fun deleteStudentActivityInfo(id: UUID): Flow<Unit> {
return activityDataSource.deleteStudentActivityInfo(
id = id
)
}

override suspend fun getMyStudentActivityInfoList(
override fun getMyStudentActivityInfoList(
page: Int,
size: Int,
): Flow<GetStudentActivityListResponse> {
Expand All @@ -52,7 +52,7 @@ class ActivityRepositoryImpl @Inject constructor(
)
}

override suspend fun getStudentActivityInfoList(
override fun getStudentActivityInfoList(
page: Int,
size: Int,
id: UUID
Expand All @@ -64,7 +64,7 @@ class ActivityRepositoryImpl @Inject constructor(
)
}

override suspend fun getEntireStudentActivityInfoList(
override fun getEntireStudentActivityInfoList(
page: Int,
size: Int,
): Flow<GetStudentActivityListResponse> {
Expand All @@ -74,7 +74,7 @@ class ActivityRepositoryImpl @Inject constructor(
)
}

override suspend fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse> {
override fun getDetailStudentActivityInfo(id: UUID): Flow<GetDetailStudentActivityInfoResponse> {
return activityDataSource.getDetailStudentActivityInfo(
id = id
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import com.msg.model.remote.response.admin.UserListResponse
import kotlinx.coroutines.flow.Flow

interface AdminRepository {
suspend fun getUserList(body: GetUserListRequest, keyword: String): Flow<UserListResponse>
fun getUserList(body: GetUserListRequest, keyword: String): Flow<UserListResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import javax.inject.Inject
class AdminRepositoryImpl @Inject constructor(
private val adminDataSource: AdminDataSource,
) : AdminRepository {
override suspend fun getUserList(
override fun getUserList(
body: GetUserListRequest,
keyword: String,
): Flow<UserListResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import com.msg.model.remote.request.auth.SignUpStudentRequest
import kotlinx.coroutines.flow.Flow

interface AuthRepository {
suspend fun login(body: LoginRequest): Flow<AuthTokenModel>
suspend fun saveToken(data: AuthTokenModel)
suspend fun signUpStudent(body: SignUpStudentRequest): Flow<Unit>
suspend fun signUpJobClubTeacher(body: SignUpJobClubTeacherRequest): Flow<Unit>
suspend fun signUpProfessor(body: SignUpProfessorRequest): Flow<Unit>
suspend fun signUpGovernment(body: SignUpGovernmentRequest): Flow<Unit>
suspend fun signUpCompanyInstructor(body: SignUpCompanyInstructorRequest): Flow<Unit>
suspend fun signUpBbozzakTeacher(body: SignUpBbozzakTeacherRequest): Flow<Unit>
suspend fun findPassword(body: FindPasswordRequest): Flow<Unit>
suspend fun logout(): Flow<Unit>
suspend fun withdraw(): Flow<Unit>
fun login(body: LoginRequest): Flow<AuthTokenModel>
fun saveToken(data: AuthTokenModel): Flow<Unit>
fun signUpStudent(body: SignUpStudentRequest): Flow<Unit>
fun signUpJobClubTeacher(body: SignUpJobClubTeacherRequest): Flow<Unit>
fun signUpProfessor(body: SignUpProfessorRequest): Flow<Unit>
fun signUpGovernment(body: SignUpGovernmentRequest): Flow<Unit>
fun signUpCompanyInstructor(body: SignUpCompanyInstructorRequest): Flow<Unit>
fun signUpBbozzakTeacher(body: SignUpBbozzakTeacherRequest): Flow<Unit>
fun findPassword(body: FindPasswordRequest): Flow<Unit>
fun logout(): Flow<Unit>
fun withdraw(): Flow<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,76 @@ import com.msg.model.remote.request.auth.SignUpJobClubTeacherRequest
import com.msg.model.remote.request.auth.SignUpProfessorRequest
import com.msg.model.remote.request.auth.SignUpStudentRequest
import com.msg.network.datasource.auth.AuthDataSource
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class AuthRepositoryImpl @Inject constructor(
private val authDataSource: AuthDataSource,
private val localDataSource: AuthTokenDataSource
) : AuthRepository {
override suspend fun login(body: LoginRequest): Flow<AuthTokenModel> {
override fun login(body: LoginRequest): Flow<AuthTokenModel> {
return authDataSource.login(
body = body
)
}

override suspend fun saveToken(data: AuthTokenModel) {
data.let { loginResponse ->
localDataSource.setAccessToken(loginResponse.accessToken)
localDataSource.setAccessTokenExp(loginResponse.accessExpiredAt)
localDataSource.setRefreshToken(loginResponse.refreshToken)
localDataSource.setRefreshTokenExp(loginResponse.refreshExpiredAt)
localDataSource.setAuthority(loginResponse.authority)
}
override fun saveToken(data: AuthTokenModel): Flow<Unit> = flow {
localDataSource.setAccessToken(data.accessToken).first()
localDataSource.setAccessTokenExp(data.accessExpiredAt).first()
localDataSource.setRefreshToken(data.refreshToken).first()
localDataSource.setRefreshTokenExp(data.refreshExpiredAt).first()
localDataSource.setAuthority(data.authority).first()
}

override suspend fun signUpStudent(body: SignUpStudentRequest): Flow<Unit> {
override fun signUpStudent(body: SignUpStudentRequest): Flow<Unit> {
return authDataSource.signUpStudent(
body = body
)
}

override suspend fun signUpJobClubTeacher(body: SignUpJobClubTeacherRequest): Flow<Unit> {
override fun signUpJobClubTeacher(body: SignUpJobClubTeacherRequest): Flow<Unit> {
return authDataSource.signUpJobClubTeacher(
body = body
)
}

override suspend fun signUpProfessor(body: SignUpProfessorRequest): Flow<Unit> {
override fun signUpProfessor(body: SignUpProfessorRequest): Flow<Unit> {
return authDataSource.signUpProfessor(
body = body
)
}

override suspend fun signUpGovernment(body: SignUpGovernmentRequest): Flow<Unit> {
override fun signUpGovernment(body: SignUpGovernmentRequest): Flow<Unit> {
return authDataSource.signUpGovernment(
body = body
)
}

override suspend fun signUpCompanyInstructor(body: SignUpCompanyInstructorRequest): Flow<Unit> {
override fun signUpCompanyInstructor(body: SignUpCompanyInstructorRequest): Flow<Unit> {
return authDataSource.signUpCompanyInstructor(
body = body
)
}

override suspend fun signUpBbozzakTeacher(body: SignUpBbozzakTeacherRequest): Flow<Unit> {
override fun signUpBbozzakTeacher(body: SignUpBbozzakTeacherRequest): Flow<Unit> {
return authDataSource.signUpBbozzakTeacher(
body = body
)
}

override suspend fun findPassword(body: FindPasswordRequest): Flow<Unit> {
override fun findPassword(body: FindPasswordRequest): Flow<Unit> {
return authDataSource.findPassword(
body = body
)
}
override suspend fun logout(): Flow<Unit> {
override fun logout(): Flow<Unit> {
return authDataSource.logout()
}

override suspend fun withdraw(): Flow<Unit> {
override fun withdraw(): Flow<Unit> {
return authDataSource.withdraw()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import kotlinx.coroutines.flow.Flow
import java.util.UUID

interface CertificationRepository {
suspend fun getCertificationListForTeacher(studentId: UUID): Flow<List<CertificationListResponse>>
suspend fun getCertificationListForStudent(): Flow<List<CertificationListResponse>>
suspend fun writeCertification(body: WriteCertificationRequest): Flow<Unit>
suspend fun editCertification(id: UUID, body: WriteCertificationRequest): Flow<Unit>
fun getCertificationListForTeacher(studentId: UUID): Flow<List<CertificationListResponse>>
fun getCertificationListForStudent(): Flow<List<CertificationListResponse>>
fun writeCertification(body: WriteCertificationRequest): Flow<Unit>
fun editCertification(id: UUID, body: WriteCertificationRequest): Flow<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import javax.inject.Inject
class CertificationRepositoryImpl @Inject constructor(
private val certificationDataSource: CertificationDataSource,
) : CertificationRepository {
override suspend fun getCertificationListForTeacher(studentId: UUID): Flow<List<CertificationListResponse>> {
override fun getCertificationListForTeacher(studentId: UUID): Flow<List<CertificationListResponse>> {
return certificationDataSource.getCertificationListForTeacher(studentId = studentId)
}

override suspend fun getCertificationListForStudent(): Flow<List<CertificationListResponse>> {
override fun getCertificationListForStudent(): Flow<List<CertificationListResponse>> {
return certificationDataSource.getCertificationListForStudent()
}

override suspend fun writeCertification(body: WriteCertificationRequest): Flow<Unit> {
override fun writeCertification(body: WriteCertificationRequest): Flow<Unit> {
return certificationDataSource.writeCertification(
body = body
)
}

override suspend fun editCertification(
override fun editCertification(
id: UUID,
body: WriteCertificationRequest,
): Flow<Unit> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import kotlinx.coroutines.flow.Flow
import java.util.UUID

interface ClubRepository {
suspend fun getClubList(highSchool: HighSchool): Flow<List<ClubListResponse>>
suspend fun getClubDetail(id: Long): Flow<ClubDetailResponse>
suspend fun getStudentBelongClubDetail(id: Long, studentId: UUID): Flow<StudentBelongClubResponse>
suspend fun getMyClubDetail(): Flow<ClubDetailResponse>
fun getClubList(highSchool: HighSchool): Flow<List<ClubListResponse>>
fun getClubDetail(id: Long): Flow<ClubDetailResponse>
fun getStudentBelongClubDetail(id: Long, studentId: UUID): Flow<StudentBelongClubResponse>
fun getMyClubDetail(): Flow<ClubDetailResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ import javax.inject.Inject
class ClubRepositoryImpl @Inject constructor(
private val clubDataSource: ClubDataSource
) : ClubRepository{
override suspend fun getClubList(highSchool: HighSchool): Flow<List<ClubListResponse>> {
override fun getClubList(highSchool: HighSchool): Flow<List<ClubListResponse>> {
return clubDataSource.getClubList(highSchool = highSchool)
}

override suspend fun getClubDetail(id: Long): Flow<ClubDetailResponse> {
override fun getClubDetail(id: Long): Flow<ClubDetailResponse> {
return clubDataSource.getClubDetail(id = id)
}

override suspend fun getStudentBelongClubDetail(
override fun getStudentBelongClubDetail(
id: Long,
studentId: UUID
): Flow<StudentBelongClubResponse> {
return clubDataSource.getStudentBelongClubDetail(id = id, studentId = studentId)
}

override suspend fun getMyClubDetail(): Flow<ClubDetailResponse> {
override fun getMyClubDetail(): Flow<ClubDetailResponse> {
return clubDataSource.getMyClubDetail()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import com.msg.model.remote.response.email.GetEmailAuthenticateStatusResponse
import kotlinx.coroutines.flow.Flow

interface EmailRepository {
suspend fun sendLinkToEmail(body: SendLinkToEmailRequest): Flow<Unit>
suspend fun getEmailAuthenticateStatus(email: String): Flow<GetEmailAuthenticateStatusResponse>
fun sendLinkToEmail(body: SendLinkToEmailRequest): Flow<Unit>
fun getEmailAuthenticateStatus(email: String): Flow<GetEmailAuthenticateStatusResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import javax.inject.Inject
class EmailRepositoryImpl @Inject constructor(
private val emailDataSource: EmailDataSource
) : EmailRepository {
override suspend fun sendLinkToEmail(body: SendLinkToEmailRequest): Flow<Unit> {
override fun sendLinkToEmail(body: SendLinkToEmailRequest): Flow<Unit> {
return emailDataSource.sendLinkToEmail(
body = body
)
}

override suspend fun getEmailAuthenticateStatus(email: String): Flow<GetEmailAuthenticateStatusResponse> {
override fun getEmailAuthenticateStatus(email: String): Flow<GetEmailAuthenticateStatusResponse> {
return emailDataSource.getEmailAuthenticateStatus(
email = email
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import com.msg.model.remote.response.faq.GetFrequentlyAskedQuestionDetailRespons
import kotlinx.coroutines.flow.Flow

interface FaqRepository {
suspend fun addFrequentlyAskedQuestions(body: AddFrequentlyAskedQuestionsRequest): Flow<Unit>
suspend fun getFrequentlyAskedQuestionsList(): Flow<List<GetFrequentlyAskedQuestionDetailResponse>>
fun addFrequentlyAskedQuestions(body: AddFrequentlyAskedQuestionsRequest): Flow<Unit>
fun getFrequentlyAskedQuestionsList(): Flow<List<GetFrequentlyAskedQuestionDetailResponse>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import javax.inject.Inject
class FaqRepositoryImpl @Inject constructor(
private val faqDataSource: FaqDataSource,
) : FaqRepository {
override suspend fun addFrequentlyAskedQuestions(body: AddFrequentlyAskedQuestionsRequest): Flow<Unit> {
override fun addFrequentlyAskedQuestions(body: AddFrequentlyAskedQuestionsRequest): Flow<Unit> {
return faqDataSource.addFrequentlyAskedQuestions(
body = body
)
}

override suspend fun getFrequentlyAskedQuestionsList(): Flow<List<GetFrequentlyAskedQuestionDetailResponse>> {
override fun getFrequentlyAskedQuestionsList(): Flow<List<GetFrequentlyAskedQuestionDetailResponse>> {
return faqDataSource.getFrequentlyAskedQuestionsList()
}
}
Loading

0 comments on commit d687748

Please sign in to comment.