Skip to content

Commit

Permalink
#213: MapRepository 관련 UseCase 세팅 (LocationCoordinateRequestValue 재사용…
Browse files Browse the repository at this point in the history
… 목적 선언)
  • Loading branch information
dev-muuu committed Mar 26, 2023
1 parent 3ccd892 commit d539936
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Zatch/Domain/UseCase/Map/GetMeetingLocationUseCase.swift
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)
}
}
26 changes: 26 additions & 0 deletions Zatch/Domain/UseCase/Map/GetTownLocationUseCase.swift
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 Zatch/Domain/UseCase/Map/LocationCoordinateRequestValue.swift
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
}
29 changes: 29 additions & 0 deletions Zatch/Domain/UseCase/Map/PlaceSearchUseCase.swift
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)
}
}

0 comments on commit d539936

Please sign in to comment.