Skip to content

Commit

Permalink
[Fix] PlaceRouter 수정 - #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin0331 committed Feb 3, 2025
1 parent 5504450 commit dabc97f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Whidy-iOS/Repository/Entity/Place.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import Foundation
import CoreData

struct Place: Identifiable {
let id: Int64
let id: Int
let name: String
let address: String
let latitude: Double
let longitude: Double
let beveragePrice: Int
let reviewScore: Float
let beveragePrice: Int?
let reviewScore: Double?
let placeType: PlaceType

enum PlaceType: String {
Expand All @@ -37,6 +37,6 @@ extension Place {
self.longitude = dto.longitude
self.beveragePrice = dto.beveragePrice
self.reviewScore = dto.reviewScore
self.placeType = PlaceType(rawValue: dto.placeType.rawValue) ?? .generalCafe
self.placeType = PlaceType(rawValue: dto.placeType) ?? .generalCafe
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ struct PlaceSearchCondition: Encodable {
var reviewScoreTo: Int?
var beverageFrom: Int?
var beverageTo: Int?
var placeType: [String]?
var placeType: [String] = .init()
var businessDayOfWeek: [String]?
var visitTimeFrom: LocalTime?
var visitTimeTo: LocalTime?
var centerLatitude: Double
var centerLongitude: Double
var radius: Double
var keyword: String?
var keyword: String = .init()

enum CodingKeys: String, CodingKey {
case reviewScoreFrom
Expand Down
23 changes: 6 additions & 17 deletions Whidy-iOS/Repository/Model/Response/Place/PlaceDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,10 @@
import Foundation

struct PlaceDTO: Decodable {
let id: Int64
let name: String
let address: String
let latitude: Double
let longitude: Double
let beveragePrice: Int
let reviewScore: Float
let placeType: PlaceType

enum PlaceType: String, Decodable {
case studyCafe = "STUDY_CAFE"
case generalCafe = "GENERAL_CAFE"
case franchiseCafe = "FRANCHISE_CAFE"
case freePicture = "FREE_PICTURE"
case freeStudySpace = "FREE_STUDY_SPACE"
case freeClothesRental = "FREE_CLOTHES_RENTAL"
}
let id: Int
let name, address: String
let latitude, longitude: Double
let beveragePrice: Int?
let reviewScore: Double?
let placeType: String
}
14 changes: 10 additions & 4 deletions Whidy-iOS/Repository/Router/PlaceRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,23 @@ extension PlaceRouter : TargetType {
var parameter: Parameters? {
switch self {
case let .place(condition):
return condition.toDictionary()
return [
"centerLatitude": condition.centerLatitude,
"centerLongitude": condition.centerLongitude,
"radius" : condition.radius,
"placeType" : condition.placeType.joined(separator: ","),
"keyword" : condition.keyword
]
}
}

var queryItems: [URLQueryItem]? {
return nil
}

var body: Data? {
switch self {

default:
return nil
}
Expand Down

0 comments on commit dabc97f

Please sign in to comment.