-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHomeRepository.swift
More file actions
52 lines (44 loc) · 1.4 KB
/
HomeRepository.swift
File metadata and controls
52 lines (44 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// HomeRepository.swift
// Data
//
// Created by 최안용 on 2/4/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//
import Foundation
import Domain
import Networks
public final class HomeRepository: HomeRepositoryInterface {
private let homeService: HomeServiceProtocol
public init(homeService: HomeServiceProtocol) {
self.homeService = homeService
}
public func fetchMyTripInfo() async throws -> MyTripSummary {
do {
return try await homeService.getUpcoming().toDomain()
} catch {
throw error.toNDGLError()
}
}
public func fetchCategoryList() async throws -> [TripCategory] {
do {
return try await homeService.getCategoryList().map { $0.toDomain() }
} catch {
throw error.toNDGLError()
}
}
public func fetchPopularTripList(id: Int?, page: Int?, size: Int?) async throws -> [TripInfo] {
do {
return try await homeService.getPopularTripList(id: id, page: page, size: size).toDomain()
} catch {
throw error.toNDGLError()
}
}
public func fetchRecommendTripList(page: Int?, size: Int?) async throws -> [TripInfo] {
do {
return try await homeService.getRecommendTripList(page: page, size: size).toDomain()
} catch {
throw error.toNDGLError()
}
}
}