Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

피드 상세화면에 필요한 Domain영역과 Data 영역을 정의해 보았습니다. #13

Merged
merged 14 commits into from
Jul 11, 2024
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// RecipeDetailRepository.swift
// HomeCafeRecipes
//
// Created by 김건호 on 6/26/24.
//

import Foundation
import RxSwift

protocol RecipeDetailRepository {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RecipeDetailFetchService 랑 분리한 이유가 있나요..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RecipeDetailFetchService는 네트워크 통신만을 담당하고 RecipeDetailRepository는 데이터 접근 로직을 추상화 할수 있습니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사실상 서비스에서는 url을 만드는 것 외에 복잡한 통신로직은 없는 것 같은데 이에 비해 레이어가 많은 것 같아요.
어떻게 생각하시나요~?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cda676a] service를 삭제후 repository에 service가 하는역할을 추가했습니다

func fetchRecipeDetail(recipeID: Int) -> Single<Recipe>
}

class FeedListRepositoryImpl: RecipeDetailRepository {
private let networkService: RecipeDetailFetchService

init(networkService: RecipeDetailFetchService) {
self.networkService = networkService
}

func fetchRecipeDetail(recipeID: Int) -> Single<Recipe> {
return networkService.fetchRecipeDetail(recipeId: recipeID)
}
}