-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor/#28 network data layer #29
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
Changes from all commits
1197bb0
7b672fd
3f1815f
bb7bf31
361a0d8
f437229
dfca50e
e13e0a6
f96335f
a54151c
ca84a7e
081c9bb
d2ce738
c22cc8e
db1cb1f
5711c76
7336680
b6155df
9a0b330
48487b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,6 @@ public final class TokenProviderAdapter: TokenProviding, @unchecked Sendable { | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public func accessToken() -> String? { | ||||||||||||||||||||||||||||
| // tokenRepository.get(.accessToken) | ||||||||||||||||||||||||||||
| "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiYmE3ODIwYS0wMDUzLTQxZDctODdhYi00Zjk2ZWM3ZDI1MTMiLCJpYXQiOjE3NzA5NjQzMDUsImV4cCI6MTc3MTA1MDcwNX0.Sn8wNhZ1Ac-ETZDsOiSMMHHaALJNXxNKrbN_-4xD5REcVa2tJ0NiafhTKlbIuYafL1Acd9dDMIHjx3H33c5w8w" | ||||||||||||||||||||||||||||
| "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiYmE3ODIwYS0wMDUzLTQxZDctODdhYi00Zjk2ZWM3ZDI1MTMiLCJpYXQiOjE3NzEyMzU1MDUsImV4cCI6MTc3MTMyMTkwNX0.SfuVfF9FFpnFcUkGM7zC7mlE7-f8zo3NgG5mm86xekLnurFhGgnTIhwpew7FinguOex0smsnx--EHsMaED8D5A" | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
Comment on lines
20
to
23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ํ๋์ฝ๋ฉ๋ JWT ํ ํฐ์ด ์์ค ์ฝ๋์ ์ปค๋ฐ๋๊ณ ์์ต๋๋ค.
Gitleaks ์ ์ ๋ถ์์์๋ ์ด ๋ผ์ธ์ high ์ฌ๊ฐ๋๋ก ํ๋๊ทธํ๊ณ ์์ต๋๋ค. ์์ ํ
์คํธ ๋ชฉ์ ์ด๋ผ๋ฉด, ์ต์ํ ๐ ์ ์: DEBUG ์กฐ๊ฑด๋ถ ์ปดํ์ผ ๋ฐ ์ฃผ์ ํด์ public func accessToken() -> String? {
-// tokenRepository.get(.accessToken)
- "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiYmE3ODIwYS0wMDUzLTQxZDctODdhYi00Zjk2ZWM3ZDI1MTMiLCJpYXQiOjE3NzEyMzU1MDUsImV4cCI6MTc3MTMyMTkwNX0.SfuVfF9FFpnFcUkGM7zC7mlE7-f8zo3NgG5mm86xekLnurFhGgnTIhwpew7FinguOex0smsnx--EHsMaED8D5A"
+ `#if` DEBUG
+ // TODO: xcconfig ๋๋ ํ๊ฒฝ ๋ณ์์์ ํ
์คํธ ํ ํฐ์ ์ฃผ์
ํ๋๋ก ๋ณ๊ฒฝ
+ return ProcessInfo.processInfo.environment["DEBUG_ACCESS_TOKEN"]
+ `#else`
+ return tokenRepository.get(.accessToken)
+ `#endif`
}Based on learnings: "Do not hardcode temporary/local test secrets in code. Inject secrets via a gitignored xcconfig and wire them into Info.plist, then read only in DEBUG builds." ๐ Committable suggestion
Suggested change
๐งฐ Tools๐ช Gitleaks (8.30.0)[high] 22-22: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data. (jwt) ๐ค Prompt for AI Agents |
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // | ||
| // PlaceServiceFactory.swift | ||
| // Data | ||
| // | ||
| // Created by ์ต์์ฉ on 2/15/26. | ||
| // Copyright ยฉ 2026 NDGL-iOS. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Domain | ||
| import Networks | ||
|
|
||
| public func makePlaceService() -> PlaceServiceProtocol { | ||
| return PlaceService() | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // | ||
| // TravelProgramServiceFactory.swift | ||
| // Data | ||
| // | ||
| // Created by ์ต์์ฉ on 2/15/26. | ||
| // Copyright ยฉ 2026 NDGL-iOS. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Domain | ||
| import Networks | ||
|
|
||
| public func makeTravelProgramService() -> TravelProgramServiceProtocol { | ||
| return TravelProgramService() | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // | ||
| // TravelTemplateServiceFactory.swift | ||
| // Data | ||
| // | ||
| // Created by ์ต์์ฉ on 2/15/26. | ||
| // Copyright ยฉ 2026 NDGL-iOS. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Domain | ||
| import Networks | ||
|
|
||
| import Moya | ||
|
|
||
| public func makeTravelTemplateService(tokenProvider: TokenProviding) -> TravelTemplateServiceProtocol { | ||
| let provider: MoyaProvider<TravelTemplateAPI> = NetworkProviderFactory.makeAuthenticatedProvider(tokenProvider: tokenProvider) | ||
|
|
||
| return TravelTemplateService(provider: provider) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // | ||
| // UserTravelServiceFactory.swift | ||
| // Data | ||
| // | ||
| // Created by ์ต์์ฉ on 2/15/26. | ||
| // Copyright ยฉ 2026 NDGL-iOS. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Domain | ||
| import Networks | ||
|
|
||
| import Moya | ||
|
|
||
| public func makeUserTravelService(tokenProvider: TokenProviding) -> UserTravelServiceProtocol { | ||
| let provider: MoyaProvider<UserTravelAPI> = NetworkProviderFactory.makeAuthenticatedProvider(tokenProvider: tokenProvider) | ||
|
|
||
| return UserTravelService(provider: provider) | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // | ||
| // PlaceRepository.swift | ||
| // Data | ||
| // | ||
| // Created by ์ต์์ฉ on 2/14/26. | ||
| // Copyright ยฉ 2026 NDGL-iOS. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Domain | ||
| import Networks | ||
|
|
||
| public final class PlaceRepository: PlaceRepositoryInterface { | ||
| private let service: PlaceServiceProtocol | ||
|
|
||
| public init(service: PlaceServiceProtocol) { | ||
| self.service = service | ||
| } | ||
|
|
||
| public func searchPlaces() async throws -> Int { | ||
| do { | ||
| return try await service.searchPlaces() | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
|
|
||
| public func fetchPlacePhotos(googlePlaceId: String) async throws -> [PlacePhoto] { | ||
| do { | ||
| return try await service.getPlacePhotos(googlePlaceId: googlePlaceId).toDomain() | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
|
|
||
| public func fetchPlaceDetail(googlePlaceId: String) async throws -> PlaceDetail { | ||
| do { | ||
| return try await service.getPlaceDetails(googlePlaceId: googlePlaceId).toDomain() | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // | ||
| // TravelProgramRepository.swift | ||
| // Data | ||
| // | ||
| // Created by ์ต์์ฉ on 2/14/26. | ||
| // Copyright ยฉ 2026 NDGL-iOS. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Domain | ||
| import Networks | ||
|
|
||
| public final class TravelProgramRepository: TravelProgramRepositoryInterface { | ||
| private let service: TravelProgramServiceProtocol | ||
|
|
||
| public init(service: TravelProgramServiceProtocol) { | ||
| self.service = service | ||
| } | ||
|
|
||
| public func fetchCategoryList() async throws -> [TripCategory] { | ||
| do { | ||
| return try await service.getTravelPrograms().map { $0.toDomain() } | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // | ||
| // TravelTemplateRepository.swift | ||
| // Data | ||
| // | ||
| // Created by ์ต์์ฉ on 2/14/26. | ||
| // Copyright ยฉ 2026 NDGL-iOS. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| import Domain | ||
| import Networks | ||
|
|
||
| public final class TravelTemplateRepository: TravelTemplateRepositoryInterface { | ||
| private let service: TravelTemplateServiceProtocol | ||
|
|
||
| public init(service: TravelTemplateServiceProtocol) { | ||
| self.service = service | ||
| } | ||
|
|
||
| public func fetchPlaces(travelId: Int, day: Int) async throws -> [TravelPlace] { | ||
| do { | ||
| return try await service.getItinerary(travelId: travelId, day: day).toDomain() | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
|
|
||
| public func fetchTravelDetail(id: Int) async throws -> TravelDetail { | ||
| do { | ||
| return try await service.getContentCard(id: id).toDomain() | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
|
|
||
| public func searchTemplate() async throws -> Int { | ||
| do { | ||
| return try await service.searchTemplate() | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
|
|
||
| public func fetchPopularTripList(id: Int?, page: Int?, size: Int?) async throws -> [TripInfo] { | ||
| do { | ||
| return try await service.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 service.getRecommendTripList(page: page, size: size).toDomain() | ||
| } catch { | ||
| throw error.toNDGLError() | ||
| } | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.