-
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.
- Loading branch information
Showing
12 changed files
with
348 additions
and
116 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// MarshmallowRepository.swift | ||
// POME | ||
// | ||
// Created by gomin on 2023/05/26. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
class MarshmallowRepository: MarshmallowRepositoryInterface{ | ||
|
||
func getMarshmallows() -> Observable<MarshmallowResponseModel> { | ||
let observable = Observable<MarshmallowResponseModel>.create { observer -> Disposable in | ||
let requestReference: () = UserService.shared.getMarshmallow { response in | ||
switch response { | ||
case .success(let data): | ||
observer.onNext(data) | ||
default: | ||
break | ||
} | ||
} | ||
return Disposables.create(with: { requestReference }) | ||
} | ||
return observable | ||
} | ||
} |
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
POME/Domain/RepositoryInterface/MarshmallowRepositoryInterface.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 @@ | ||
// | ||
// MarshmallowRepositoryInterface.swift | ||
// POME | ||
// | ||
// Created by gomin on 2023/05/26. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
protocol MarshmallowRepositoryInterface{ | ||
func getMarshmallows() -> Observable<MarshmallowResponseModel> | ||
} |
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 @@ | ||
// | ||
// GetFinishedGoalsUseCase.swift | ||
// POME | ||
// | ||
// Created by gomin on 2023/05/26. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
protocol GetFinishedGoalsUseCaseInterface { | ||
func execute() -> Observable<[GoalResponseModel]> | ||
} | ||
|
||
final class GetFinishedGoalsUseCase: GetFinishedGoalsUseCaseInterface { | ||
|
||
private let goalRepository: GoalRepositoryInterface | ||
|
||
init(goalRepository: GoalRepositoryInterface = GoalRepository()) { | ||
self.goalRepository = goalRepository | ||
} | ||
|
||
func execute() -> Observable<[GoalResponseModel]>{ | ||
// let finishedGoalsCount = goalRepository.getFinishedGoals() | ||
// .map { [self] in | ||
// $0.count | ||
// } | ||
return goalRepository.getFinishedGoals() | ||
} | ||
} | ||
|
||
|
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 @@ | ||
// | ||
// GetMarshmallowsUseCase.swift | ||
// POME | ||
// | ||
// Created by gomin on 2023/05/26. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
protocol GetMarshmallowsUseCaseInterface { | ||
func execute() -> Observable<MarshmallowResponseModel> | ||
} | ||
|
||
final class GetMarshmallowsUseCase: GetMarshmallowsUseCaseInterface { | ||
|
||
private let marshmallowRepository: MarshmallowRepositoryInterface | ||
|
||
init(marshmallowRepository: MarshmallowRepositoryInterface = MarshmallowRepository()) { | ||
self.marshmallowRepository = marshmallowRepository | ||
} | ||
|
||
func execute() -> Observable<MarshmallowResponseModel>{ | ||
return marshmallowRepository.getMarshmallows() | ||
} | ||
} | ||
|
||
|
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.