Skip to content

Commit

Permalink
feat #167: UserAPI 생성 및 register 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
minsangKang committed Oct 20, 2024
1 parent d32d297 commit c740a2c
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Project_Timer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
8765234F28C7964500487BFB /* TotalVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8765234E28C7964500487BFB /* TotalVM.swift */; };
8765235128C79C4400487BFB /* TotalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8765235028C79C4400487BFB /* TotalView.swift */; };
8769349727E1BBAF00D33F51 /* TodoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8769349627E1BBAF00D33F51 /* TodoCell.swift */; };
8769AC032CC38BE1002709FF /* SignupRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8769AC022CC38BE1002709FF /* SignupRequest.swift */; };
8769AC052CC38C3D002709FF /* UserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8769AC042CC38C3D002709FF /* UserAPI.swift */; };
876C3B0B2B1045C5002A5132 /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = 876C3B0A2B1045C5002A5132 /* GoogleSignIn */; };
876C3B0D2B1045C5002A5132 /* GoogleSignInSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 876C3B0C2B1045C5002A5132 /* GoogleSignInSwift */; };
876E27762AC1CD2A0054250D /* Infos.swift in Sources */ = {isa = PBXBuildFile; fileRef = 876E27752AC1CD2A0054250D /* Infos.swift */; };
Expand Down Expand Up @@ -641,6 +643,8 @@
8765234E28C7964500487BFB /* TotalVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TotalVM.swift; sourceTree = "<group>"; };
8765235028C79C4400487BFB /* TotalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TotalView.swift; sourceTree = "<group>"; };
8769349627E1BBAF00D33F51 /* TodoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodoCell.swift; sourceTree = "<group>"; };
8769AC022CC38BE1002709FF /* SignupRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignupRequest.swift; sourceTree = "<group>"; };
8769AC042CC38C3D002709FF /* UserAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAPI.swift; sourceTree = "<group>"; };
876E27712AC1C9D30054250D /* development.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = development.xcconfig; sourceTree = "<group>"; };
876E27752AC1CD2A0054250D /* Infos.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Infos.swift; sourceTree = "<group>"; };
877036C929CD7B3B0078A30C /* TaskManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1227,6 +1231,7 @@
8761BDC92BCFEA7A00E9281A /* AuthAPI.swift */,
8761BDCB2BCFEC8500E9281A /* DailysAPI.swift */,
8736B7442CA94DB8006BD389 /* AuthV2API.swift */,
8769AC042CC38C3D002709FF /* UserAPI.swift */,
);
path = API;
sourceTree = "<group>";
Expand Down Expand Up @@ -1724,6 +1729,7 @@
871616902C39956E00C4EF25 /* CheckUsernameRequest.swift */,
8736B7482CA94EBE006BD389 /* PostAuthCodeRequest.swift */,
874DCBE62CABEFB500CF9435 /* VerifyAuthCodeRequest.swift */,
8769AC022CC38BE1002709FF /* SignupRequest.swift */,
);
path = Request;
sourceTree = "<group>";
Expand Down Expand Up @@ -2369,6 +2375,7 @@
879BE3202AC402A8007AAC46 /* SignupSigninVC.swift in Sources */,
048D8AD328AAC5CF00A2456D /* TaskCreateInteractionView.swift in Sources */,
870800832B2D551700830B39 /* RecordTimesResponse.swift in Sources */,
8769AC032CC38BE1002709FF /* SignupRequest.swift in Sources */,
8757AA3B290511AB00D97517 /* TaskSelectVM.swift in Sources */,
87FD9FA72998D0BD00D9B0FF /* TimerStopwatchAttributes.swift in Sources */,
04573A9B2877FDDA008F8D44 /* CountdownTimeLabelVM.swift in Sources */,
Expand Down Expand Up @@ -2539,6 +2546,7 @@
871AB69D2967C9D100AFED1C /* TimeTableVM.swift in Sources */,
872210422C2FEE83003B97AD /* SyncLogRepository.swift in Sources */,
87D4DCD22BA5A4C400BB5AAB /* ResetPasswordEmailView.swift in Sources */,
8769AC052CC38C3D002709FF /* UserAPI.swift in Sources */,
878813E52A209BA0000ED2C1 /* HowToAddWidgetVC.swift in Sources */,
8722105D2C300A8C003B97AD /* GetSurveysUseCase.swift in Sources */,
8765234C28C7948700487BFB /* TotalTime.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
/// 정규식 Checker
struct PredicateChecker {
/// email 정규식
static var emailCheck: String { "^[a-zA-Z0-9._%+-]{1,64}@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$(?=.{0,255}$)" }
static var emailCheck: String { "^[a-zA-Z0-9._%+-]{1,64}@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$(?=.{0,255}$)" }
/// 패스워드 정규식, 8자 ~ 64자 이내 UNICODE (10/19 기준)
static var passwordCheckInServer: String { "^[\\S]{8,64}$" }
/// 닉네임 정규식, 1자 ~ 12자 이내 UNICODE (10/19 기준)
Expand Down
49 changes: 49 additions & 0 deletions Project_Timer/Data/API/UserAPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// UserAPI.swift
// Project_Timer
//
// Created by Kang Minsang on 2024/10/19.
// Copyright © 2024 FDEE. All rights reserved.
//

import Foundation
import Moya

enum UserAPI {
/// 티티 서비스에 일반 회원 가입을 해요.
case register(request: SignupRequest)
}

extension UserAPI: TargetType {
var baseURL: URL {
return URL(string: NetworkURL.serverURL_V2 + "/api/user")!
}

var path: String {
switch self {
case .register:
return "/members/register"
}
}

var method: Moya.Method {
switch self {
case .register:
return .post
}
}

var task: Moya.Task {
switch self {
case .register(let request):
return .requestJSONEncodable(request)
}
}

var headers: [String : String]? {
switch self {
case .register:
return nil
}
}
}
16 changes: 16 additions & 0 deletions Project_Timer/Data/Request/SignupRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// SignupRequest.swift
// Project_Timer
//
// Created by Kang Minsang on 2024/10/19.
// Copyright © 2024 FDEE. All rights reserved.
//

import Foundation

struct SignupRequest: Encodable {
let username: String
let wrappedEncryptedPassword: String
let nickname: String
let authToken: String
}

0 comments on commit c740a2c

Please sign in to comment.