Skip to content

Commit

Permalink
[Chore] post 메소드 requestBody 수정 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurim830 committed Feb 15, 2025
1 parent 812e7ed commit 46d2a1c
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class SpotListViewModel {

var spotType: ObservablePattern<SpotType> = ObservablePattern(nil)

var filterList: [SpotFilterModel] = [] // TODO: SpotCondition으로 바꾸기
var filterList: [SpotFilterModel] = []

var walkingTime: SpotType.WalkingDistanceType = .fifteen

var restaurantPrice: SpotType.RestaurantPriceType = .aboveFiftyThousand
var restaurantPrice: SpotType.RestaurantPriceType = .aboveFiftyThousand // TODO: 옵셔널로 변경

var cafePrice: SpotType.CafePriceType = .aboveTenThousand
var cafePrice: SpotType.CafePriceType = .aboveTenThousand // TODO: 옵셔널로 변경


// MARK: - Methods
Expand Down Expand Up @@ -75,17 +75,17 @@ extension SpotListViewModel {
}

func postSpotList() {
let filterListDTO = filterList.map { filter in
return SpotFilter(category: filter.category.serverKey,
optionList: filter.optionList)
}

let requestBody = PostSpotListRequest(
latitude: userCoordinate.latitude,
longitude: userCoordinate.longitude,
condition: SpotCondition(
spotType: spotType.value?.serverKey ?? "",
filterList: filterList.map { filterList in
let filterList = SpotFilter(
category: filterList.category.serverKey,
optionList: filterList.optionList)
return filterList
},
spotType: spotType.value?.serverKey,
filterList: filterList.isEmpty ? nil : filterListDTO,
walkingTime: walkingTime.serverKey,
priceRange: spotType.value == .restaurant ? restaurantPrice.serverKey : cafePrice.serverKey
)
Expand Down

0 comments on commit 46d2a1c

Please sign in to comment.