diff --git a/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewDescriptionData.swift b/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewDescriptionData.swift index f94dc2a7..bff98e31 100644 --- a/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewDescriptionData.swift +++ b/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewDescriptionData.swift @@ -22,6 +22,7 @@ extension PlanPreview{ var budget : String var transport : String var month : String + } enum SummaryCase{ diff --git a/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewHeaderData.swift b/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewHeaderData.swift index 94336694..2817f391 100644 --- a/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewHeaderData.swift +++ b/BeMyPlan/BeMyPlan/Global/Model/Preview/PreviewHeaderData.swift @@ -11,5 +11,7 @@ extension PlanPreview{ struct HeaderData{ var writer : String var title : String + + } } diff --git a/BeMyPlan/BeMyPlan/Global/Network/Service/PlanPreviewService.swift b/BeMyPlan/BeMyPlan/Global/Network/Service/PlanPreviewService.swift index 27a0756d..1eadd3bf 100644 --- a/BeMyPlan/BeMyPlan/Global/Network/Service/PlanPreviewService.swift +++ b/BeMyPlan/BeMyPlan/Global/Network/Service/PlanPreviewService.swift @@ -8,16 +8,16 @@ import Foundation protocol PlanPreviewServiceType{ - func getPlanPreviewHeaderData(idx : Int,completion: @escaping (Result) -> Void) - func getPlanPreviewDetailData(idx : Int,completion: @escaping (Result<[PlanPreviewData.Body]?, Error>) -> Void) + func getPlanPreviewHeaderData(idx : Int,completion: @escaping (Result) -> Void) + func getPlanPreviewDetailData(idx : Int,completion: @escaping (Result<[PlanPreviewEntity.Body]?, Error>) -> Void) } extension BaseService : PlanPreviewServiceType{ - func getPlanPreviewHeaderData(idx: Int, completion: @escaping (Result) -> Void) { + func getPlanPreviewHeaderData(idx: Int, completion: @escaping (Result) -> Void) { requestObject(.getPlanPreviewHeaderData(idx: idx), completion: completion) } - func getPlanPreviewDetailData(idx: Int, completion: @escaping (Result<[PlanPreviewData.Body]?, Error>) -> Void) { + func getPlanPreviewDetailData(idx: Int, completion: @escaping (Result<[PlanPreviewEntity.Body]?, Error>) -> Void) { requestObject(.getPlanPreviewData(idx: idx), completion: completion) } } diff --git a/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/Repository/PlanPreviewEntity.swift b/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/Repository/PlanPreviewEntity.swift index 8eca7420..84751334 100644 --- a/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/Repository/PlanPreviewEntity.swift +++ b/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/Repository/PlanPreviewEntity.swift @@ -7,6 +7,7 @@ import Foundation + struct PlanPreviewEntity :Codable{ struct Body :Codable{ let datumDescription: String diff --git a/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewModel.swift b/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewModel.swift index e7bdf3ce..02515394 100644 --- a/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewModel.swift +++ b/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewModel.swift @@ -7,42 +7,50 @@ import Foundation -struct PlanPreviewData :Codable{ - struct Body :Codable{ - let datumDescription: String - let photoUrls: [String] - - enum CodingKeys: String, CodingKey { - case datumDescription = "description" - case photoUrls = "photo_urls" - } +struct PlanPreviewModel{ } + + +// MARK: - Header + +extension PlanPreviewModel{ + struct Header{ + var writer : String + var title : String + } +} +// MARK: - Description + +extension PlanPreviewModel{ + struct Description{ + var descriptionContent : String + var summary : IconData } - struct Header: Codable { - let title, dataDescription: String - let price: Int - let tagTheme: String - let tagCountSpot, tagCountDay, tagCountRestaurant: Int - let tagPartner, tagMoney, tagMobility: String - let tagMonth: Int - let author: String - let authorID: Int - - enum CodingKeys: String, CodingKey { - case title - case dataDescription = "description" - case price - case tagTheme = "tag_theme" - case tagCountSpot = "tag_count_spot" - case tagCountDay = "tag_count_day" - case tagCountRestaurant = "tag_count_restaurant" - case tagPartner = "tag_partner" - case tagMoney = "tag_money" - case tagMobility = "tag_mobility" - case tagMonth = "tag_month" - case author - case authorID = "author_id" - } + struct IconData{ + var theme : String + var spotCount : String + var restaurantCount : String + var dayCount : String + var peopleCase : String + var budget : String + var transport : String + var month : String } +} +// MARK: - Photo + +extension PlanPreviewModel{ + struct Photo{ + var photo : String + var content : String + } +} + +// MARK: - Summary + +extension PlanPreviewModel{ + struct Summary{ + var content : String + } } diff --git a/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewUseCase.swift b/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewUseCase.swift index 45dc071a..8a8bb7ba 100644 --- a/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewUseCase.swift +++ b/BeMyPlan/BeMyPlan/Screen/Plan/PlanPreview/UseCase/PlanPreviewUseCase.swift @@ -7,10 +7,16 @@ import Foundation -class PlanPreviewUseCase{ +final class PlanPreviewUseCase{ let repository = BaseService.default + var headerData : PlanPreview.HeaderData? + var descriptionData : PlanPreview.DescriptionData? + var photoData : [PlanPreview.PhotoData]? + var summaryData : PlanPreview.SummaryData? + var recommendData : PlanPreview.RecommendData? + func fetchBodyData(idx: Int){ repository.getPlanPreviewDetailData(idx: idx) { result in result.success { list in