Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ android {
applicationId = "com.sampoom.android"
minSdk = 26
targetSdk = 36
versionCode = 7
versionName = "1.0.6"
versionCode = 9
versionName = "1.0.8"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class AuthPreferences @Inject constructor(
val USER_ID: Preferences.Key<String> = stringPreferencesKey("user_id")
val USER_NAME: Preferences.Key<String> = stringPreferencesKey("user_name")
val USER_EMAIL: Preferences.Key<String> = stringPreferencesKey("user_email")
val USER_ROLE: Preferences.Key<String> = stringPreferencesKey("user_role")
val USER_POSITION: Preferences.Key<String> = stringPreferencesKey("user_position")
val USER_WORKSPACE: Preferences.Key<String> = stringPreferencesKey("user_workspace")
val USER_BRANCH: Preferences.Key<String> = stringPreferencesKey("user_branch")
val USER_AGENCY_ID: Preferences.Key<String> = stringPreferencesKey("user_agency_id")
val USER_STARTED_AT: Preferences.Key<String> = stringPreferencesKey("user_started_at")
Expand All @@ -49,8 +49,8 @@ class AuthPreferences @Inject constructor(
prefs[Keys.USER_ID] = cryptoManager.encrypt(user.userId.toString())
prefs[Keys.USER_NAME] = cryptoManager.encrypt(user.userName)
prefs[Keys.USER_EMAIL] = cryptoManager.encrypt(user.email)
prefs[Keys.USER_ROLE] = cryptoManager.encrypt(user.role)
prefs[Keys.USER_POSITION] = cryptoManager.encrypt(user.position.name)
prefs[Keys.USER_WORKSPACE] = cryptoManager.encrypt(user.workspace)
prefs[Keys.USER_BRANCH] = cryptoManager.encrypt(user.branch)
prefs[Keys.USER_AGENCY_ID] = cryptoManager.encrypt(user.agencyId.toString())
prefs[Keys.USER_STARTED_AT] = cryptoManager.encrypt(user.startedAt.toString())
Expand All @@ -74,18 +74,18 @@ class AuthPreferences @Inject constructor(
val userId = prefs[Keys.USER_ID]
val userName = prefs[Keys.USER_NAME]
val userEmail = prefs[Keys.USER_EMAIL]
val userRole = prefs[Keys.USER_ROLE]
val accessToken = prefs[Keys.ACCESS_TOKEN]
val refreshToken = prefs[Keys.REFRESH_TOKEN]
val expiresAt = prefs[Keys.TOKEN_EXPIRES_AT]
val userPosition = prefs[Keys.USER_POSITION]
val userWorkspace = prefs[Keys.USER_WORKSPACE]
val userBranch = prefs[Keys.USER_BRANCH]
val userAgencyId = prefs[Keys.USER_AGENCY_ID]
val userStartedAt = prefs[Keys.USER_STARTED_AT]
val userEndedAt = prefs[Keys.USER_ENDED_AT]

if (userId != null && userName != null && userEmail != null && userRole != null &&
accessToken != null && refreshToken != null && userPosition != null && userBranch != null && userAgencyId != null && userStartedAt != null && userEndedAt != null
if (userId != null && userName != null && userEmail != null &&
accessToken != null && refreshToken != null && userPosition != null && userWorkspace != null && userBranch != null && userAgencyId != null && userStartedAt != null && userEndedAt != null
) {
try {
val remaining = expiresAt?.let {
Expand All @@ -96,13 +96,17 @@ class AuthPreferences @Inject constructor(
cryptoManager.decrypt(userId).toLong(),
cryptoManager.decrypt(userName),
cryptoManager.decrypt(userEmail),
cryptoManager.decrypt(userRole),
cryptoManager.decrypt(accessToken),
cryptoManager.decrypt(refreshToken),
remaining,
cryptoManager.decrypt(userPosition).let { decrypted ->
try { UserPosition.valueOf(decrypted.uppercase()) } catch (_: Exception) { UserPosition.STAFF }
try {
UserPosition.valueOf(decrypted.uppercase())
} catch (_: Exception) {
UserPosition.STAFF
}
},
cryptoManager.decrypt(userWorkspace),
cryptoManager.decrypt(userBranch),
cryptoManager.decrypt(userAgencyId).toLong(),
cryptoManager.decrypt(userStartedAt),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ fun LoginResponseDto.toModel(): User = User(
userId = userId,
userName = "",
email = "",
role = "",
accessToken = accessToken,
refreshToken = refreshToken,
expiresIn = expiresIn,
position = UserPosition.STAFF,
workspace = "",
branch = "",
agencyId = 0,
startedAt = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.sampoom.android.feature.auth.data.remote.dto

data class LoginRequestDto(
val role: String,
val workspace: String,
val email: String,
val password: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.sampoom.android.feature.auth.data.remote.dto
data class SignUpRequestDto(
val email: String,
val password: String,
val role: String,
val workspace: String,
val branch: String,
val userName: String,
val position: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AuthRepositoryImpl @Inject constructor(
override suspend fun signUp(
email: String,
password: String,
role: String,
workspace: String,
branch: String,
userName: String,
position: String
Expand All @@ -32,7 +32,7 @@ class AuthRepositoryImpl @Inject constructor(
SignUpRequestDto(
email = email,
password = password,
role = role,
workspace = workspace,
branch = branch,
userName = userName,
position = position
Expand All @@ -55,7 +55,7 @@ class AuthRepositoryImpl @Inject constructor(
return runCatching {
val loginDto = api.login(
LoginRequestDto(
role = "AGENCY",
workspace = "AGENCY",
email = email,
password = password
)
Expand All @@ -70,6 +70,7 @@ class AuthRepositoryImpl @Inject constructor(

/** 로그아웃 */
override suspend fun signOut(): Result<Unit> {
preferences.clear()
return runCatching {
val dto = api.logout()
if (!dto.success) throw Exception(dto.message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface AuthRepository {
suspend fun signUp(
email: String,
password: String,
role: String,
workspace: String,
branch: String,
userName: String,
position: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class SignUpUseCase @Inject constructor(
suspend operator fun invoke(
email: String,
password: String,
role: String,
workspace: String,
branch: String,
userName: String,
position: String
): Result<User> = repository.signUp(
email = email,
password = password,
role = role,
workspace = workspace,
branch = branch,
userName = userName,
position = position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AuthViewModel @Inject constructor(
}

fun signOut() = viewModelScope.launch {
signOutUseCase()
// signOutUseCase()
_isLoggedIn.value = false
_logoutEvent.emit(Unit)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.sampoom.android.feature.auth.domain.model.Vendor

data class SignUpUiState(
val name: String = "",
val role: String = "AGENCY",
val workspace: String = "AGENCY",
val branch: String = "",
val position: UserPosition? = null,
val email: String = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class SignUpViewModel @Inject constructor(
singUp(
email = s.email,
password = s.password,
role = s.role,
workspace = s.workspace,
branch = s.branch,
userName = s.name,
position = s.position!!.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ fun GetProfileResponseDto.toModel(): User = User(
userId = userId,
userName = userName,
email = email,
role = role,
accessToken = "",
refreshToken = "",
expiresIn = 0L,
position = position.toUserPosition(),
workspace = workspace,
branch = branch,
agencyId = organizationId,
startedAt = startedAt,
Expand All @@ -35,11 +35,11 @@ fun UpdateProfileResponseDto.toModel(): User = User(
userId = userId,
userName = userName,
email = "",
role = "",
accessToken = "",
refreshToken = "",
expiresIn = 0L,
position = UserPosition.STAFF,
workspace = "",
branch = "",
agencyId = 0,
startedAt = null,
Expand All @@ -49,8 +49,8 @@ fun UpdateProfileResponseDto.toModel(): User = User(
fun EditEmployeeResponseDto.toModel(): Employee = Employee(
userId = userId,
email = "",
role = role,
userName = userName,
workspace = "",
organizationId = 0,
branch = "",
position = position.toUserPosition(),
Expand All @@ -64,8 +64,8 @@ fun EditEmployeeResponseDto.toModel(): Employee = Employee(
fun UpdateEmployeeStatusResponseDto.toModel(): Employee = Employee(
userId = userId,
email = "",
role = role,
userName = userName,
workspace = "",
organizationId = 0,
branch = "",
position = UserPosition.STAFF,
Expand All @@ -79,8 +79,8 @@ fun UpdateEmployeeStatusResponseDto.toModel(): Employee = Employee(
fun EmployeeDto.toModel(): Employee = Employee(
userId,
email,
role,
userName,
workspace,
organizationId,
branch,
position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import retrofit2.http.Query
interface UserApi {
// 프로필 조회
@GET("user/profile")
suspend fun getProfile(@Query("role") role: String): ApiResponse<GetProfileResponseDto>
suspend fun getProfile(@Query("workspace") workspace: String): ApiResponse<GetProfileResponseDto>

// 프로필 수정
@PATCH("user/profile")
Expand All @@ -28,14 +28,14 @@ interface UserApi {
@PATCH("user/profile/{userId}")
suspend fun editEmployee(
@Path("userId") userId: Long,
@Query("role") role: String,
@Query("workspace") workspace: String,
@Body body: EditEmployeeRequestDto
): ApiResponse<EditEmployeeResponseDto>

// 직원 목록 조회
@GET("user/info")
suspend fun getEmployeeList(
@Query("role") role: String,
@Query("workspace") workspace: String,
@Query("organizationId") organizationId: Long,
@Query("page") page: Int = 0,
@Query("size") size: Int = 20
Expand All @@ -45,7 +45,7 @@ interface UserApi {
@PATCH("user/status/{userId}")
suspend fun updateEmployeeStatus(
@Path("userId") userId: Long,
@Query("role") role: String,
@Query("workspace") workspace: String,
@Body body: UpdateEmployeeStatusRequestDto
): ApiResponse<UpdateEmployeeStatusResponseDto>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ package com.sampoom.android.feature.user.data.remote.dto
data class EditEmployeeResponseDto(
val userId: Long,
val userName: String,
val role: String,
val position: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.sampoom.android.core.model.UserPosition
data class EmployeeDto(
val userId: Long,
val email: String,
val role: String,
val userName: String,
val workspace: String,
val organizationId: Long,
val branch: String,
val position: UserPosition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ data class GetProfileResponseDto(
val email: String,
val role: String,
val position: String,
val workspace: String,
val branch: String,
val organizationId: Long,
val startedAt: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ package com.sampoom.android.feature.user.data.remote.dto
data class UpdateEmployeeStatusResponseDto(
val userId: Long,
val userName: String,
val role: String,
val employeeStatus: String
)
Loading