Skip to content

Commit

Permalink
Merge pull request #63 from GSM-MSG/feature/#53_set_up_netword_on_bbo…
Browse files Browse the repository at this point in the history
…zzak_sign_up_part

🔀 :: (#53) - Set up network on bbozzak teacher sign up part
  • Loading branch information
wjdcksdn authored Nov 13, 2023
2 parents b7e63c4 + 79b79a2 commit 91b2cb6
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.msg.data.repository.auth

import com.msg.model.remote.model.auth.AuthTokenModel
import com.msg.model.remote.request.auth.LoginRequest
import com.msg.model.remote.request.auth.SignUpBbozzakTeacherRequest
import com.msg.model.remote.request.auth.SignUpCompanyInstructorRequest
import com.msg.model.remote.request.auth.SignUpGovernmentRequest
import com.msg.model.remote.request.auth.SignUpJobClubTeacherRequest
Expand All @@ -17,6 +18,7 @@ interface AuthRepository {
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 logout(): Flow<Unit>
suspend fun withdraw(): Flow<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.msg.data.repository.auth
import com.msg.datastore.AuthTokenDataSource
import com.msg.model.remote.model.auth.AuthTokenModel
import com.msg.model.remote.request.auth.LoginRequest
import com.msg.model.remote.request.auth.SignUpBbozzakTeacherRequest
import com.msg.model.remote.request.auth.SignUpCompanyInstructorRequest
import com.msg.model.remote.request.auth.SignUpGovernmentRequest
import com.msg.model.remote.request.auth.SignUpJobClubTeacherRequest
Expand Down Expand Up @@ -61,6 +62,12 @@ class AuthRepositoryImpl @Inject constructor(
)
}

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

override suspend fun logout(): Flow<Unit> {
return authDataSource.logout()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.msg.domain.auth

import com.msg.data.repository.auth.AuthRepository
import com.msg.model.remote.request.auth.SignUpBbozzakTeacherRequest
import javax.inject.Inject

class SignUpBbozzakTeacherUseCase @Inject constructor(
private val authRepository: AuthRepository
) {
suspend operator fun invoke(body: SignUpBbozzakTeacherRequest) = runCatching {
authRepository.signUpBbozzakTeacher(body = body)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.msg.data.repository.auth.AuthRepository
import com.msg.model.remote.request.auth.SignUpGovernmentRequest
import javax.inject.Inject

class SignUpGovernment @Inject constructor(
class SignUpGovernmentUseCase @Inject constructor(
private val authRepository: AuthRepository
) {
suspend operator fun invoke(body: SignUpGovernmentRequest) = runCatching {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.msg.model.remote.request.auth

import com.msg.model.remote.enumdatatype.HighSchool

data class SignUpBbozzakTeacherRequest(
val email: String,
val name: String,
val phoneNumber: String,
val password: String,
val highSchool: HighSchool,
val clubName: String
)
6 changes: 6 additions & 0 deletions core/network/src/main/java/com/msg/network/api/AuthAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.msg.network.api

import com.msg.model.remote.model.auth.AuthTokenModel
import com.msg.model.remote.request.auth.LoginRequest
import com.msg.model.remote.request.auth.SignUpBbozzakTeacherRequest
import com.msg.model.remote.request.auth.SignUpCompanyInstructorRequest
import com.msg.model.remote.request.auth.SignUpGovernmentRequest
import com.msg.model.remote.request.auth.SignUpJobClubTeacherRequest
Expand Down Expand Up @@ -42,6 +43,11 @@ interface AuthAPI {
@Body body: SignUpCompanyInstructorRequest
)

@POST("auth/bbozzak")
suspend fun signUpBbozzakTeacher(
@Body body: SignUpBbozzakTeacherRequest
)

@DELETE("auth")
suspend fun logout()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.msg.network.datasource.auth

import com.msg.model.remote.model.auth.AuthTokenModel
import com.msg.model.remote.request.auth.LoginRequest
import com.msg.model.remote.request.auth.SignUpBbozzakTeacherRequest
import com.msg.model.remote.request.auth.SignUpCompanyInstructorRequest
import com.msg.model.remote.request.auth.SignUpGovernmentRequest
import com.msg.model.remote.request.auth.SignUpJobClubTeacherRequest
Expand All @@ -16,6 +17,7 @@ interface AuthDataSource {
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 logout(): Flow<Unit>
suspend fun withdraw(): Flow<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.msg.network.datasource.auth

import com.msg.model.remote.model.auth.AuthTokenModel
import com.msg.model.remote.request.auth.LoginRequest
import com.msg.model.remote.request.auth.SignUpBbozzakTeacherRequest
import com.msg.model.remote.request.auth.SignUpCompanyInstructorRequest
import com.msg.model.remote.request.auth.SignUpGovernmentRequest
import com.msg.model.remote.request.auth.SignUpJobClubTeacherRequest
Expand Down Expand Up @@ -67,19 +68,27 @@ class AuthDataSourceImpl @Inject constructor(
)
}.flowOn(Dispatchers.IO)

override suspend fun signUpBbozzakTeacher(body: SignUpBbozzakTeacherRequest): Flow<Unit> = flow {
emit(
BitgoeulApiHandler<Unit>()
.httpRequest { authAPI.signUpBbozzakTeacher(body = body) }
.sendRequest()
)
}.flowOn(Dispatchers.IO)

override suspend fun logout(): Flow<Unit> = flow {
emit(
BitgoeulApiHandler<Unit>()
.httpRequest { authAPI.logout() }
.sendRequest()
)
}
}.flowOn(Dispatchers.IO)

override suspend fun withdraw(): Flow<Unit> = flow {
emit(
BitgoeulApiHandler<Unit>()
.httpRequest { authAPI.withdraw() }
.sendRequest()
)
}
}.flowOn(Dispatchers.IO)
}

0 comments on commit 91b2cb6

Please sign in to comment.