-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
762214e
commit 0a80187
Showing
2 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
GEON-PPANG-iOS/Data/Network/DataMapping/ResponseDTO/BestBakeryResponseDTO.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,58 @@ | ||
// | ||
// BestBakeryDTO.swift | ||
// GEON-PPANG-iOS | ||
// | ||
// Created by JEONGEUN KIM on 6/29/24. | ||
// | ||
import Foundation | ||
|
||
struct BestBakeryResponseDTO: Decodable { | ||
|
||
let bakeryID: Int | ||
let bakeryName: String | ||
let bakeryPicture: String | ||
let isHACCP, isVegan, isNonGMO: Bool | ||
let firstNearStation: String | ||
let secondNearStation: String | ||
let reviewCount, bookMarkCount: Int | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case bakeryID = "bakeryId" | ||
case bakeryName | ||
case bakeryPicture | ||
case isHACCP, isVegan, isNonGMO | ||
case firstNearStation, secondNearStation | ||
case reviewCount | ||
case bookMarkCount | ||
} | ||
|
||
} | ||
|
||
extension BestBakeryResponseDTO { | ||
|
||
func toDomain() -> BestBakery { | ||
let overview: BakeryOverview = .init( | ||
id: bakeryID, | ||
name: bakeryName, | ||
image: bakeryPicture | ||
) | ||
let certifications: Certifications = .init( | ||
isHaccp: isHACCP, | ||
isVegan: isVegan, | ||
isNonGMO: isNonGMO | ||
) | ||
let regions: Regions = .init( | ||
firstRegion: firstNearStation, | ||
secondRegion: secondNearStation | ||
) | ||
|
||
return BestBakery( | ||
overview: overview, | ||
certifications: certifications, | ||
bookmarkCount: bookMarkCount, | ||
reviewCount: reviewCount, | ||
regions: regions | ||
) | ||
} | ||
} | ||
|
39 changes: 39 additions & 0 deletions
39
GEON-PPANG-iOS/Data/Network/DataMapping/ResponseDTO/BestReviewResponseDTO.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,39 @@ | ||
// | ||
// BestReviewDTO.swift | ||
// GEON-PPANG-iOS | ||
// | ||
// Created by JEONGEUN KIM on 6/29/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct BestReviewResponseDTO: Decodable { | ||
let bakeryID: Int | ||
let bakeryName: String | ||
let bakeryPicture: String | ||
let isHACCP, isVegan, isNonGMO: Bool | ||
let firstNearStation, secondNearStation: String | ||
let reviewCount: Int | ||
let reviewText: String | ||
let firstMaxRecommendKeyword: String | ||
let secondMaxRecommendKeyword: String? | ||
let bookMarkCount: Int | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case bakeryID = "bakeryId" | ||
case bakeryName, bakeryPicture, isHACCP, isVegan, isNonGMO, firstNearStation, secondNearStation, reviewCount, reviewText, firstMaxRecommendKeyword, secondMaxRecommendKeyword, bookMarkCount | ||
} | ||
} | ||
|
||
extension BestReviewResponseDTO { | ||
|
||
func toDomain() -> BestReview { | ||
let overview: BakeryOverview = .init(id: bakeryID, name: bakeryName, image: bakeryPicture) | ||
|
||
return BestReview(overview: overview, | ||
reviewOverview: reviewText, | ||
recommendKeywords: [firstMaxRecommendKeyword, secondNearStation], | ||
bookmarkCount: bookMarkCount, | ||
reviewCount: reviewCount) | ||
} | ||
} |