-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#213: MapRepository 관련 UseCase 세팅 (LocationCoordinateRequestValue 재사용…
… 목적 선언)
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// GetMeetingLocationUseCase.swift | ||
// Zatch | ||
// | ||
// Created by 박소윤 on 2023/03/26. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
protocol GetMeetingLocationInterface { | ||
func execute(requestValue: LocationCoordinateRequestValue) -> Observable<MeetingLoactionResponseModel> | ||
} | ||
|
||
final class GetMeetingLocationUseCase: GetMeetingLocationInterface { | ||
|
||
private let mapRepository: MapRepositoryInterface | ||
|
||
init(mapRepository: MapRepositoryInterface = MapRepository()) { | ||
self.mapRepository = mapRepository | ||
} | ||
|
||
func execute(requestValue: LocationCoordinateRequestValue) -> Observable<MeetingLoactionResponseModel>{ | ||
return mapRepository.getMeetingLocation(coordinate: requestValue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// GetTownLocationUseCase.swift | ||
// Zatch | ||
// | ||
// Created by 박소윤 on 2023/03/26. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
protocol GetTownLocationInterface { | ||
func execute(requestValue: LocationCoordinateRequestValue) -> Observable<GetTownResponseModel> | ||
} | ||
|
||
final class GetTownLocationUseCase: GetTownLocationInterface { | ||
|
||
private let mapRepository: MapRepositoryInterface | ||
|
||
init(mapRepository: MapRepositoryInterface = MapRepository()) { | ||
self.mapRepository = mapRepository | ||
} | ||
|
||
func execute(requestValue: LocationCoordinateRequestValue) -> Observable<GetTownResponseModel> { | ||
return mapRepository.getTownLocation(coordinate: requestValue) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Zatch/Domain/UseCase/Map/LocationCoordinateRequestValue.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// LocationCoordinateRequestValue.swift | ||
// Zatch | ||
// | ||
// Created by 박소윤 on 2023/03/26. | ||
// | ||
|
||
import Foundation | ||
|
||
struct LocationCoordinateRequestValue { | ||
let x: Float | ||
let y: Float | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// PlaceSearchUseCase.swift | ||
// Zatch | ||
// | ||
// Created by 박소윤 on 2023/03/26. | ||
// | ||
|
||
import Foundation | ||
|
||
struct PlaceSearchRequestValue { | ||
let place: String | ||
} | ||
|
||
protocol PlaceSearchUseCaseInterface { | ||
func execute(requestValue: PlaceSearchRequestValue) async throws | ||
} | ||
|
||
final class PlaceSearchUseCase: PlaceSearchUseCaseInterface { | ||
|
||
private let mapRepository: MapRepositoryInterface | ||
|
||
init(mapRepository: MapRepositoryInterface = MapRepository()) { | ||
self.mapRepository = mapRepository | ||
} | ||
|
||
func execute(requestValue: PlaceSearchRequestValue) async throws { | ||
return try await mapRepository.placeSearch(query: requestValue) | ||
} | ||
} |