-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] #46 - 로그인 뷰 Domain, Data 연결
- Loading branch information
Showing
17 changed files
with
172 additions
and
44 deletions.
There are no files selected for viewing
18 changes: 14 additions & 4 deletions
18
SOPT-Stamp-iOS/Projects/Data/Sources/Repository/SignInRepository.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
// | ||
// SignInRepository.swift | ||
// Presentation | ||
// Data | ||
// | ||
// Created by devxsby on 2022/12/01. | ||
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import Combine | ||
|
||
import Core | ||
|
||
import Domain | ||
import Network | ||
|
||
public class SignInRepository { | ||
|
||
private let networkService: AuthService | ||
private let cancelBag = Set<AnyCancellable>() | ||
private let networkService: UserService | ||
private let cancelBag = CancelBag() | ||
|
||
public init(service: AuthService) { | ||
public init(service: UserService) { | ||
self.networkService = service | ||
} | ||
} | ||
|
||
extension SignInRepository: SignInRepositoryInterface { | ||
|
||
public func requestSignIn(request: SignInRequest) -> AnyPublisher<SignInModel, Error> { | ||
networkService.requestSignIn(email: request.email, password: request.password).map { entity in | ||
UserDefaults.standard.set(entity.userId, forKey: "userId") | ||
return entity.toDomain() | ||
}.eraseToAnyPublisher() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
SOPT-Stamp-iOS/Projects/Domain/Sources/Model/SignInModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
// | ||
// SignInModel.swift | ||
// Presentation | ||
// Domain | ||
// | ||
// Created by devxsby on 2022/12/01. | ||
// Created by devxsby on 2022/12/23. | ||
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct SignInModel { | ||
|
||
public init() { | ||
|
||
let userId: Int? | ||
let message: String? | ||
|
||
public init(userId: Int?, message: String?) { | ||
self.userId = userId | ||
self.message = message | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
SOPT-Stamp-iOS/Projects/Domain/Sources/Model/SignInRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// SignInRequest.swift | ||
// Domain | ||
// | ||
// Created by devxsby on 2022/12/01. | ||
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved. | ||
// | ||
|
||
import Combine | ||
|
||
import Core | ||
|
||
public struct SignInRequest { | ||
public let email: String | ||
public let password: String | ||
|
||
public init(email: String, password: String) { | ||
self.email = email | ||
self.password = password | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.