Skip to content

Commit 95d2fd6

Browse files
authored
Merge pull request #15 from YAPP-Github/design/#10-Travel_Follow_Contents
Design/#10 travel follow contents
2 parents dce8b46 + c0d66d1 commit 95d2fd6

61 files changed

Lines changed: 4795 additions & 146 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Plugins/DependencyPlugin/ProjectDescriptionHelpers/Dependency+Project.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public extension TargetDependency {
1111
struct Features {
1212
public struct Home {}
1313
public struct TabBar {}
14+
public struct Follow {}
15+
public struct Travel {}
1416
}
1517

1618
struct Modules {}
@@ -49,3 +51,15 @@ public extension TargetDependency.Features.TabBar {
4951

5052
static let feature = TargetDependency.Features.project(name: "Feature", group: group)
5153
}
54+
55+
public extension TargetDependency.Features.Follow {
56+
static let group = "Follow"
57+
58+
static let feature = TargetDependency.Features.project(name: "Feature", group: group)
59+
}
60+
61+
public extension TargetDependency.Features.Travel {
62+
static let group = "Travel"
63+
64+
static let feature = TargetDependency.Features.project(name: "Feature", group: group)
65+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// FollowRepositoryFactory.swift
3+
// Data
4+
//
5+
// Created by kimnahun on 2026-01-23.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Domain
10+
import Foundation
11+
import Networks
12+
13+
public func makeFollowService() -> FollowServiceProtocol {
14+
FollowService()
15+
}
16+
17+
public func makeFollowRepository(service: FollowServiceProtocol) -> FollowRepositoryProtocol {
18+
FollowRepository(service: service)
19+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// FollowRepository.swift
3+
// Data
4+
//
5+
// Created by kimnahun on 2026-01-23.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Domain
10+
import Foundation
11+
import Networks
12+
13+
public final class FollowRepository: FollowRepositoryProtocol, @unchecked Sendable {
14+
private let service: FollowServiceProtocol
15+
16+
public init(service: FollowServiceProtocol) {
17+
self.service = service
18+
}
19+
20+
public func fetchTravelDetail(id: Int) async -> TravelDetail? {
21+
let result = await service.getContentCard(id: id)
22+
23+
switch result {
24+
case .success(let response):
25+
return response.toDomain()
26+
case .failure, .networkFailure:
27+
return nil
28+
}
29+
}
30+
31+
public func fetchPlaces(travelId: Int, day: Int) async -> [TravelPlace] {
32+
let result = await service.getItinerary(id: travelId, day: day)
33+
34+
switch result {
35+
case .success(let response):
36+
return response.toDomain()
37+
case .failure, .networkFailure:
38+
return []
39+
}
40+
}
41+
}

Projects/Data/Sources/Repository/RepoEmpty.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
//
2+
// FollowTransform.swift
3+
// Data
4+
//
5+
// Created by kimnahun on 2026-01-23.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Domain
10+
import Foundation
11+
import Networks
12+
13+
// MARK: - ContentCard Response to TravelDetail
14+
15+
extension FollowContentCardResponse {
16+
func toDomain() -> TravelDetail {
17+
TravelDetail(
18+
travelId: travelId,
19+
country: country,
20+
city: city,
21+
budgetPerPerson: budgetPerPerson,
22+
nights: nights,
23+
days: days,
24+
youtube: youtube.toDomain()
25+
)
26+
}
27+
}
28+
29+
extension YouTubeResponse {
30+
func toDomain() -> YouTubeInfo {
31+
YouTubeInfo(
32+
title: title,
33+
youtuber: name,
34+
thumbnail: thumbnail,
35+
profileImage: profileImage,
36+
link: link,
37+
summary: summary
38+
)
39+
}
40+
}
41+
42+
// MARK: - Itinerary Response to TravelPlace
43+
44+
extension FollowItineraryResponse {
45+
func toDomain() -> [TravelPlace] {
46+
itineraries.map { $0.toDomain() }
47+
}
48+
}
49+
50+
extension FollowPlaceResponse {
51+
func toDomain() -> TravelPlace {
52+
TravelPlace(
53+
id: id,
54+
day: day,
55+
sequence: sequence,
56+
travelerTip: travelerTip ?? "",
57+
estimatedDuration: estimatedDuration,
58+
place: place.toDomain()
59+
)
60+
}
61+
}
62+
63+
extension PlaceResponse {
64+
func toDomain() -> PlaceInfo {
65+
PlaceInfo(
66+
googlePlaceId: googlePlaceId,
67+
thumbnail: thumbnail,
68+
latitude: latitude,
69+
longitude: longitude,
70+
name: name,
71+
regularOpeningHours: regularOpeningHours
72+
)
73+
}
74+
}

Projects/Data/Sources/Transform/TransEmpty.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// FollowRepositoryProtocol.swift
3+
// Domain
4+
//
5+
// Created by kimnahun on 2026-01-23.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
public protocol FollowRepositoryProtocol {
12+
/// 여행 상세 정보 조회
13+
func fetchTravelDetail(id: Int) async -> TravelDetail?
14+
15+
/// 일차별 장소 목록 조회
16+
func fetchPlaces(travelId: Int, day: Int) async -> [TravelPlace]
17+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// FollowError.swift
3+
// Domain
4+
//
5+
// Created by kimnahun on 2026-01-23.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
public enum FollowError: Error, Sendable {
12+
/// 여행 템플릿을 찾을 수 없음
13+
case notFound(message: String)
14+
/// 서버 에러
15+
case serverError(message: String)
16+
/// 네트워크 에러
17+
case networkError(message: String)
18+
/// 알 수 없는 에러
19+
case unknown(code: String, message: String)
20+
}

Projects/Domain/Sources/Model/Travel/PopularTrip.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public struct PopularTrip: Hashable {
3939

4040
public enum TripCategory: String, CaseIterable, Hashable {
4141
case all = "전체"
42-
case vietnam = "베니트남"
42+
case vietnam = "베트남"
4343
case europe = "유럽"
4444
case hongkong = "홍콩/마카오"
4545
case singapore = "싱가포르"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// TravelDetail.swift
3+
// Domain
4+
//
5+
// Created by kimnahun on 2026-01-23.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
/// 여행 상세 정보
12+
public struct TravelDetail: Hashable {
13+
public let travelId: String
14+
public let country: String
15+
public let city: String
16+
public let budgetPerPerson: Int
17+
public let nights: Int
18+
public let days: Int
19+
public let youtube: YouTubeInfo
20+
21+
public init(
22+
travelId: String,
23+
country: String,
24+
city: String,
25+
budgetPerPerson: Int,
26+
nights: Int,
27+
days: Int,
28+
youtube: YouTubeInfo
29+
) {
30+
self.travelId = travelId
31+
self.country = country
32+
self.city = city
33+
self.budgetPerPerson = budgetPerPerson
34+
self.nights = nights
35+
self.days = days
36+
self.youtube = youtube
37+
}
38+
}
39+
40+
/// 유튜브 정보
41+
public struct YouTubeInfo: Hashable {
42+
public let title: String
43+
public let youtuber: String
44+
public let thumbnail: String?
45+
public let profileImage: String?
46+
public let link: String
47+
public let summary: String
48+
49+
public init(
50+
title: String,
51+
youtuber: String,
52+
thumbnail: String?,
53+
profileImage: String?,
54+
link: String,
55+
summary: String
56+
) {
57+
self.title = title
58+
self.youtuber = youtuber
59+
self.thumbnail = thumbnail
60+
self.profileImage = profileImage
61+
self.link = link
62+
self.summary = summary
63+
}
64+
}

0 commit comments

Comments
 (0)