generated from GSM-MSG/MSG-Repository-Generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from Team-Ampersand/101-massage-feature-impl
🔀 :: 안마의자 Feature 구현
- Loading branch information
Showing
45 changed files
with
745 additions
and
80 deletions.
There are no files selected for viewing
File renamed without changes.
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
18 changes: 18 additions & 0 deletions
18
Projects/Domain/MassageDomain/Interface/Entity/MassageRankEntity.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,18 @@ | ||
import BaseDomainInterface | ||
import Foundation | ||
|
||
public struct MassageRankEntity: Equatable { | ||
public let id: Int | ||
public let rank: Int | ||
public let stuNum: String | ||
public let memberName: String | ||
public let gender: GenderType | ||
|
||
public init(id: Int, rank: Int, stuNum: String, memberName: String, gender: GenderType) { | ||
self.id = id | ||
self.rank = rank | ||
self.stuNum = stuNum | ||
self.memberName = memberName | ||
self.gender = gender | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
Projects/Domain/MassageDomain/Interface/Model/MassageRankModel.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 @@ | ||
public typealias MassageRankModel = MassageRankEntity |
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
3 changes: 3 additions & 0 deletions
3
Projects/Domain/MassageDomain/Interface/UseCase/FetchMassageRankListUseCase.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,3 @@ | ||
public protocol FetchMassageRankListUseCase { | ||
func callAsFunction() async throws -> [MassageRankModel] | ||
} |
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
28 changes: 28 additions & 0 deletions
28
Projects/Domain/MassageDomain/Sources/DTO/Response/FetchMassageRankListResponseDTO.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,28 @@ | ||
import BaseDomainInterface | ||
import MassageDomainInterface | ||
import Foundation | ||
|
||
struct FetchMassageRankListResponseDTO: Decodable { | ||
let list: [MassageRankResponseDTO] | ||
|
||
struct MassageRankResponseDTO: Decodable { | ||
let id: Int | ||
let rank: Int | ||
let stuNum: String | ||
let memberName: String | ||
let gender: GenderType | ||
} | ||
} | ||
|
||
extension FetchMassageRankListResponseDTO { | ||
func toDomain() -> [MassageRankEntity] { | ||
self.list | ||
.map { $0.toDomain() } | ||
} | ||
} | ||
|
||
extension FetchMassageRankListResponseDTO.MassageRankResponseDTO { | ||
func toDomain() -> MassageRankEntity { | ||
MassageRankEntity(id: id, rank: rank, stuNum: stuNum, memberName: memberName, gender: gender) | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
Projects/Domain/MassageDomain/Sources/UseCase/FetchMassageRankListUseCaseImpl.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,13 @@ | ||
import MassageDomainInterface | ||
|
||
struct FetchMassageRankListUseCaseImpl: FetchMassageRankListUseCase { | ||
private let massageRepository: any MassageRepository | ||
|
||
init(massageRepository: any MassageRepository) { | ||
self.massageRepository = massageRepository | ||
} | ||
|
||
func callAsFunction() async throws -> [MassageRankModel] { | ||
try await massageRepository.fetchMassageRankList() | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
Projects/Domain/MassageDomain/Testing/UseCase/FetchMassageRankListUseCaseSpy.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,10 @@ | ||
import MassageDomainInterface | ||
|
||
final class FetchMassageRankListUseCaseSpy: FetchMassageRankListUseCase { | ||
var fetchMassageRankListCallCount = 0 | ||
var fetchMassageRankListHandler: () async throws -> [MassageRankEntity] = { [] } | ||
func callAsFunction() async throws -> [MassageRankModel] { | ||
fetchMassageRankListCallCount += 1 | ||
return try await fetchMassageRankListHandler() | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Projects/Domain/MassageDomain/Tests/FetchMassageRankListUseCaseTests.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,32 @@ | ||
import MassageDomainInterface | ||
import XCTest | ||
@testable import MassageDomain | ||
@testable import MassageDomainTesting | ||
|
||
final class FetchMassageRankListUseCaseTests: XCTestCase { | ||
var massageRepository: MassageRepositorySpy! | ||
var sut: FetchMassageRankListUseCaseImpl! | ||
|
||
override func setUp() { | ||
massageRepository = .init() | ||
sut = .init(massageRepository: massageRepository) | ||
} | ||
|
||
override func tearDown() { | ||
massageRepository = nil | ||
sut = nil | ||
} | ||
|
||
func testFetchMassageInfo() async throws { | ||
XCTAssertEqual(massageRepository.fetchMassageRankListCallCount, 0) | ||
let expected = [ | ||
MassageRankModel(id: 1, rank: 2, stuNum: "1111", memberName: "김시훈", gender: .man) | ||
] | ||
massageRepository.fetchMassageRankListHandler = { expected } | ||
|
||
let actual = try await sut() | ||
|
||
XCTAssertEqual(massageRepository.fetchMassageRankListCallCount, 1) | ||
XCTAssertEqual(actual, expected) | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
...cts/Domain/SelfStudyDomain/Interface/DTO/Request/FetchSelfStudyRankSearchRequestDTO.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,3 +1,4 @@ | ||
import BaseDomainInterface | ||
import Foundation | ||
|
||
public struct FetchSelfStudyRankSearchRequestDTO { | ||
|
1 change: 1 addition & 0 deletions
1
Projects/Domain/SelfStudyDomain/Interface/Entity/SelfStudyRankEntity.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,3 +1,4 @@ | ||
import BaseDomainInterface | ||
import Foundation | ||
|
||
public struct SelfStudyRankEntity: Equatable { | ||
|
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
1 change: 1 addition & 0 deletions
1
Projects/Domain/SelfStudyDomain/Sources/DTO/Response/FecthSelfStudyRankListResponseDTO.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,3 +1,4 @@ | ||
import BaseDomainInterface | ||
import Foundation | ||
import SelfStudyDomainInterface | ||
|
||
|
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
25 changes: 25 additions & 0 deletions
25
Projects/Feature/MassageFeature/Demo/Resources/LaunchScreen.storyboard
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,25 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> | ||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--View Controller--> | ||
<scene sceneID="EHf-IW-A2E"> | ||
<objects> | ||
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> | ||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="53" y="375"/> | ||
</scene> | ||
</scenes> | ||
</document> |
35 changes: 35 additions & 0 deletions
35
Projects/Feature/MassageFeature/Demo/Sources/AppDelegate.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,35 @@ | ||
import UIKit | ||
import Inject | ||
@testable import MassageFeature | ||
@testable import MassageDomainTesting | ||
@testable import UserDomainTesting | ||
|
||
@main | ||
final class AppDelegate: UIResponder, UIApplicationDelegate { | ||
var window: UIWindow? | ||
|
||
func application( | ||
_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil | ||
) -> Bool { | ||
window = UIWindow(frame: UIScreen.main.bounds) | ||
let fetchMassageRankListUseCase = FetchMassageRankListUseCaseSpy() | ||
fetchMassageRankListUseCase.fetchMassageRankListHandler = { | ||
[ | ||
.init(id: 1, rank: 1, stuNum: "1234", memberName: "대충이름", gender: .man), | ||
.init(id: 2, rank: 2, stuNum: "1235", memberName: "대이충름", gender: .man), | ||
.init(id: 3, rank: 3, stuNum: "1236", memberName: "이름대충", gender: .woman) | ||
] | ||
} | ||
let store = MassageStore( | ||
fetchMassageRankListUseCase: fetchMassageRankListUseCase | ||
) | ||
let viewController = Inject.ViewControllerHost( | ||
UINavigationController(rootViewController: MassageViewController(store: store)) | ||
) | ||
window?.rootViewController = viewController | ||
window?.makeKeyAndVisible() | ||
|
||
return true | ||
} | ||
} |
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
8 changes: 6 additions & 2 deletions
8
Projects/Feature/MassageFeature/Sources/Assembly/MassageAssembly.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,10 +1,14 @@ | ||
import MassageDomainInterface | ||
import Swinject | ||
import UserDomainInterface | ||
|
||
public final class MassageAssembly: Assembly { | ||
public init() {} | ||
public func assemble(container: Container) { | ||
container.register(MassageFactory.self) { _ in | ||
MassageFactoryImpl() | ||
container.register(MassageFactory.self) { resolver in | ||
MassageFactoryImpl( | ||
fetchMassageRankListUseCase: resolver.resolve(FetchMassageRankListUseCase.self)! | ||
) | ||
} | ||
} | ||
} |
16 changes: 15 additions & 1 deletion
16
Projects/Feature/MassageFeature/Sources/Factory/MassageFactoryImpl.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,7 +1,21 @@ | ||
import MassageDomainInterface | ||
import Moordinator | ||
import UserDomainInterface | ||
|
||
struct MassageFactoryImpl: MassageFactory { | ||
private let fetchMassageRankListUseCase: any FetchMassageRankListUseCase | ||
|
||
init( | ||
fetchMassageRankListUseCase: any FetchMassageRankListUseCase | ||
) { | ||
self.fetchMassageRankListUseCase = fetchMassageRankListUseCase | ||
} | ||
|
||
func makeMoordinator() -> Moordinator { | ||
MassageMoordinator() | ||
let store = MassageStore( | ||
fetchMassageRankListUseCase: fetchMassageRankListUseCase | ||
) | ||
let viewController = MassageViewController(store: store) | ||
return MassageMoordinator(massageViewController: viewController) | ||
} | ||
} |
Oops, something went wrong.