Skip to content

Commit

Permalink
[Feat] #275 - HomeUseCase 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongdung-eo committed Jul 9, 2024
1 parent 0a80187 commit 1aa81b7
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions GEON-PPANG-iOS/Domain/UseCase/HomeUseCase.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// HomeUseCase.swift
// GEON-PPANG-iOS
//
// Created by JEONGEUN KIM on 6/29/24.
//

import Foundation
import Combine

protocol HomeUseCase {
func fetchBestBakeries() async throws -> [BestBakery]
func fetchBestReviews() async throws -> [BestReview]
}

final class HomeUseCaseImpl: HomeUseCase {
let bestRepository: BestRepository

init(bestRepository: BestRepository) {
self.bestRepository = bestRepository
}

func fetchBestBakeries() async throws -> [BestBakery] {
do {
return try await bestRepository.getBestBakeries()
}
catch MemberError.expiredToken {
throw MemberError.expiredToken
}
catch MemberError.invalidToken {
throw MemberError.invalidToken
}
}

func fetchBestReviews() async throws -> [BestReview] {
do {
return try await bestRepository.getBestReviews()
}
catch MemberError.expiredToken {
throw MemberError.expiredToken
}
catch MemberError.invalidToken {
throw MemberError.invalidToken
}
}
}

0 comments on commit 1aa81b7

Please sign in to comment.