add storeId for MatchScheduler

sync2
Laurent 1 year ago
parent f1b351a13f
commit fee94a2b7d
  1. 13
      PadelClub/Data/Gen/BaseMatchScheduler.swift
  2. 4
      PadelClub/Data/Gen/BaseMonthData.swift
  3. 5
      PadelClub/Data/Gen/MatchScheduler.json
  4. 2
      PadelClub/Data/MatchScheduler.swift
  5. 1
      PadelClub/Data/README.md

@ -8,7 +8,7 @@ import SwiftUI
@Observable
class BaseMatchScheduler: ModelObject, Storable, Codable {
static func resourceName() -> String { return "match-schedulers" }
static func resourceName() -> String { return "match-scheduler" }
static func tokenExemptedMethods() -> [HTTPMethod] { return [] }
static func filterByStoreIdentifier() -> Bool { return false }
@ -26,6 +26,7 @@ class BaseMatchScheduler: ModelObject, Storable, Codable {
var groupStageChunkCount: Int? = nil
var overrideCourtsUnavailability: Bool = false
var shouldTryToFillUpCourtsAvailable: Bool = false
var storeId: String? = nil
init(
id: String = Store.randomId(),
@ -41,7 +42,8 @@ class BaseMatchScheduler: ModelObject, Storable, Codable {
shouldEndRoundBeforeStartingNext: Bool = false,
groupStageChunkCount: Int? = nil,
overrideCourtsUnavailability: Bool = false,
shouldTryToFillUpCourtsAvailable: Bool = false
shouldTryToFillUpCourtsAvailable: Bool = false,
storeId: String? = nil
) {
super.init()
self.id = id
@ -58,6 +60,7 @@ class BaseMatchScheduler: ModelObject, Storable, Codable {
self.groupStageChunkCount = groupStageChunkCount
self.overrideCourtsUnavailability = overrideCourtsUnavailability
self.shouldTryToFillUpCourtsAvailable = shouldTryToFillUpCourtsAvailable
self.storeId = storeId
}
enum CodingKeys: String, CodingKey {
@ -75,6 +78,7 @@ class BaseMatchScheduler: ModelObject, Storable, Codable {
case _groupStageChunkCount = "groupStageChunkCount"
case _overrideCourtsUnavailability = "overrideCourtsUnavailability"
case _shouldTryToFillUpCourtsAvailable = "shouldTryToFillUpCourtsAvailable"
case _storeId = "storeId"
}
required init(from decoder: Decoder) throws {
@ -94,6 +98,7 @@ class BaseMatchScheduler: ModelObject, Storable, Codable {
self.groupStageChunkCount = try container.decodeIfPresent(Int.self, forKey: ._groupStageChunkCount) ?? nil
self.overrideCourtsUnavailability = try container.decodeIfPresent(Bool.self, forKey: ._overrideCourtsUnavailability) ?? false
self.shouldTryToFillUpCourtsAvailable = try container.decodeIfPresent(Bool.self, forKey: ._shouldTryToFillUpCourtsAvailable) ?? false
self.storeId = try container.decodeIfPresent(String.self, forKey: ._storeId) ?? nil
}
func encode(to encoder: Encoder) throws {
@ -112,6 +117,7 @@ class BaseMatchScheduler: ModelObject, Storable, Codable {
try container.encode(self.groupStageChunkCount, forKey: ._groupStageChunkCount)
try container.encode(self.overrideCourtsUnavailability, forKey: ._overrideCourtsUnavailability)
try container.encode(self.shouldTryToFillUpCourtsAvailable, forKey: ._shouldTryToFillUpCourtsAvailable)
try container.encode(self.storeId, forKey: ._storeId)
}
func tournamentValue() -> Tournament? {
@ -134,5 +140,6 @@ class BaseMatchScheduler: ModelObject, Storable, Codable {
self.groupStageChunkCount = matchscheduler.groupStageChunkCount
self.overrideCourtsUnavailability = matchscheduler.overrideCourtsUnavailability
self.shouldTryToFillUpCourtsAvailable = matchscheduler.shouldTryToFillUpCourtsAvailable
self.storeId = matchscheduler.storeId
}
}
}

@ -8,7 +8,7 @@ import SwiftUI
@Observable
class BaseMonthData: ModelObject, Storable, Codable {
static func resourceName() -> String { return "month-datas" }
static func resourceName() -> String { return "month-data" }
static func tokenExemptedMethods() -> [HTTPMethod] { return [] }
static func filterByStoreIdentifier() -> Bool { return false }
@ -110,4 +110,4 @@ class BaseMonthData: ModelObject, Storable, Codable {
self.dataModelIdentifier = monthdata.dataModelIdentifier
self.fileModelIdentifier = monthdata.fileModelIdentifier
}
}
}

@ -68,6 +68,11 @@
"name": "shouldTryToFillUpCourtsAvailable",
"type": "Bool",
"defaultValue": "false"
},
{
"name": "storeId",
"type": "String",
"optional": true
}
]
}

@ -10,7 +10,7 @@ import LeStorage
import SwiftUI
@Observable
final class MatchScheduler : BaseMatchScheduler {
final class MatchScheduler: BaseMatchScheduler, SideStorable {
// static func resourceName() -> String { return "match-scheduler" }
// static func tokenExemptedMethods() -> [HTTPMethod] { return [] }

@ -10,6 +10,7 @@ Dans Swift:
Dans Django:
- Ajouter le champ dans la classe
- Si c'est une ForeignKey, toujours mettre un related_name sinon la synchro casse
- S'il c'est un champ dans **CustomUser**:
- Ajouter le champ à la méthode fields_for_update
- Ajouter le champ dans UserSerializer > create > create_user dans serializers.py

Loading…
Cancel
Save