콘텐츠 등록

- 한정판 등록 기능 추가
This commit is contained in:
Yu Sung
2024-06-07 14:51:24 +09:00
parent 5fc0f1789a
commit 9533e97f89
3 changed files with 80 additions and 7 deletions

View File

@@ -55,15 +55,48 @@ final class ContentCreateViewModel: ObservableObject {
didSet {
if isFree {
priceString = "0"
isLimited = false
isOnlyRental = false
isGeneratePreview = true
}
}
}
@Published var isOnlyRental = false
@Published var isOnlyRental = false {
didSet {
if isOnlyRental {
isLimited = false
}
}
}
@Published var isGeneratePreview = true
@Published var isLimited = false {
didSet {
if !isLimited {
limitedString = ""
}
}
}
@Published var limited: Int? = nil {
didSet {
if let limited = limited, limited <= 0 {
limitedString = ""
}
}
}
@Published var limitedString: String = "" {
didSet {
if limitedString == "" {
limited = nil
} else {
limited = Int(limitedString)
}
}
}
@Published var previewStartTime: String = ""
@Published var previewEndTime: String = ""
@Published var releaseDateString: String = Date().convertDateFormat(dateFormat: "yyyy.MM.dd")
@@ -92,6 +125,7 @@ final class ContentCreateViewModel: ObservableObject {
detail: detail,
tags: hashtags,
price: price,
limited: limited,
releaseDate: isActiveReservation ? "\(releaseDate.convertDateFormat(dateFormat: "yyyy-MM-dd")) \(releaseTime.convertDateFormat(dateFormat: "HH:mm"))" : nil,
timezone: TimeZone.current.identifier,
themeId: theme!.id,