-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from ghojeong/feature/sidedishEntity
너무 고생했습니다 :) (#11)
- Loading branch information
Showing
17 changed files
with
266 additions
and
31 deletions.
There are no files selected for viewing
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
File renamed without changes.
File renamed without changes.
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,46 @@ | ||
// | ||
// SideDish.swift | ||
// sidedish | ||
// | ||
// Created by Song on 2021/04/20. | ||
// | ||
|
||
import Foundation | ||
|
||
class SideDish: Codable { | ||
|
||
var detail_hash : String | ||
var image: String //library/cache의 파일명 | ||
var title: String //"[소중한식사] 골뱅이무침 195g" | ||
var description: String //"매콤새콤달콤, 반찬으로도 안주로도 좋은" | ||
var deliveryTypes: [String] //["새벽배송","전국택배"] | ||
var price: Int //7,000 | ||
var salePrice: Int //6,300 | ||
var badges: [String] //["이벤트특가", "런칭특가"] | ||
|
||
var detail: Detail? | ||
|
||
func updateDetail(_ detail: Detail) { | ||
self.detail = detail | ||
} | ||
} | ||
|
||
class Detail: Codable { | ||
var thumbImages: [String] //library/cache의 파일명들 | ||
var point: String //"63원" | ||
var deliveryInfo: String //"서울 경기 새벽배송 / 전국택배 (제주 및 도서산간 불가) [화 수 목 금 토] 수령 가능한 상품입니다" | ||
var deliveryFee: String //"2,500원 (40,000원 이상 구매 시 무료)" | ||
var detailImages: [String] | ||
} | ||
|
||
//struct Detail: Codable { | ||
// var hash = "HF778" //겹침 | ||
// var topImage = "" //겹침? | ||
// var thumbImages = ["","",""] | ||
// var productDescription = "매콤새콤달콤, 반찬으로도 안주로도 좋은" //겹침 | ||
// var point = "63원" | ||
// var deliveryInfo = "서울 경기 새벽배송 / 전국택배 (제주 및 도서산간 불가) [화 수 목 금 토] 수령 가능한 상품입니다" | ||
// var deliveryFee = "2,500원 (40,000원 이상 구매 시 무료)" | ||
// var prices = ["7,000원", "6,300원"] //겹침 | ||
// var detailSection = ["","","",""] | ||
//} |
16 changes: 16 additions & 0 deletions
16
ios/sidedish/sidedish/Domain/Entity/SideDishFindable.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,16 @@ | ||
// | ||
// SideDishFindable.swift | ||
// sidedish | ||
// | ||
// Created by Song on 2021/04/20. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol SideDishFindable { | ||
|
||
func count() -> Int | ||
|
||
func sideDish(at index: Int) -> SideDish? | ||
|
||
} |
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,40 @@ | ||
// | ||
// SideDishes.swift | ||
// sidedish | ||
// | ||
// Created by Song on 2021/04/20. | ||
// | ||
|
||
import Foundation | ||
|
||
class SideDishes: Codable { | ||
|
||
private(set) var category: Category | ||
|
||
enum Category: Int, Codable { | ||
case main = 1 | ||
case soup = 2 | ||
case side = 3 | ||
} | ||
|
||
private var list: [SideDish] | ||
|
||
init(category: Category, list: [SideDish]) { | ||
self.category = category | ||
self.list = list | ||
} | ||
|
||
} | ||
|
||
extension SideDishes: SideDishFindable { | ||
|
||
func count() -> Int { | ||
return list.count | ||
} | ||
|
||
func sideDish(at index: Int) -> SideDish? { | ||
guard count() > index else { return nil } | ||
return list[index] | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
ios/sidedish/sidedish/Domain/Entity/SideDishesCollection.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,24 @@ | ||
// | ||
// SideDishesCollection.swift | ||
// sidedish | ||
// | ||
// Created by Song on 2021/04/20. | ||
// | ||
|
||
import Foundation | ||
|
||
class SideDishesCollection: Codable { | ||
|
||
private var recentUpdate: Date? | ||
private var list: [SideDishes] | ||
|
||
init(recentUpdate: Date, list: [SideDishes]) { | ||
self.recentUpdate = recentUpdate | ||
self.list = list | ||
} | ||
|
||
func update(list: [SideDishes]) { | ||
self.list = list | ||
recentUpdate = Date() | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.