From 63019d92339bf0336df5b8315a5a128f8b555532 Mon Sep 17 00:00:00 2001 From: uuuunseo Date: Sun, 21 Jan 2024 11:58:43 +0900 Subject: [PATCH] :recycle: :: [#127] SwiftFormat --- .../DI/User/AppComponent+User.swift | 6 +- App/Sources/Application/NeedleGenerated.swift | 162 +++++++++++++----- .../ActivityListView.swift | 6 +- .../Source/InputActivityView.swift | 20 +-- .../StudentSignUpView.swift | 11 +- .../StudentSignUpViewModel.swift | 15 +- .../View/SchoolListView.swift | 8 +- .../Post/RemotePostDataSourceImpl.swift | 8 +- .../User/RemoteUserDataSourceImpl.swift | 3 +- .../Repository/Post/PostRepositoryImpl.swift | 12 +- .../Repository/User/UserRepositoryImpl.swift | 6 +- .../UseCase/Post/DeletePostUseCaseImpl.swift | 4 +- .../Post/QueryPostDetailUseCaseImpl.swift | 4 +- .../Post/QueryPostListUseCaseImpl.swift | 4 +- .../UseCase/Post/UpdatePostUseCaseImpl.swift | 4 +- .../UseCase/Post/WritePostUseCaseImpl.swift | 4 +- .../User/ChangePasswordUseCaseImpl.swift | 4 +- .../UseCase/User/QueryMyInfoUseCaseImpl.swift | 4 +- .../Domain/PostDomain/API/PostAPI.swift | 16 +- .../DTO/Request/InputPostRequestDTO.swift | 2 +- .../DTO/Response/PostDetailResponseDTO.swift | 2 +- .../DTO/Response/PostsResponseDTO.swift | 4 +- .../PostDomain/Entity/PostDetailEntity.swift | 2 +- .../Domain/PostDomain/Entity/PostEntity.swift | 2 +- .../Domain/UserDomain/API/UserAPI.swift | 12 +- .../Request/ChangePasswordRequestDTO.swift | 2 +- .../Response/InquiryMyInfoResponseDTO.swift | 2 +- .../UserDomain/Entity/MyInfoEntity.swift | 2 +- .../UserDomain/Error/UserDomainError.swift | 1 - 29 files changed, 207 insertions(+), 125 deletions(-) diff --git a/App/Sources/Application/DI/User/AppComponent+User.swift b/App/Sources/Application/DI/User/AppComponent+User.swift index 02f816f9..ec8b7dfa 100644 --- a/App/Sources/Application/DI/User/AppComponent+User.swift +++ b/App/Sources/Application/DI/User/AppComponent+User.swift @@ -7,19 +7,19 @@ public extension AppComponent { RemoteUserDataSourceImpl(keychain: keychain) } } - + var userRepository: any UserRepository { shared { UserRepositoryImpl(remoteUserDataSource: remoteUserDataSource) } } - + var changePasswordUseCase: any ChangePasswordUseCase { shared { ChangePasswordUseCaseImpl(userRepository: userRepository) } } - + var queryMyInfoUseCase: any QueryMyInfoUseCase { shared { QueryMyInfoUseCaseImpl(userRepository: userRepository) diff --git a/App/Sources/Application/NeedleGenerated.swift b/App/Sources/Application/NeedleGenerated.swift index 3aed1418..38dcb4fd 100644 --- a/App/Sources/Application/NeedleGenerated.swift +++ b/App/Sources/Application/NeedleGenerated.swift @@ -22,94 +22,114 @@ private class StudentSignUpDependency32f0961d5bf3e2a5f205Provider: StudentSignUp var studentSignupUseCase: any StudentSignupUseCase { return appComponent.studentSignupUseCase } + var teacherSignupUseCase: any TeacherSignupUseCase { return appComponent.teacherSignupUseCase } + var bbozzakSignupUseCase: any BbozzakSignupUseCase { return appComponent.bbozzakSignupUseCase } + var professorSignupUseCase: any ProfessorSignupUseCase { return appComponent.professorSignupUseCase } + var governmentSignupUseCase: any GovernmentSignupUseCase { return appComponent.governmentSignupUseCase } + var companyInstructorSignupUseCase: any CompanyInstructorSignupUseCase { return appComponent.companyInstructorSignupUseCase } + private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent } } + /// ^->AppComponent->StudentSignUpComponent private func factoryc57b1cf1651b3051e040f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return StudentSignUpDependency32f0961d5bf3e2a5f205Provider(appComponent: parent1(component) as! AppComponent) } + private class RootDependency3944cc797a4a88956fb5Provider: RootDependency { var loginFactory: any LoginFactory { return appComponent.loginFactory } + private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent } } + /// ^->AppComponent->RootComponent private func factory264bfc4d4cb6b0629b40f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return RootDependency3944cc797a4a88956fb5Provider(appComponent: parent1(component) as! AppComponent) } + private class ActivityListDependencyb8e659960978b8384f80Provider: ActivityListDependency { var inputActivityFactory: any InputActivityFactory { return appComponent.inputActivityFactory } + var loadUserAuthorityUseCase: any LoadUserAuthorityUseCase { return appComponent.loadUserAuthorityUseCase } + var queryMyStudentActivityUseCase: any QueryMyStudentActivityUseCase { return appComponent.queryMyStudentActivityUseCase } + var queryStudentActivityListUseCase: any QueryStudentActivityListUseCase { return appComponent.queryStudentActivityListUseCase } + var queryStudentActivityByIdUseCase: any QueryStudentActivityByIdUseCase { return appComponent.queryStudentActivityByIdUseCase } + private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent } } + /// ^->AppComponent->ActivityListComponent private func factory7177e6769ee69064a61bf47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return ActivityListDependencyb8e659960978b8384f80Provider(appComponent: parent1(component) as! AppComponent) } + private class LoginDependencyf4e78d0ad57be469bfd9Provider: LoginDependency { var loginUseCase: any LoginUseCase { return appComponent.loginUseCase } + var signupFactory: any StudentSignUpFactory { return appComponent.signupFactory } + var saveUserAuthorityUseCase: any SaveUserAuthorityUseCase { return appComponent.saveUserAuthorityUseCase } + private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent } } + /// ^->AppComponent->LoginComponent private func factoryd6018e98563de75a2ba4f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return LoginDependencyf4e78d0ad57be469bfd9Provider(appComponent: parent1(component) as! AppComponent) } -private class InputActivityDependency4e692e68e51cea5b706dProvider: InputActivityDependency { - - - init() { - } +private class InputActivityDependency4e692e68e51cea5b706dProvider: InputActivityDependency { + init() {} } + /// ^->AppComponent->InputActivityComponent private func factory3fc1a279eeb8c906e603e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject { return InputActivityDependency4e692e68e51cea5b706dProvider() @@ -121,77 +141,130 @@ extension StudentSignUpComponent: Registration { keyPathToName[\StudentSignUpDependency.studentSignupUseCase] = "studentSignupUseCase-any StudentSignupUseCase" keyPathToName[\StudentSignUpDependency.teacherSignupUseCase] = "teacherSignupUseCase-any TeacherSignupUseCase" keyPathToName[\StudentSignUpDependency.bbozzakSignupUseCase] = "bbozzakSignupUseCase-any BbozzakSignupUseCase" - keyPathToName[\StudentSignUpDependency.professorSignupUseCase] = "professorSignupUseCase-any ProfessorSignupUseCase" - keyPathToName[\StudentSignUpDependency.governmentSignupUseCase] = "governmentSignupUseCase-any GovernmentSignupUseCase" - keyPathToName[\StudentSignUpDependency.companyInstructorSignupUseCase] = "companyInstructorSignupUseCase-any CompanyInstructorSignupUseCase" + keyPathToName[\StudentSignUpDependency.professorSignupUseCase] = + "professorSignupUseCase-any ProfessorSignupUseCase" + keyPathToName[\StudentSignUpDependency.governmentSignupUseCase] = + "governmentSignupUseCase-any GovernmentSignupUseCase" + keyPathToName[\StudentSignUpDependency.companyInstructorSignupUseCase] = + "companyInstructorSignupUseCase-any CompanyInstructorSignupUseCase" } } + extension RootComponent: Registration { public func registerItems() { keyPathToName[\RootDependency.loginFactory] = "loginFactory-any LoginFactory" } } + extension ActivityListComponent: Registration { public func registerItems() { keyPathToName[\ActivityListDependency.inputActivityFactory] = "inputActivityFactory-any InputActivityFactory" - keyPathToName[\ActivityListDependency.loadUserAuthorityUseCase] = "loadUserAuthorityUseCase-any LoadUserAuthorityUseCase" - keyPathToName[\ActivityListDependency.queryMyStudentActivityUseCase] = "queryMyStudentActivityUseCase-any QueryMyStudentActivityUseCase" - keyPathToName[\ActivityListDependency.queryStudentActivityListUseCase] = "queryStudentActivityListUseCase-any QueryStudentActivityListUseCase" - keyPathToName[\ActivityListDependency.queryStudentActivityByIdUseCase] = "queryStudentActivityByIdUseCase-any QueryStudentActivityByIdUseCase" + keyPathToName[\ActivityListDependency.loadUserAuthorityUseCase] = + "loadUserAuthorityUseCase-any LoadUserAuthorityUseCase" + keyPathToName[\ActivityListDependency.queryMyStudentActivityUseCase] = + "queryMyStudentActivityUseCase-any QueryMyStudentActivityUseCase" + keyPathToName[\ActivityListDependency.queryStudentActivityListUseCase] = + "queryStudentActivityListUseCase-any QueryStudentActivityListUseCase" + keyPathToName[\ActivityListDependency.queryStudentActivityByIdUseCase] = + "queryStudentActivityByIdUseCase-any QueryStudentActivityByIdUseCase" } } + extension LoginComponent: Registration { public func registerItems() { keyPathToName[\LoginDependency.loginUseCase] = "loginUseCase-any LoginUseCase" keyPathToName[\LoginDependency.signupFactory] = "signupFactory-any StudentSignUpFactory" - keyPathToName[\LoginDependency.saveUserAuthorityUseCase] = "saveUserAuthorityUseCase-any SaveUserAuthorityUseCase" + keyPathToName[\LoginDependency.saveUserAuthorityUseCase] = + "saveUserAuthorityUseCase-any SaveUserAuthorityUseCase" } } -extension InputActivityComponent: Registration { - public func registerItems() { - } +extension InputActivityComponent: Registration { + public func registerItems() {} } + extension AppComponent: Registration { public func registerItems() { - localTable["keychain-Keychain"] = { [unowned self] in self.keychain as Any } - localTable["localAuthDataSource-any LocalAuthDataSource"] = { [unowned self] in self.localAuthDataSource as Any } - localTable["remoteAuthDataSource-any RemoteAuthDataSource"] = { [unowned self] in self.remoteAuthDataSource as Any } + localTable["localAuthDataSource-any LocalAuthDataSource"] = { [unowned self] in + self.localAuthDataSource as Any + } + localTable["remoteAuthDataSource-any RemoteAuthDataSource"] = { [unowned self] in + self.remoteAuthDataSource as Any + } localTable["authRepository-any AuthRepository"] = { [unowned self] in self.authRepository as Any } localTable["loginUseCase-any LoginUseCase"] = { [unowned self] in self.loginUseCase as Any } - localTable["saveUserAuthorityUseCase-any SaveUserAuthorityUseCase"] = { [unowned self] in self.saveUserAuthorityUseCase as Any } - localTable["loadUserAuthorityUseCase-any LoadUserAuthorityUseCase"] = { [unowned self] in self.loadUserAuthorityUseCase as Any } - localTable["reissueTokenUseCase-any ReissueTokenUseCase"] = { [unowned self] in self.reissueTokenUseCase as Any } + localTable["saveUserAuthorityUseCase-any SaveUserAuthorityUseCase"] = { [unowned self] in + self.saveUserAuthorityUseCase as Any + } + localTable["loadUserAuthorityUseCase-any LoadUserAuthorityUseCase"] = { [unowned self] in + self.loadUserAuthorityUseCase as Any + } + localTable["reissueTokenUseCase-any ReissueTokenUseCase"] = { [unowned self] in + self.reissueTokenUseCase as Any + } localTable["logoutUseCase-any LogoutUseCase"] = { [unowned self] in self.logoutUseCase as Any } localTable["withdrawalUseCase-any WithdrawalUseCase"] = { [unowned self] in self.withdrawalUseCase as Any } - localTable["studentSignupUseCase-any StudentSignupUseCase"] = { [unowned self] in self.studentSignupUseCase as Any } - localTable["teacherSignupUseCase-any TeacherSignupUseCase"] = { [unowned self] in self.teacherSignupUseCase as Any } - localTable["bbozzakSignupUseCase-any BbozzakSignupUseCase"] = { [unowned self] in self.bbozzakSignupUseCase as Any } - localTable["professorSignupUseCase-any ProfessorSignupUseCase"] = { [unowned self] in self.professorSignupUseCase as Any } - localTable["governmentSignupUseCase-any GovernmentSignupUseCase"] = { [unowned self] in self.governmentSignupUseCase as Any } - localTable["companyInstructorSignupUseCase-any CompanyInstructorSignupUseCase"] = { [unowned self] in self.companyInstructorSignupUseCase as Any } + localTable["studentSignupUseCase-any StudentSignupUseCase"] = { [unowned self] in + self.studentSignupUseCase as Any + } + localTable["teacherSignupUseCase-any TeacherSignupUseCase"] = { [unowned self] in + self.teacherSignupUseCase as Any + } + localTable["bbozzakSignupUseCase-any BbozzakSignupUseCase"] = { [unowned self] in + self.bbozzakSignupUseCase as Any + } + localTable["professorSignupUseCase-any ProfessorSignupUseCase"] = { [unowned self] in + self.professorSignupUseCase as Any + } + localTable["governmentSignupUseCase-any GovernmentSignupUseCase"] = { [unowned self] in + self.governmentSignupUseCase as Any + } + localTable["companyInstructorSignupUseCase-any CompanyInstructorSignupUseCase"] = { [unowned self] in + self.companyInstructorSignupUseCase as Any + } localTable["remoteDataSource-any RemoteActivityDataSource"] = { [unowned self] in self.remoteDataSource as Any } localTable["activityRepository-any ActivityRepository"] = { [unowned self] in self.activityRepository as Any } - localTable["addStudentActivityUseCase-any AddStudentActivityUseCase"] = { [unowned self] in self.addStudentActivityUseCase as Any } - localTable["approveStudentActivityUseCase-any ApproveStudentActivityUseCase"] = { [unowned self] in self.approveStudentActivityUseCase as Any } - localTable["deleteStudentActivityUseCase-any DeleteStudentActivityUseCase"] = { [unowned self] in self.deleteStudentActivityUseCase as Any } - localTable["queryMyStudentActivityUseCase-any QueryMyStudentActivityUseCase"] = { [unowned self] in self.queryMyStudentActivityUseCase as Any } - localTable["queryStudentActivityByIdUseCase-any QueryStudentActivityByIdUseCase"] = { [unowned self] in self.queryStudentActivityByIdUseCase as Any } - localTable["queryStudentActivityListUseCase-any QueryStudentActivityListUseCase"] = { [unowned self] in self.queryStudentActivityListUseCase as Any } - localTable["queryStudentActivityDetailsUseCase-any QueryStudentActivityDetailsUseCase"] = { [unowned self] in self.queryStudentActivityDetailsUseCase as Any } - localTable["remoteUserDataSource-any RemoteUserDataSource"] = { [unowned self] in self.remoteUserDataSource as Any } + localTable["addStudentActivityUseCase-any AddStudentActivityUseCase"] = { [unowned self] in + self.addStudentActivityUseCase as Any + } + localTable["approveStudentActivityUseCase-any ApproveStudentActivityUseCase"] = { [unowned self] in + self.approveStudentActivityUseCase as Any + } + localTable["deleteStudentActivityUseCase-any DeleteStudentActivityUseCase"] = { [unowned self] in + self.deleteStudentActivityUseCase as Any + } + localTable["queryMyStudentActivityUseCase-any QueryMyStudentActivityUseCase"] = { [unowned self] in + self.queryMyStudentActivityUseCase as Any + } + localTable["queryStudentActivityByIdUseCase-any QueryStudentActivityByIdUseCase"] = { [unowned self] in + self.queryStudentActivityByIdUseCase as Any + } + localTable["queryStudentActivityListUseCase-any QueryStudentActivityListUseCase"] = { [unowned self] in + self.queryStudentActivityListUseCase as Any + } + localTable["queryStudentActivityDetailsUseCase-any QueryStudentActivityDetailsUseCase"] = { [unowned self] in + self.queryStudentActivityDetailsUseCase as Any + } + localTable["remoteUserDataSource-any RemoteUserDataSource"] = { [unowned self] in + self.remoteUserDataSource as Any + } localTable["userRepository-any UserRepository"] = { [unowned self] in self.userRepository as Any } - localTable["changePasswordUseCase-any ChangePasswordUseCase"] = { [unowned self] in self.changePasswordUseCase as Any } + localTable["changePasswordUseCase-any ChangePasswordUseCase"] = { [unowned self] in + self.changePasswordUseCase as Any + } localTable["queryMyInfoUseCase-any QueryMyInfoUseCase"] = { [unowned self] in self.queryMyInfoUseCase as Any } localTable["loginFactory-any LoginFactory"] = { [unowned self] in self.loginFactory as Any } - localTable["activityListFactory-any ActivityListFactory"] = { [unowned self] in self.activityListFactory as Any } + localTable["activityListFactory-any ActivityListFactory"] = { [unowned self] in + self.activityListFactory as Any + } localTable["signupFactory-any StudentSignUpFactory"] = { [unowned self] in self.signupFactory as Any } - localTable["inputActivityFactory-any InputActivityFactory"] = { [unowned self] in self.inputActivityFactory as Any } + localTable["inputActivityFactory-any InputActivityFactory"] = { [unowned self] in + self.inputActivityFactory as Any + } } } - #endif private func factoryEmptyDependencyProvider(_ component: NeedleFoundation.Scope) -> AnyObject { @@ -199,7 +272,10 @@ private func factoryEmptyDependencyProvider(_ component: NeedleFoundation.Scope) } // MARK: - Registration -private func registerProviderFactory(_ componentPath: String, _ factory: @escaping (NeedleFoundation.Scope) -> AnyObject) { +private func registerProviderFactory( + _ componentPath: String, + _ factory: @escaping (NeedleFoundation.Scope) -> AnyObject +) { __DependencyProviderRegistry.instance.registerDependencyProviderFactory(for: componentPath, factory) } @@ -216,7 +292,7 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi #endif public func registerProviderFactories() { -#if !NEEDLE_DYNAMIC + #if !NEEDLE_DYNAMIC register1() -#endif + #endif } diff --git a/App/Sources/Feature/ActivityListFeature/ActivityListView.swift b/App/Sources/Feature/ActivityListFeature/ActivityListView.swift index 277870b6..9eeea2b1 100644 --- a/App/Sources/Feature/ActivityListFeature/ActivityListView.swift +++ b/App/Sources/Feature/ActivityListFeature/ActivityListView.swift @@ -5,9 +5,9 @@ struct ActivityListView: View { @Environment(\.dismiss) var dismiss @StateObject var model: ActivityListModel @StateObject var viewModel: ActivityListViewModel - + private let inputActivityFactory: any InputActivityFactory - + init( inputActivityFactory: any InputActivityFactory, model: ActivityListModel, @@ -17,7 +17,7 @@ struct ActivityListView: View { _model = StateObject(wrappedValue: model) _viewModel = StateObject(wrappedValue: viewModel) } - + var body: some View { NavigationView { ScrollView { diff --git a/App/Sources/Feature/InputActivityFeature/Source/InputActivityView.swift b/App/Sources/Feature/InputActivityFeature/Source/InputActivityView.swift index 6f2abb2f..dc0d684e 100644 --- a/App/Sources/Feature/InputActivityFeature/Source/InputActivityView.swift +++ b/App/Sources/Feature/InputActivityFeature/Source/InputActivityView.swift @@ -2,11 +2,11 @@ import SwiftUI struct InputActivityView: View { @StateObject var viewModel: InputActivityViewModel - + init(viewModel: InputActivityViewModel) { _viewModel = StateObject(wrappedValue: viewModel) } - + var body: some View { ScrollView { VStack(spacing: 0) { @@ -33,9 +33,9 @@ struct InputActivityView: View { } .padding(.top, -40) .frame(minHeight: 40, maxHeight: 120) - + Divider() - + VStack { TextEditor(text: Binding( get: { viewModel.activityText }, @@ -59,18 +59,18 @@ struct InputActivityView: View { } .padding(.top, 16) .frame(height: 460) - + Divider() - + VStack(spacing: 8) { Button {} label: { Spacer() - + BitgouelAsset.Icons.setting.swiftUIImage - + Text("활동 세부 설정") .bitgouelFont(.text3, color: .primary(.p5)) - + Spacer() } .padding(.vertical, 12) @@ -79,7 +79,7 @@ struct InputActivityView: View { RoundedRectangle(cornerRadius: 8) .strokeBorder(Color.bitgouel(.primary(.p5))) } - + CTAButton( text: "활동 추가", style: .default diff --git a/App/Sources/Feature/StudentSignUpFeature/StudentSignUpView.swift b/App/Sources/Feature/StudentSignUpFeature/StudentSignUpView.swift index ef0b51ef..85e6402f 100644 --- a/App/Sources/Feature/StudentSignUpFeature/StudentSignUpView.swift +++ b/App/Sources/Feature/StudentSignUpFeature/StudentSignUpView.swift @@ -1,5 +1,5 @@ -import SwiftUI import Service +import SwiftUI struct StudentSignUpView: View { @StateObject var viewModel: StudentSignUpViewModel @@ -226,7 +226,6 @@ struct StudentSignUpView: View { AssociationSelectButton(text: viewModel.selectedAssociation?.associationValue() ?? "소속") { viewModel.isPresentedAssociationSheet = true } - } } @@ -324,13 +323,13 @@ struct StudentSignUpView: View { .padding(.bottom, -20) } } - + @ViewBuilder func userRoleTypeView() -> some View { ScrollView { let data: [UserAuthorityType] = viewModel.selectedAssociation == .school - ? [.student, .teacher] - : [.companyInstructor, .professor, .bbozzack, .government] + ? [.student, .teacher] + : [.companyInstructor, .professor, .bbozzack, .government] ForEach(data, id: \.self) { userRole in HStack { Text(userRole.display()) @@ -354,7 +353,7 @@ struct StudentSignUpView: View { } } } - + @ViewBuilder func associationTypeView() -> some View { ScrollView { diff --git a/App/Sources/Feature/StudentSignUpFeature/StudentSignUpViewModel.swift b/App/Sources/Feature/StudentSignUpFeature/StudentSignUpViewModel.swift index e54ed58d..11c305b4 100644 --- a/App/Sources/Feature/StudentSignUpFeature/StudentSignUpViewModel.swift +++ b/App/Sources/Feature/StudentSignUpFeature/StudentSignUpViewModel.swift @@ -7,7 +7,7 @@ class StudentSignUpViewModel: BaseViewModel { @Published var isPresentedUserRoleSheet = false @Published var isPresentedSchoolSheet = false @Published var isPresentedClubSheet = false - + // MARK: variable @Published var schoolSearch = "" @Published var clubSearch = "" @@ -29,34 +29,39 @@ class StudentSignUpViewModel: BaseViewModel { @Published var studentID: String = "" @Published var selectedAssociation: AssociationType? @Published var selectedUserRole: UserAuthorityType? - + // MARK: computed property var clubsForSelectedHighSchool: [String] { selectedSchool?.getClubsForSelectedHighSchool() ?? [] } - + // MARK: validation var nameIsValid: Bool { name.count >= 2 } + var yearOfAdmissionIsValid: Bool { (yearOfAdmission ?? 0) >= 1000 } + var studentIDIsValid: Bool { studentID.count == 4 && grade != nil && classRoom != nil && number != nil } + var phoneNumberIsValid: Bool { phoneNumber.count == 11 } + var emailIsValid: Bool { let emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}" return NSPredicate(format: "SELF MATCHES %@", emailRegex).evaluate(with: email) } + var passwordIsValid: Bool { let passwordRegex = "[A-Z0-9a-z@!#$%%^~&*()_+-=.]{8,24}" return NSPredicate(format: "SELF MATCHES %@", passwordRegex).evaluate(with: password) } - + // MARK: usecase private let studentSignupUseCase: StudentSignupUseCase private let teacherSignupUseCase: TeacherSignupUseCase @@ -229,7 +234,7 @@ class StudentSignUpViewModel: BaseViewModel { return "비밀번호를 다시 입력해 주세요!" } } - + func parseStudentID() { if studentID.count == 4 { grade = Int(studentID.prefix(1)) diff --git a/App/Sources/Feature/StudentSignUpFeature/View/SchoolListView.swift b/App/Sources/Feature/StudentSignUpFeature/View/SchoolListView.swift index ef2511e0..8919a894 100644 --- a/App/Sources/Feature/StudentSignUpFeature/View/SchoolListView.swift +++ b/App/Sources/Feature/StudentSignUpFeature/View/SchoolListView.swift @@ -1,5 +1,5 @@ -import SwiftUI import Service +import SwiftUI struct SchoolListView: View { let searchKeyword: Binding @@ -18,7 +18,11 @@ struct SchoolListView: View { ScrollView { LazyVStack { ForEach(schoolList, id: \.self) { school in - SchoolListRowView(school: school, selectedSchool: selectedSchool, onHighSchoolSelect: onHighSchoolSelect) + SchoolListRowView( + school: school, + selectedSchool: selectedSchool, + onHighSchoolSelect: onHighSchoolSelect + ) } } } diff --git a/Service/Sources/Data/DataSource/Post/RemotePostDataSourceImpl.swift b/Service/Sources/Data/DataSource/Post/RemotePostDataSourceImpl.swift index d1fb2ead..e743a40d 100644 --- a/Service/Sources/Data/DataSource/Post/RemotePostDataSourceImpl.swift +++ b/Service/Sources/Data/DataSource/Post/RemotePostDataSourceImpl.swift @@ -4,19 +4,19 @@ public final class RemotePostDataSourceImpl: BaseRemoteDataSource, Remo public func writePost(req: InputPostRequestDTO) async throws { try await request(.writePost(req: req)) } - + public func queryPostList() async throws -> [PostEntity] { try await request(.queryPostList, dto: PostListsResponseDTO.self).toDomain() } - + public func queryPostDetail(postID: String) async throws -> PostDetailEntity { try await request(.queryPostDetail(postID: postID), dto: PostDetailResponseDTO.self).toDomain() } - + public func updatePost(postID: String, req: InputPostRequestDTO) async throws { try await request(.updatePost(postID: postID, req: req)) } - + public func deletePost(postID: String) async throws { try await request(.deletePost(postID: postID)) } diff --git a/Service/Sources/Data/DataSource/User/RemoteUserDataSourceImpl.swift b/Service/Sources/Data/DataSource/User/RemoteUserDataSourceImpl.swift index af5828f8..d23f1d68 100644 --- a/Service/Sources/Data/DataSource/User/RemoteUserDataSourceImpl.swift +++ b/Service/Sources/Data/DataSource/User/RemoteUserDataSourceImpl.swift @@ -1,11 +1,10 @@ import Foundation public final class RemoteUserDataSourceImpl: BaseRemoteDataSource, RemoteUserDataSource { - public func changePassword(req: ChangePasswordRequestDTO) async throws { try await request(.changePassword(req)) } - + public func queryMyInfo() async throws -> MyInfoEntity { try await request(.queryMyInfo, dto: QueryMyInfoResponseDTO.self).toDomain() } diff --git a/Service/Sources/Data/Repository/Post/PostRepositoryImpl.swift b/Service/Sources/Data/Repository/Post/PostRepositoryImpl.swift index 18b73931..2690e037 100644 --- a/Service/Sources/Data/Repository/Post/PostRepositoryImpl.swift +++ b/Service/Sources/Data/Repository/Post/PostRepositoryImpl.swift @@ -2,27 +2,27 @@ import Foundation public struct PostRepositoryImpl: PostRepository { private let remotePostDataSource: RemotePostDataSource - + public init(remotePostDataSource: RemotePostDataSource) { self.remotePostDataSource = remotePostDataSource } - + public func writePost(req: InputPostRequestDTO) async throws { try await remotePostDataSource.writePost(req: req) } - + public func queryPostList() async throws -> [PostEntity] { try await remotePostDataSource.queryPostList() } - + public func queryPostDetail(postID: String) async throws -> PostDetailEntity { try await remotePostDataSource.queryPostDetail(postID: postID) } - + public func updatePost(postID: String, req: InputPostRequestDTO) async throws { try await remotePostDataSource.updatePost(postID: postID, req: req) } - + public func deletePost(postID: String) async throws { try await remotePostDataSource.deletePost(postID: postID) } diff --git a/Service/Sources/Data/Repository/User/UserRepositoryImpl.swift b/Service/Sources/Data/Repository/User/UserRepositoryImpl.swift index cda032da..3553838d 100644 --- a/Service/Sources/Data/Repository/User/UserRepositoryImpl.swift +++ b/Service/Sources/Data/Repository/User/UserRepositoryImpl.swift @@ -2,15 +2,15 @@ import Foundation public struct UserRepositoryImpl: UserRepository { private let remoteUserDataSource: RemoteUserDataSource - + public init(remoteUserDataSource: RemoteUserDataSource) { self.remoteUserDataSource = remoteUserDataSource } - + public func changePassword(req: ChangePasswordRequestDTO) async throws { try await remoteUserDataSource.changePassword(req: req) } - + public func queryMyInfo() async throws -> MyInfoEntity { try await remoteUserDataSource.queryMyInfo() } diff --git a/Service/Sources/Data/UseCase/Post/DeletePostUseCaseImpl.swift b/Service/Sources/Data/UseCase/Post/DeletePostUseCaseImpl.swift index a81e72a2..46e1e0d0 100644 --- a/Service/Sources/Data/UseCase/Post/DeletePostUseCaseImpl.swift +++ b/Service/Sources/Data/UseCase/Post/DeletePostUseCaseImpl.swift @@ -2,11 +2,11 @@ import Foundation public struct DeletePostUseCaseImpl: DeletePostUseCase { private let postRepository: any PostRepository - + public init(postRepository: any PostRepository) { self.postRepository = postRepository } - + public func callAsFunction(postID: String) async throws { try await postRepository.deletePost(postID: postID) } diff --git a/Service/Sources/Data/UseCase/Post/QueryPostDetailUseCaseImpl.swift b/Service/Sources/Data/UseCase/Post/QueryPostDetailUseCaseImpl.swift index 6b9a3971..516e4f9b 100644 --- a/Service/Sources/Data/UseCase/Post/QueryPostDetailUseCaseImpl.swift +++ b/Service/Sources/Data/UseCase/Post/QueryPostDetailUseCaseImpl.swift @@ -2,11 +2,11 @@ import Foundation public struct QueryPostDetailUseCaseImpl: QueryPostDetailUseCase { private let postRepository: any PostRepository - + public init(postRepository: any PostRepository) { self.postRepository = postRepository } - + public func callAsFunction(postID: String) async throws -> PostDetailEntity { try await postRepository.queryPostDetail(postID: postID) } diff --git a/Service/Sources/Data/UseCase/Post/QueryPostListUseCaseImpl.swift b/Service/Sources/Data/UseCase/Post/QueryPostListUseCaseImpl.swift index 935184b7..58943dc3 100644 --- a/Service/Sources/Data/UseCase/Post/QueryPostListUseCaseImpl.swift +++ b/Service/Sources/Data/UseCase/Post/QueryPostListUseCaseImpl.swift @@ -2,11 +2,11 @@ import Foundation public struct QueryPostListUseCaseImpl: QueryPostListUseCase { private let postRepository: any PostRepository - + public init(postRepository: any PostRepository) { self.postRepository = postRepository } - + public func callAsFunction() async throws -> [PostEntity] { try await postRepository.queryPostList() } diff --git a/Service/Sources/Data/UseCase/Post/UpdatePostUseCaseImpl.swift b/Service/Sources/Data/UseCase/Post/UpdatePostUseCaseImpl.swift index 27a52de2..39b34125 100644 --- a/Service/Sources/Data/UseCase/Post/UpdatePostUseCaseImpl.swift +++ b/Service/Sources/Data/UseCase/Post/UpdatePostUseCaseImpl.swift @@ -2,11 +2,11 @@ import Foundation public struct UpdatePostUseCaseImpl: UpdatePostUseCase { private let postRepository: any PostRepository - + public init(postRepository: any PostRepository) { self.postRepository = postRepository } - + public func callAsFunction(postID: String, req: InputPostRequestDTO) async throws { try await postRepository.updatePost(postID: postID, req: req) } diff --git a/Service/Sources/Data/UseCase/Post/WritePostUseCaseImpl.swift b/Service/Sources/Data/UseCase/Post/WritePostUseCaseImpl.swift index 9c510917..30516ca2 100644 --- a/Service/Sources/Data/UseCase/Post/WritePostUseCaseImpl.swift +++ b/Service/Sources/Data/UseCase/Post/WritePostUseCaseImpl.swift @@ -2,11 +2,11 @@ import Foundation public struct WritePostUseCaseImpl: WritePostUseCase { private let postRepository: any PostRepository - + public init(postRepository: any PostRepository) { self.postRepository = postRepository } - + public func callAsFunction(req: InputPostRequestDTO) async throws { try await postRepository.writePost(req: req) } diff --git a/Service/Sources/Data/UseCase/User/ChangePasswordUseCaseImpl.swift b/Service/Sources/Data/UseCase/User/ChangePasswordUseCaseImpl.swift index 92acdab9..4c80ad43 100644 --- a/Service/Sources/Data/UseCase/User/ChangePasswordUseCaseImpl.swift +++ b/Service/Sources/Data/UseCase/User/ChangePasswordUseCaseImpl.swift @@ -2,11 +2,11 @@ import Foundation public struct ChangePasswordUseCaseImpl: ChangePasswordUseCase { private let userRepository: any UserRepository - + public init(userRepository: any UserRepository) { self.userRepository = userRepository } - + public func callAsFunction(req: ChangePasswordRequestDTO) async throws { try await userRepository.changePassword(req: req) } diff --git a/Service/Sources/Data/UseCase/User/QueryMyInfoUseCaseImpl.swift b/Service/Sources/Data/UseCase/User/QueryMyInfoUseCaseImpl.swift index 6a171428..7a4efc58 100644 --- a/Service/Sources/Data/UseCase/User/QueryMyInfoUseCaseImpl.swift +++ b/Service/Sources/Data/UseCase/User/QueryMyInfoUseCaseImpl.swift @@ -2,11 +2,11 @@ import Foundation public struct QueryMyInfoUseCaseImpl: QueryMyInfoUseCase { private let userRepository: any UserRepository - + public init(userRepository: any UserRepository) { self.userRepository = userRepository } - + public func callAsFunction() async throws -> MyInfoEntity { try await userRepository.queryMyInfo() } diff --git a/Service/Sources/Domain/PostDomain/API/PostAPI.swift b/Service/Sources/Domain/PostDomain/API/PostAPI.swift index bcb6f831..820d55eb 100644 --- a/Service/Sources/Domain/PostDomain/API/PostAPI.swift +++ b/Service/Sources/Domain/PostDomain/API/PostAPI.swift @@ -11,14 +11,14 @@ public enum PostAPI { extension PostAPI: BitgouelAPI { public typealias ErrorType = PostDomainError - + public var domain: BitgouelDomain { .post } - + public var urlPath: String { switch self { - case .writePost, + case .writePost, .queryPostList: return "" case let .queryPostDetail(postID), @@ -27,7 +27,7 @@ extension PostAPI: BitgouelAPI { return "\(postID)" } } - + public var method: Moya.Method { switch self { case .writePost: @@ -41,24 +41,24 @@ extension PostAPI: BitgouelAPI { return .delete } } - + public var task: Moya.Task { switch self { case let .writePost(req), - .updatePost(_, let req): + let .updatePost(_, req): return .requestJSONEncodable(req) default: return .requestPlain } } - + public var jwtTokenType: JwtTokenType { switch self { default: return .accessToken } } - + public var errorMap: [Int : PostDomainError] { switch self { case .writePost, diff --git a/Service/Sources/Domain/PostDomain/DTO/Request/InputPostRequestDTO.swift b/Service/Sources/Domain/PostDomain/DTO/Request/InputPostRequestDTO.swift index e249e0c0..2959f6b6 100644 --- a/Service/Sources/Domain/PostDomain/DTO/Request/InputPostRequestDTO.swift +++ b/Service/Sources/Domain/PostDomain/DTO/Request/InputPostRequestDTO.swift @@ -5,7 +5,7 @@ public struct InputPostRequestDTO: Encodable { public let content: String public let links: [String] public let feedType: FeedType - + init( title: String, content: String, diff --git a/Service/Sources/Domain/PostDomain/DTO/Response/PostDetailResponseDTO.swift b/Service/Sources/Domain/PostDomain/DTO/Response/PostDetailResponseDTO.swift index eeb1bbb9..8b88fc82 100644 --- a/Service/Sources/Domain/PostDomain/DTO/Response/PostDetailResponseDTO.swift +++ b/Service/Sources/Domain/PostDomain/DTO/Response/PostDetailResponseDTO.swift @@ -7,7 +7,7 @@ public struct PostDetailResponseDTO: Decodable { public let feedType: FeedType public let modifiedAt: String public let links: [String] - + public init( title: String, writer: String, diff --git a/Service/Sources/Domain/PostDomain/DTO/Response/PostsResponseDTO.swift b/Service/Sources/Domain/PostDomain/DTO/Response/PostsResponseDTO.swift index 71780e86..3c245ccf 100644 --- a/Service/Sources/Domain/PostDomain/DTO/Response/PostsResponseDTO.swift +++ b/Service/Sources/Domain/PostDomain/DTO/Response/PostsResponseDTO.swift @@ -2,13 +2,13 @@ import Foundation public struct PostListsResponseDTO: Decodable { public let posts: [PostInfo] - + public init( posts: [PostInfo] ) { self.posts = posts } - + public struct PostInfo: Decodable { public let postId: String public let title: String diff --git a/Service/Sources/Domain/PostDomain/Entity/PostDetailEntity.swift b/Service/Sources/Domain/PostDomain/Entity/PostDetailEntity.swift index eac5d8da..b1acd68d 100644 --- a/Service/Sources/Domain/PostDomain/Entity/PostDetailEntity.swift +++ b/Service/Sources/Domain/PostDomain/Entity/PostDetailEntity.swift @@ -7,7 +7,7 @@ public struct PostDetailEntity: Equatable { public let feedType: FeedType public let modifiedAt: String public let links: [String] - + public init( title: String, writer: String, diff --git a/Service/Sources/Domain/PostDomain/Entity/PostEntity.swift b/Service/Sources/Domain/PostDomain/Entity/PostEntity.swift index e8afae94..20b4c2e2 100644 --- a/Service/Sources/Domain/PostDomain/Entity/PostEntity.swift +++ b/Service/Sources/Domain/PostDomain/Entity/PostEntity.swift @@ -4,7 +4,7 @@ public struct PostEntity: Equatable { public let postId: String public let title: String public let modifedAt: String - + public init( postId: String, title: String, diff --git a/Service/Sources/Domain/UserDomain/API/UserAPI.swift b/Service/Sources/Domain/UserDomain/API/UserAPI.swift index 8520cc8a..760bddd4 100644 --- a/Service/Sources/Domain/UserDomain/API/UserAPI.swift +++ b/Service/Sources/Domain/UserDomain/API/UserAPI.swift @@ -8,18 +8,18 @@ public enum UserAPI { extension UserAPI: BitgouelAPI { public typealias ErrorType = UserDomainError - + public var domain: BitgouelDomain { .user } - + public var urlPath: String { switch self { case .changePassword, .queryMyInfo: return "" } } - + public var method: Moya.Method { switch self { case .changePassword: @@ -28,7 +28,7 @@ extension UserAPI: BitgouelAPI { return .get } } - + public var task: Moya.Task { switch self { case let .changePassword(req): @@ -37,14 +37,14 @@ extension UserAPI: BitgouelAPI { return .requestPlain } } - + public var jwtTokenType: JwtTokenType { switch self { case .changePassword, .queryMyInfo: return .accessToken } } - + public var errorMap: [Int : UserDomainError] { switch self { case .changePassword: diff --git a/Service/Sources/Domain/UserDomain/DTO/Request/ChangePasswordRequestDTO.swift b/Service/Sources/Domain/UserDomain/DTO/Request/ChangePasswordRequestDTO.swift index e0916fb1..0398fd82 100644 --- a/Service/Sources/Domain/UserDomain/DTO/Request/ChangePasswordRequestDTO.swift +++ b/Service/Sources/Domain/UserDomain/DTO/Request/ChangePasswordRequestDTO.swift @@ -3,7 +3,7 @@ import Foundation public struct ChangePasswordRequestDTO: Encodable { public let currentPassword: String public let newPassword: String - + public init( currentPassword: String, newPassword: String diff --git a/Service/Sources/Domain/UserDomain/DTO/Response/InquiryMyInfoResponseDTO.swift b/Service/Sources/Domain/UserDomain/DTO/Response/InquiryMyInfoResponseDTO.swift index 99b4ca04..fa81d54b 100644 --- a/Service/Sources/Domain/UserDomain/DTO/Response/InquiryMyInfoResponseDTO.swift +++ b/Service/Sources/Domain/UserDomain/DTO/Response/InquiryMyInfoResponseDTO.swift @@ -6,7 +6,7 @@ public struct QueryMyInfoResponseDTO: Decodable { public let phoneNumber: String public let authority: UserAuthorityType public let organization: String - + public init( name: String, email: String, diff --git a/Service/Sources/Domain/UserDomain/Entity/MyInfoEntity.swift b/Service/Sources/Domain/UserDomain/Entity/MyInfoEntity.swift index d8c28f6b..bd2f4f28 100644 --- a/Service/Sources/Domain/UserDomain/Entity/MyInfoEntity.swift +++ b/Service/Sources/Domain/UserDomain/Entity/MyInfoEntity.swift @@ -6,7 +6,7 @@ public struct MyInfoEntity: Equatable { public let phoneNumber: String public let authority: UserAuthorityType public let organization: String - + public init( name: String, email: String, diff --git a/Service/Sources/Domain/UserDomain/Error/UserDomainError.swift b/Service/Sources/Domain/UserDomain/Error/UserDomainError.swift index f70bbc55..755ef9ed 100644 --- a/Service/Sources/Domain/UserDomain/Error/UserDomainError.swift +++ b/Service/Sources/Domain/UserDomain/Error/UserDomainError.swift @@ -7,4 +7,3 @@ public enum UserDomainError: Error { case conflict case tooManyRequest } -