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
8 changes: 4 additions & 4 deletions SampoomManagement.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_TEAM = B9PUAVBBKX;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -300,7 +300,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.6;
MARKETING_VERSION = 1.0.8;
PRODUCT_BUNDLE_IDENTIFIER = com.sampoom.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = YES;
Expand All @@ -319,7 +319,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_TEAM = B9PUAVBBKX;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -335,7 +335,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.6;
MARKETING_VERSION = 1.0.8;
PRODUCT_BUNDLE_IDENTIFIER = com.sampoom.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = YES;
Expand Down
2 changes: 1 addition & 1 deletion SampoomManagement/Core/Network/TokenRefreshService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class TokenRefreshService {
id: existingUser.id,
name: existingUser.name,
email: existingUser.email,
role: existingUser.role,
accessToken: dto.accessToken,
refreshToken: dto.refreshToken,
expiresIn: dto.expiresIn,
position: existingUser.position,
workspace: existingUser.workspace,
branch: existingUser.branch,
agencyId: existingUser.agencyId,
startedAt: existingUser.startedAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class AuthPreferences {
static let userId = "auth.userId"
static let userName = "auth.userName"
static let userEmail = "auth.userEmail"
static let userRole = "auth.userRole"
static let expiresIn = "auth.expiresIn"
static let position = "auth.position"
static let workspace = "auth.workspace"
static let branch = "auth.branch"
static let agencyId = "auth.agencyId"
static let startedAt = "auth.startedAt"
Expand All @@ -32,9 +32,9 @@ class AuthPreferences {
try keychain.save(String(user.id), for: Keys.userId)
try keychain.save(user.name, for: Keys.userName)
try keychain.save(user.email, for: Keys.userEmail)
try keychain.save(user.role, for: Keys.userRole)
try keychain.save(String(user.expiresIn), for: Keys.expiresIn)
try keychain.save(user.position.rawValue, for: Keys.position)
try keychain.save(user.workspace, for: Keys.workspace)
try keychain.save(user.branch, for: Keys.branch)
try keychain.save(String(user.agencyId), for: Keys.agencyId)
try keychain.save(user.startedAt ?? "", for: Keys.startedAt)
Expand All @@ -46,9 +46,9 @@ class AuthPreferences {
try? keychain.delete(Keys.userId)
try? keychain.delete(Keys.userName)
try? keychain.delete(Keys.userEmail)
try? keychain.delete(Keys.userRole)
try? keychain.delete(Keys.expiresIn)
try? keychain.delete(Keys.position)
try? keychain.delete(Keys.workspace)
try? keychain.delete(Keys.branch)
try? keychain.delete(Keys.agencyId)
try? keychain.delete(Keys.startedAt)
Expand All @@ -75,7 +75,6 @@ class AuthPreferences {
guard let userIdString = try keychain.get(Keys.userId),
let userId = Int(userIdString),
let userName = try keychain.get(Keys.userName),
let userRole = try keychain.get(Keys.userRole),
let accessToken = try keychain.get(Keys.accessToken),
let refreshToken = try keychain.get(Keys.refreshToken),
let expiresInString = try keychain.get(Keys.expiresIn),
Expand All @@ -84,6 +83,7 @@ class AuthPreferences {
}
// Tolerate missing profile keys by defaulting to safe values
let positionRaw = (try? keychain.get(Keys.position)) ?? ""
let workspace = (try? keychain.get(Keys.workspace)) ?? ""
let branch = (try? keychain.get(Keys.branch)) ?? ""
let userEmail = (try? keychain.get(Keys.userEmail)) ?? ""
let agencyId = Int((try? keychain.get(Keys.agencyId)) ?? "0") ?? 0
Expand All @@ -94,11 +94,11 @@ class AuthPreferences {
id: userId,
name: userName,
email: userEmail,
role: userRole,
accessToken: accessToken,
refreshToken: refreshToken,
expiresIn: expiresIn,
position: UserPosition(rawValue: positionRaw) ?? .staff,
workspace: workspace,
branch: branch,
agencyId: agencyId,
startedAt: startedAt?.isEmpty == false ? startedAt : nil,
Expand Down Expand Up @@ -144,9 +144,9 @@ class AuthPreferences {
try keychain.delete(Keys.userId)
try keychain.delete(Keys.userName)
try keychain.delete(Keys.userEmail)
try keychain.delete(Keys.userRole)
try keychain.delete(Keys.expiresIn)
try keychain.delete(Keys.position)
try keychain.delete(Keys.workspace)
try keychain.delete(Keys.branch)
try keychain.delete(Keys.agencyId)
try keychain.delete(Keys.startedAt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ extension LoginResponseDTO {
id: self.userId,
name: "",
email: "",
role: "",
accessToken: self.accessToken,
refreshToken: self.refreshToken,
expiresIn: self.expiresIn,
position: .staff,
workspace: "",
branch: "",
agencyId: 0,
startedAt: nil,
Expand Down
10 changes: 5 additions & 5 deletions SampoomManagement/Features/Auth/Data/Remote/API/AuthAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class AuthAPI {

// 로그인
func login(email: String, password: String) async throws -> APIResponse<LoginResponseDTO> {
let requestDTO = LoginRequestDTO(role: "AGENCY", email: email, password: password)
let requestDTO = LoginRequestDTO(workspace: "AGENCY", email: email, password: password)

let parameters: [String: Any] = [
"role": requestDTO.role,
"workspace": requestDTO.workspace,
"email": requestDTO.email,
"password": requestDTO.password
]
Expand All @@ -37,14 +37,14 @@ class AuthAPI {
func signup(
email: String,
password: String,
role: String,
workspace: String,
branch: String,
userName: String,
position: String
) async throws -> APIResponse<SignupResponseDTO> {
let requestDTO = SignupRequestDTO(
userName: userName,
role: role,
workspace: workspace,
branch: branch,
position: position,
email: email,
Expand All @@ -54,7 +54,7 @@ class AuthAPI {
let parameters: [String: Any] = [
"email": requestDTO.email,
"password": requestDTO.password,
"role": requestDTO.role,
"workspace": requestDTO.workspace,
"branch": requestDTO.branch,
"userName": requestDTO.userName,
"position": requestDTO.position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

struct LoginRequestDTO: Codable {
let role: String
let workspace: String
let email: String
let password: String
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

struct SignupRequestDTO: Codable {
let userName: String
let role: String
let workspace: String
let branch: String
let position: String
let email: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AuthRepositoryImpl: AuthRepository {
// 회원가입
func signUp(
userName: String,
role: String,
workspace: String,
branch: String,
position: String,
email: String,
Expand All @@ -28,7 +28,7 @@ class AuthRepositoryImpl: AuthRepository {
_ = try await api.signup(
email: email,
password: password,
role: role,
workspace: workspace,
branch: branch,
userName: userName,
position: position
Expand Down Expand Up @@ -99,11 +99,11 @@ class AuthRepositoryImpl: AuthRepository {
id: existingUser.id,
name: existingUser.name,
email: existingUser.email,
role: existingUser.role,
accessToken: dto.accessToken,
refreshToken: dto.refreshToken,
expiresIn: dto.expiresIn,
position: existingUser.position,
workspace: existingUser.workspace,
branch: existingUser.branch,
agencyId: existingUser.agencyId,
startedAt: existingUser.startedAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
protocol AuthRepository {
func signUp(
userName: String,
role: String,
workspace: String,
branch: String,
position: String,
email: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class SignUpUseCase {

func execute(
userName: String,
role: String,
workspace: String,
branch: String,
position: String,
email: String,
password: String
) async throws -> User {
return try await repository.signUp(
userName: userName,
role: role,
workspace: workspace,
branch: branch,
position: position,
email: email,
Expand Down
10 changes: 5 additions & 5 deletions SampoomManagement/Features/Auth/UI/AuthViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class AuthViewModel: ObservableObject {
}

func signOut() async {
do {
try await signOutUseCase.execute()
} catch {
print("AuthViewModel - 로그아웃 실패: \(error)")
}
// do {
// try await signOutUseCase.execute()
// } catch {
// print("AuthViewModel - 로그아웃 실패: \(error)")
// }

// 로그아웃 성공/실패 관계없이 로컬 상태 업데이트
handleSignedOutState()
Expand Down
2 changes: 1 addition & 1 deletion SampoomManagement/Features/Auth/UI/LoginViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class LoginViewModel: ObservableObject {
_ = try await loginUseCase.execute(email: email, password: password)
// 로그인 성공 후 프로필 조회
do {
_ = try await getProfileUseCase.execute(role: "AGENCY")
_ = try await getProfileUseCase.execute(workspace: "AGENCY")
uiState = uiState.copy(loading: false, success: true)
} catch {
uiState = uiState.copy(loading: false)
Expand Down
10 changes: 5 additions & 5 deletions SampoomManagement/Features/Auth/UI/SignUpUiState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

struct SignUpUiState: UIState {
let name: String
let role: String
let workspace: String
let branch: String
let position: String
let email: String
Expand All @@ -35,7 +35,7 @@ struct SignUpUiState: UIState {

init(
name: String = "",
role: String = "AGENCY",
workspace: String = "AGENCY",
branch: String = "",
position: String = "",
email: String = "",
Expand All @@ -55,7 +55,7 @@ struct SignUpUiState: UIState {
success: Bool = false
) {
self.name = name
self.role = role
self.workspace = workspace
self.branch = branch
self.position = position
self.email = email
Expand Down Expand Up @@ -92,7 +92,7 @@ struct SignUpUiState: UIState {

func copy(
name: String? = nil,
role: String? = nil,
workspace: String? = nil,
branch: String? = nil,
position: String? = nil,
email: String? = nil,
Expand All @@ -113,7 +113,7 @@ struct SignUpUiState: UIState {
) -> SignUpUiState {
return SignUpUiState(
name: name ?? self.name,
role: role ?? self.role,
workspace: workspace ?? self.workspace,
branch: branch ?? self.branch,
position: position ?? self.position,
email: email ?? self.email,
Expand Down
6 changes: 3 additions & 3 deletions SampoomManagement/Features/Auth/UI/SignUpViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SignUpViewModel: ObservableObject {
guard uiState.isValid else { return }

let name = uiState.name
let role = uiState.role
let workspace = uiState.workspace
let branch = uiState.branch
let position = uiState.position
let email = uiState.email
Expand All @@ -93,14 +93,14 @@ class SignUpViewModel: ObservableObject {
do {
_ = try await signUpUseCase.execute(
userName: name,
role: role,
workspace: workspace,
branch: branch,
position: position,
email: email,
password: password
)
// 회원가입 성공 후 프로필 조회
_ = try await getProfileUseCase.execute(role: "AGENCY")
_ = try await getProfileUseCase.execute(workspace: "AGENCY")
uiState = uiState.copy(loading: false, success: true)
} catch {
uiState = uiState.copy(loading: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ class DashboardViewModel: ObservableObject {
)
return
}
let role = storedUser.role.isEmpty ? "AGENCY" : storedUser.role
let workspace = storedUser.workspace.isEmpty ? "AGENCY" : storedUser.workspace

let count = try await getEmployeeCountUseCase.execute(
role: role,
workspace: workspace,
organizationId: storedUser.agencyId
)

Expand Down
Loading