Skip to content

Commit

Permalink
[WEAV-116] 회원가입 API 연결 (#36)
Browse files Browse the repository at this point in the history
* [WEAV-116] Signup Domain 모델 생성

* [WEAV-116] Model 모듈 구조 변경, API 연결

* [WEAV-116] OAS subrepo 최신화:

* [WEAV-116] Auth Info Debug 뷰 추가

* [WEAV-116] DebugView push event 추가
  • Loading branch information
jisu15-kim authored Oct 27, 2024
1 parent 4d5bf26 commit 9e8ab1e
Show file tree
Hide file tree
Showing 51 changed files with 746 additions and 246 deletions.
26 changes: 17 additions & 9 deletions OpenApiGenerator/Sources/OpenapiGenerated/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public enum Components {
/// 사용자의 회사 ID
///
/// - Remark: Generated from `#/components/schemas/UserProfile/companyId`.
public var companyId: Swift.String
public var companyId: Swift.String?
/// - Remark: Generated from `#/components/schemas/UserProfile/jobOccupation`.
public var jobOccupation: Components.Schemas.JobOccupation
/// 사용자의 활동 지역 목록 ID 리스트
Expand All @@ -540,7 +540,7 @@ public enum Components {
public init(
gender: Components.Schemas.Gender,
birthYear: Swift.Int,
companyId: Swift.String,
companyId: Swift.String? = nil,
jobOccupation: Components.Schemas.JobOccupation,
locationIds: [Swift.String]
) {
Expand All @@ -563,50 +563,58 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/UserDesiredPartner`.
public struct UserDesiredPartner: Codable, Hashable, Sendable {
/// - Remark: Generated from `#/components/schemas/UserDesiredPartner/birthYearRange`.
public var birthYearRange: Components.Schemas.BirthYearRange?
public var birthYearRange: Components.Schemas.BirthYearRange
/// - Remark: Generated from `#/components/schemas/UserDesiredPartner/jobOccupations`.
public var jobOccupations: Components.Schemas.JobOccupations
/// - Remark: Generated from `#/components/schemas/UserDesiredPartner/preferDistance`.
public var preferDistance: Components.Schemas.PreferDistance
/// 같은 회사에 근무하는 파트너를 허용하는지 여부 (companyID가 없을 경우 null)
///
/// - Remark: Generated from `#/components/schemas/UserDesiredPartner/allowSameCompany`.
public var allowSameCompany: Swift.Bool?
/// Creates a new `UserDesiredPartner`.
///
/// - Parameters:
/// - birthYearRange:
/// - jobOccupations:
/// - preferDistance:
/// - allowSameCompany: 같은 회사에 근무하는 파트너를 허용하는지 여부 (companyID가 없을 경우 null)
public init(
birthYearRange: Components.Schemas.BirthYearRange? = nil,
birthYearRange: Components.Schemas.BirthYearRange,
jobOccupations: Components.Schemas.JobOccupations,
preferDistance: Components.Schemas.PreferDistance
preferDistance: Components.Schemas.PreferDistance,
allowSameCompany: Swift.Bool? = nil
) {
self.birthYearRange = birthYearRange
self.jobOccupations = jobOccupations
self.preferDistance = preferDistance
self.allowSameCompany = allowSameCompany
}
public enum CodingKeys: String, CodingKey {
case birthYearRange
case jobOccupations
case preferDistance
case allowSameCompany
}
}
/// - Remark: Generated from `#/components/schemas/BirthYearRange`.
public struct BirthYearRange: Codable, Hashable, Sendable {
/// 원하는 파트너의 최소 년생
///
/// - Remark: Generated from `#/components/schemas/BirthYearRange/start`.
public var start: Swift.Int
public var start: Swift.Int?
/// 원하는 파트너의 최대 년생
///
/// - Remark: Generated from `#/components/schemas/BirthYearRange/end`.
public var end: Swift.Int
public var end: Swift.Int?
/// Creates a new `BirthYearRange`.
///
/// - Parameters:
/// - start: 원하는 파트너의 최소 년생
/// - end: 원하는 파트너의 최대 년생
public init(
start: Swift.Int,
end: Swift.Int
start: Swift.Int? = nil,
end: Swift.Int? = nil
) {
self.start = start
self.end = end
Expand Down
2 changes: 1 addition & 1 deletion OpenApiGenerator/Sources/openapi-generator-cli/3days-oas
Submodule 3days-oas updated 1 files
+4 −4 openapi.yaml
150 changes: 150 additions & 0 deletions Projects/App/Sources/Debug/AuthInfoView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
//
// AuthInfoView.swift
// three-days-dev
//
// Created by 김지수 on 10/27/24.
// Copyright © 2024 com.weave. All rights reserved.
//

import SwiftUI
import DesignCore
import CoreKit

#if DEBUG || STAGING
struct TableInfoModel: Identifiable {
let id = UUID()
let title: String
let value: String
}

enum Sections: CaseIterable {
case authInfo
case userInfo
case userProfile
case dreamPartnerInfo

var sectionTitle: String {
switch self {
case .authInfo: "토큰 정보"
case .userInfo: "유저 정보(TEMP)"
case .userProfile: "프로필 정보(TEMP)"
case .dreamPartnerInfo: "이상형 정보(TEMP)"
}
}

var dataSources: [TableInfoModel] {
switch self {
case .authInfo:
[
TableInfoModel(
title: "accessToken",
value: TokenManager.accessToken ?? "null"
),
TableInfoModel(
title: "refreshToken",
value: TokenManager.refreshToken ?? "null"
),
TableInfoModel(
title: "registerToken",
value: TokenManager.registerToken ?? "null"
)
]
case .userInfo:
[
TableInfoModel(
title: "ID",
value: UUID().uuidString
),
TableInfoModel(
title: "이름",
value: "홍길동"
),
TableInfoModel(
title: "휴대폰 번호",
value: "010-1234-1234"
)
]
case .userProfile:
[
TableInfoModel(
title: "출생년도",
value: "1996"
),
TableInfoModel(
title: "회사 ID",
value: UUID().uuidString
),
TableInfoModel(
title: "성별",
value: "MALE"
),
TableInfoModel(
title: "직군정보",
value: UUID().uuidString
),
TableInfoModel(
title: "활동지역 ID",
value: [UUID(), UUID(), UUID()]
.map { $0.uuidString }
.joined(separator: "\n")
)
]
case .dreamPartnerInfo:
[]
}
}
}

struct AuthDebugInfoView: View {
@State private var showingAlert = false
@State private var copiedText = ""

var body: some View {
List {
ForEach(Sections.allCases, id: \.self) { section in
Section(header: Text(section.sectionTitle)) {
ForEach(section.dataSources) { info in
Button(action: {
copyToClipboard(info.value)
copiedText = info.title
showingAlert = true
}) {
VStack(alignment: .leading) {
Text(info.title)
.pretendard(
weight: ._600,
size: 16
)
.foregroundStyle(.black)
Text(info.value)
.pretendard(
weight: ._400,
size: 14
)
.foregroundColor(.gray)
}
}
}
}
}
}
.alert(isPresented: $showingAlert) {
Alert(
title: Text("복사 완료"),
message: Text("[\(copiedText)] 정보가 클립보드에 복사되었습니다."),
dismissButton: .default(Text("확인"))
)
}
}

// 클립보드에 복사하는 함수
func copyToClipboard(_ text: String) {
UIPasteboard.general.string = text
}
}

#Preview {
AuthDebugInfoView()
}

#endif
51 changes: 28 additions & 23 deletions Projects/App/Sources/Navigation/NavigationStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ extension PathType {
switch self {
case .designPreview:
DesignPreviewView()
case .authDebug:
#if DEBUG || STAGING
AuthDebugInfoView()
#else
EmptyView()
#endif
case .main:
SplashAnimatedView()
case .signUp(let subView):
Expand All @@ -25,31 +31,30 @@ extension PathType {
AuthPhoneInputView()
case .authPhoneVerify(let smsResponse):
AuthPhoneVerifyView(smsResponse)
case .authAgreement:
AuthAgreementView()
case .authAgreement(let input):
AuthAgreementView(input)

case .authGreeting:
AuthGreetingView()
case .authProfileGender:
AuthProfileGenderInputView()
case .authProfileAge:
AuthProfileAgeInputView()
case .authCompany:
AuthCompanyView()
case .authJobOccupation:
AuthJobView()
case .authRegion:
AuthRegionView()
case .authName:
AuthNameInputView()
case .authGreeting(let input):
AuthGreetingView(input)
case .authProfileGender(let input):
AuthProfileGenderInputView(input)
case .authProfileAge(let input):
AuthProfileAgeInputView(input)
case .authCompany(let input):
AuthCompanyView(input)
case .authJobOccupation(let input):
AuthJobView(input)
case .authRegion(let input):
AuthRegionView(input)
case .authName(let input):
AuthNameInputView(input)

case .dreamPartnerAgeRange:
DreamPartnerAgeView()
case .dreamPartnerJobOccupation:
DreamPartnerJobView()
case .dreamPartnerDistance:
// 임시
EmptyView()
case .dreamPartnerAgeRange(let input):
DreamPartnerAgeView(input)
case .dreamPartnerJobOccupation(let input):
DreamPartnerJobView(input)
case .dreamPartnerDistance(let input):
DreamPartnerDistanceView(input)
}
}
}
Expand Down
43 changes: 23 additions & 20 deletions Projects/Core/CommonKit/Sources/Path/PathTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import Model

public enum PathType: Hashable {
case designPreview
case authDebug
case main
case signUp(SignUpSubViewType)

#if STAGING || DEBUG
public static var debugPreviewTypes: [PathType] = [
.designPreview,
.authDebug,
.main,
.signUp(.authPhoneInput),
.signUp(
Expand All @@ -28,23 +30,24 @@ public enum PathType: Hashable {
)
)
),
.signUp(.authAgreement),
.signUp(.authGreeting),
.signUp(.authProfileGender),
.signUp(.authProfileAge),
.signUp(.authCompany),
.signUp(.authJobOccupation),
.signUp(.authName),
.signUp(.authRegion),
.signUp(.authAgreement(input: .mock)),
.signUp(.authGreeting(input: .mock)),
.signUp(.authProfileGender(input: .mock)),
.signUp(.authProfileAge(input: .mock)),
.signUp(.authCompany(input: .mock)),
.signUp(.authJobOccupation(input: .mock)),
.signUp(.authName(input: .mock)),
.signUp(.authRegion(input: .mock)),
.signUp(.authPhoneInput),

.signUp(.dreamPartnerAgeRange)
.signUp(.dreamPartnerAgeRange(input: .mock))
]
#endif

public var name: String {
switch self {
case .designPreview: return "Design Preview"
case .authDebug: return "Auth Debug"
case .main: return "메인"
case .signUp(let subType):
switch subType {
Expand All @@ -71,19 +74,19 @@ public enum PathType: Hashable {
public enum SignUpSubViewType: Hashable {
case authPhoneInput
case authPhoneVerify(SMSSendResponse)
case authAgreement
case authAgreement(input: SignUpFormDomain)

case authGreeting
case authProfileGender
case authProfileAge
case authCompany
case authJobOccupation
case authRegion
case authName
case authGreeting(input: SignUpFormDomain)
case authProfileGender(input: SignUpFormDomain)
case authProfileAge(input: SignUpFormDomain)
case authCompany(input: SignUpFormDomain)
case authJobOccupation(input: SignUpFormDomain)
case authRegion(input: SignUpFormDomain)
case authName(input: SignUpFormDomain)

case dreamPartnerAgeRange
case dreamPartnerJobOccupation
case dreamPartnerDistance
case dreamPartnerAgeRange(input: SignUpFormDomain)
case dreamPartnerJobOccupation(input: SignUpFormDomain)
case dreamPartnerDistance(input: SignUpFormDomain)

public static func == (lhs: SignUpSubViewType, rhs: SignUpSubViewType) -> Bool {
return lhs.hashValue == rhs.hashValue
Expand Down
Loading

0 comments on commit 9e8ab1e

Please sign in to comment.