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 = 4;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = B9PUAVBBKX;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -300,7 +300,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.3;
MARKETING_VERSION = 1.0.6;
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 = 4;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = B9PUAVBBKX;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -335,7 +335,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.3;
MARKETING_VERSION = 1.0.6;
PRODUCT_BUNDLE_IDENTIFIER = com.sampoom.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = YES;
Expand Down
1 change: 0 additions & 1 deletion SampoomManagement/Core/Network/TokenRefreshService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class TokenRefreshService {
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 @@ -19,7 +19,6 @@ class AuthPreferences {
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 @@ -33,10 +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.rawValue, for: Keys.userRole)
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 @@ -51,7 +49,6 @@ class AuthPreferences {
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 Expand Up @@ -87,7 +84,6 @@ 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 @@ -98,12 +94,11 @@ class AuthPreferences {
id: userId,
name: userName,
email: userEmail,
role: UserRole(rawValue: userRole) ?? .user,
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 @@ -152,7 +147,6 @@ class AuthPreferences {
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,12 +13,11 @@ extension LoginResponseDTO {
id: self.userId,
name: "",
email: "",
role: .user,
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(workspace: "AGENCY", email: email, password: password)
let requestDTO = LoginRequestDTO(role: "AGENCY", email: email, password: password)

let parameters: [String: Any] = [
"workspace": requestDTO.workspace,
"role": requestDTO.role,
"email": requestDTO.email,
"password": requestDTO.password
]
Expand All @@ -37,14 +37,14 @@ class AuthAPI {
func signup(
email: String,
password: String,
workspace: String,
role: String,
branch: String,
userName: String,
position: String
) async throws -> APIResponse<SignupResponseDTO> {
let requestDTO = SignupRequestDTO(
userName: userName,
workspace: workspace,
role: role,
branch: branch,
position: position,
email: email,
Expand All @@ -54,7 +54,7 @@ class AuthAPI {
let parameters: [String: Any] = [
"email": requestDTO.email,
"password": requestDTO.password,
"workspace": requestDTO.workspace,
"role": requestDTO.role,
"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 workspace: String
let role: 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 workspace: String
let role: 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,
workspace: String,
role: String,
branch: String,
position: String,
email: String,
Expand All @@ -28,7 +28,7 @@ class AuthRepositoryImpl: AuthRepository {
_ = try await api.signup(
email: email,
password: password,
workspace: workspace,
role: role,
branch: branch,
userName: userName,
position: position
Expand Down Expand Up @@ -104,7 +104,6 @@ class AuthRepositoryImpl: AuthRepository {
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,
workspace: String,
role: 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,
workspace: String,
role: String,
branch: String,
position: String,
email: String,
password: String
) async throws -> User {
return try await repository.signUp(
userName: userName,
workspace: workspace,
role: role,
branch: branch,
position: position,
email: email,
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(workspace: "AGENCY")
_ = try await getProfileUseCase.execute(role: "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 workspace: String
let role: String
let branch: String
let position: String
let email: String
Expand All @@ -35,7 +35,7 @@ struct SignUpUiState: UIState {

init(
name: String = "",
workspace: String = "AGENCY",
role: String = "AGENCY",
branch: String = "",
position: String = "",
email: String = "",
Expand All @@ -55,7 +55,7 @@ struct SignUpUiState: UIState {
success: Bool = false
) {
self.name = name
self.workspace = workspace
self.role = role
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,
workspace: String? = nil,
role: 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,
workspace: workspace ?? self.workspace,
role: role ?? self.role,
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 workspace = uiState.workspace
let role = uiState.role
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,
workspace: workspace,
role: role,
branch: branch,
position: position,
email: email,
password: password
)
// 회원가입 성공 후 프로필 조회
_ = try await getProfileUseCase.execute(workspace: "AGENCY")
_ = try await getProfileUseCase.execute(role: "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 workspace = storedUser.workspace.isEmpty ? "AGENCY" : storedUser.workspace
let role = storedUser.role.isEmpty ? "AGENCY" : storedUser.role

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation

/// 주문 생성 요청 DTO
struct OrderRequestDto: Codable {
let agencyId: Int
let agencyName: String
let items: [OrderCategoryDto]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class OrderRepositoryImpl: OrderRepository {
)
}
let request = OrderRequestDto(
agencyId: user.agencyId,
agencyName: user.branch,
items: items
)
Expand Down
13 changes: 4 additions & 9 deletions SampoomManagement/Features/User/Data/Mappers/UserMappers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ extension GetProfileResponseDTO {
id: self.userId,
name: self.userName,
email: self.email,
role: UserRole(rawValue: self.role) ?? .user,
role: self.role,
accessToken: "",
refreshToken: "",
expiresIn: 0,
position: UserPosition(rawValue: self.position) ?? .staff,
workspace: self.workspace,
branch: self.branch,
agencyId: self.organizationId,
startedAt: self.startedAt.isEmpty ? nil : self.startedAt,
Expand All @@ -33,12 +32,11 @@ extension UpdateProfileResponseDTO {
id: self.userId,
name: self.userName,
email: "",
role: .user,
role: "",
accessToken: "",
refreshToken: "",
expiresIn: 0,
position: .staff,
workspace: "",
branch: "",
agencyId: 0,
startedAt: nil,
Expand All @@ -53,9 +51,8 @@ extension EditEmployeeResponseDTO {
id: self.userId,
userId: self.userId,
email: "",
role: "",
role: self.role,
userName: self.userName,
workspace: self.workspace,
organizationId: 0,
branch: "",
position: UserPosition(rawValue: self.position) ?? .staff,
Expand All @@ -76,7 +73,6 @@ extension EmployeeDTO {
email: self.email,
role: self.role,
userName: self.userName,
workspace: self.workspace,
organizationId: self.organizationId,
branch: self.branch,
position: UserPosition(rawValue: self.position) ?? .staff,
Expand All @@ -95,9 +91,8 @@ extension UpdateEmployeeStatusResponseDTO {
id: existingEmployee.id,
userId: self.userId,
email: existingEmployee.email,
role: existingEmployee.role,
role: self.role.isEmpty ? existingEmployee.role : self.role,
userName: self.userName.isEmpty ? existingEmployee.userName : self.userName,
workspace: self.workspace.isEmpty ? existingEmployee.workspace : self.workspace,
organizationId: existingEmployee.organizationId,
branch: existingEmployee.branch,
position: existingEmployee.position,
Expand Down
Loading