parent
671edd3412
commit
0dd3dc16bd
@ -0,0 +1,139 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseClub: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "clubs" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var creator: String? = nil |
||||
var name: String = "" |
||||
var acronym: String = "" |
||||
var phone: String? = nil |
||||
var code: String? = nil |
||||
var address: String? = nil |
||||
var city: String? = nil |
||||
var zipCode: String? = nil |
||||
var latitude: Double? = nil |
||||
var longitude: Double? = nil |
||||
var courtCount: Int = 2 |
||||
var broadcastCode: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
creator: String? = nil, |
||||
name: String = "", |
||||
acronym: String = "", |
||||
phone: String? = nil, |
||||
code: String? = nil, |
||||
address: String? = nil, |
||||
city: String? = nil, |
||||
zipCode: String? = nil, |
||||
latitude: Double? = nil, |
||||
longitude: Double? = nil, |
||||
courtCount: Int = 2, |
||||
broadcastCode: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.creator = creator |
||||
self.name = name |
||||
self.acronym = acronym |
||||
self.phone = phone |
||||
self.code = code |
||||
self.address = address |
||||
self.city = city |
||||
self.zipCode = zipCode |
||||
self.latitude = latitude |
||||
self.longitude = longitude |
||||
self.courtCount = courtCount |
||||
self.broadcastCode = broadcastCode |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _creator = "creator" |
||||
case _name = "name" |
||||
case _acronym = "acronym" |
||||
case _phone = "phone" |
||||
case _code = "code" |
||||
case _address = "address" |
||||
case _city = "city" |
||||
case _zipCode = "zipCode" |
||||
case _latitude = "latitude" |
||||
case _longitude = "longitude" |
||||
case _courtCount = "courtCount" |
||||
case _broadcastCode = "broadcastCode" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.creator = try container.decodeIfPresent(String.self, forKey: ._creator) ?? nil |
||||
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? "" |
||||
self.acronym = try container.decodeIfPresent(String.self, forKey: ._acronym) ?? "" |
||||
self.phone = try container.decodeIfPresent(String.self, forKey: ._phone) ?? nil |
||||
self.code = try container.decodeIfPresent(String.self, forKey: ._code) ?? nil |
||||
self.address = try container.decodeIfPresent(String.self, forKey: ._address) ?? nil |
||||
self.city = try container.decodeIfPresent(String.self, forKey: ._city) ?? nil |
||||
self.zipCode = try container.decodeIfPresent(String.self, forKey: ._zipCode) ?? nil |
||||
self.latitude = try container.decodeIfPresent(Double.self, forKey: ._latitude) ?? nil |
||||
self.longitude = try container.decodeIfPresent(Double.self, forKey: ._longitude) ?? nil |
||||
self.courtCount = try container.decodeIfPresent(Int.self, forKey: ._courtCount) ?? 2 |
||||
self.broadcastCode = try container.decodeIfPresent(String.self, forKey: ._broadcastCode) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.creator, forKey: ._creator) |
||||
try container.encode(self.name, forKey: ._name) |
||||
try container.encode(self.acronym, forKey: ._acronym) |
||||
try container.encode(self.phone, forKey: ._phone) |
||||
try container.encode(self.code, forKey: ._code) |
||||
try container.encode(self.address, forKey: ._address) |
||||
try container.encode(self.city, forKey: ._city) |
||||
try container.encode(self.zipCode, forKey: ._zipCode) |
||||
try container.encode(self.latitude, forKey: ._latitude) |
||||
try container.encode(self.longitude, forKey: ._longitude) |
||||
try container.encode(self.courtCount, forKey: ._courtCount) |
||||
try container.encode(self.broadcastCode, forKey: ._broadcastCode) |
||||
} |
||||
|
||||
func creatorValue() -> CustomUser? { |
||||
guard let creator = self.creator else { return nil } |
||||
return Store.main.findById(creator) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let club = other as? BaseClub else { return } |
||||
self.id = club.id |
||||
self.lastUpdate = club.lastUpdate |
||||
self.creator = club.creator |
||||
self.name = club.name |
||||
self.acronym = club.acronym |
||||
self.phone = club.phone |
||||
self.code = club.code |
||||
self.address = club.address |
||||
self.city = club.city |
||||
self.zipCode = club.zipCode |
||||
self.latitude = club.latitude |
||||
self.longitude = club.longitude |
||||
self.courtCount = club.courtCount |
||||
self.broadcastCode = club.broadcastCode |
||||
} |
||||
} |
||||
@ -0,0 +1,89 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseCourt: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "courts" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var index: Int = 0 |
||||
var club: String = "" |
||||
var name: String? = nil |
||||
var exitAllowed: Bool = false |
||||
var indoor: Bool = false |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
index: Int = 0, |
||||
club: String = "", |
||||
name: String? = nil, |
||||
exitAllowed: Bool = false, |
||||
indoor: Bool = false |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.index = index |
||||
self.club = club |
||||
self.name = name |
||||
self.exitAllowed = exitAllowed |
||||
self.indoor = indoor |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _index = "index" |
||||
case _club = "club" |
||||
case _name = "name" |
||||
case _exitAllowed = "exitAllowed" |
||||
case _indoor = "indoor" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.index = try container.decodeIfPresent(Int.self, forKey: ._index) ?? 0 |
||||
self.club = try container.decodeIfPresent(String.self, forKey: ._club) ?? "" |
||||
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil |
||||
self.exitAllowed = try container.decodeIfPresent(Bool.self, forKey: ._exitAllowed) ?? false |
||||
self.indoor = try container.decodeIfPresent(Bool.self, forKey: ._indoor) ?? false |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.index, forKey: ._index) |
||||
try container.encode(self.club, forKey: ._club) |
||||
try container.encode(self.name, forKey: ._name) |
||||
try container.encode(self.exitAllowed, forKey: ._exitAllowed) |
||||
try container.encode(self.indoor, forKey: ._indoor) |
||||
} |
||||
|
||||
func clubValue() -> Club? { |
||||
return Store.main.findById(club) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let court = other as? BaseCourt else { return } |
||||
self.id = court.id |
||||
self.lastUpdate = court.lastUpdate |
||||
self.index = court.index |
||||
self.club = court.club |
||||
self.name = court.name |
||||
self.exitAllowed = court.exitAllowed |
||||
self.indoor = court.indoor |
||||
} |
||||
} |
||||
@ -0,0 +1,197 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseCustomUser: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "users" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [.post] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var username: String = "" |
||||
var email: String = "" |
||||
var clubs: [String] = [] |
||||
var umpireCode: String? = nil |
||||
var licenceId: String? = nil |
||||
var firstName: String = "" |
||||
var lastName: String = "" |
||||
var phone: String? = nil |
||||
var country: String? = nil |
||||
var summonsMessageBody: String? = nil |
||||
var summonsMessageSignature: String? = nil |
||||
var summonsAvailablePaymentMethods: String? = nil |
||||
var summonsDisplayFormat: Bool = false |
||||
var summonsDisplayEntryFee: Bool = false |
||||
var summonsUseFullCustomMessage: Bool = false |
||||
var matchFormatsDefaultDuration: [MatchFormat: Int]? = nil |
||||
var bracketMatchFormatPreference: MatchFormat? = nil |
||||
var groupStageMatchFormatPreference: MatchFormat? = nil |
||||
var loserBracketMatchFormatPreference: MatchFormat? = nil |
||||
var loserBracketMode: LoserBracketMode = .automatic |
||||
var deviceId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
username: String = "", |
||||
email: String = "", |
||||
clubs: [String] = [], |
||||
umpireCode: String? = nil, |
||||
licenceId: String? = nil, |
||||
firstName: String = "", |
||||
lastName: String = "", |
||||
phone: String? = nil, |
||||
country: String? = nil, |
||||
summonsMessageBody: String? = nil, |
||||
summonsMessageSignature: String? = nil, |
||||
summonsAvailablePaymentMethods: String? = nil, |
||||
summonsDisplayFormat: Bool = false, |
||||
summonsDisplayEntryFee: Bool = false, |
||||
summonsUseFullCustomMessage: Bool = false, |
||||
matchFormatsDefaultDuration: [MatchFormat: Int]? = nil, |
||||
bracketMatchFormatPreference: MatchFormat? = nil, |
||||
groupStageMatchFormatPreference: MatchFormat? = nil, |
||||
loserBracketMatchFormatPreference: MatchFormat? = nil, |
||||
loserBracketMode: LoserBracketMode = .automatic, |
||||
deviceId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.username = username |
||||
self.email = email |
||||
self.clubs = clubs |
||||
self.umpireCode = umpireCode |
||||
self.licenceId = licenceId |
||||
self.firstName = firstName |
||||
self.lastName = lastName |
||||
self.phone = phone |
||||
self.country = country |
||||
self.summonsMessageBody = summonsMessageBody |
||||
self.summonsMessageSignature = summonsMessageSignature |
||||
self.summonsAvailablePaymentMethods = summonsAvailablePaymentMethods |
||||
self.summonsDisplayFormat = summonsDisplayFormat |
||||
self.summonsDisplayEntryFee = summonsDisplayEntryFee |
||||
self.summonsUseFullCustomMessage = summonsUseFullCustomMessage |
||||
self.matchFormatsDefaultDuration = matchFormatsDefaultDuration |
||||
self.bracketMatchFormatPreference = bracketMatchFormatPreference |
||||
self.groupStageMatchFormatPreference = groupStageMatchFormatPreference |
||||
self.loserBracketMatchFormatPreference = loserBracketMatchFormatPreference |
||||
self.loserBracketMode = loserBracketMode |
||||
self.deviceId = deviceId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _username = "username" |
||||
case _email = "email" |
||||
case _clubs = "clubs" |
||||
case _umpireCode = "umpireCode" |
||||
case _licenceId = "licenceId" |
||||
case _firstName = "firstName" |
||||
case _lastName = "lastName" |
||||
case _phone = "phone" |
||||
case _country = "country" |
||||
case _summonsMessageBody = "summonsMessageBody" |
||||
case _summonsMessageSignature = "summonsMessageSignature" |
||||
case _summonsAvailablePaymentMethods = "summonsAvailablePaymentMethods" |
||||
case _summonsDisplayFormat = "summonsDisplayFormat" |
||||
case _summonsDisplayEntryFee = "summonsDisplayEntryFee" |
||||
case _summonsUseFullCustomMessage = "summonsUseFullCustomMessage" |
||||
case _matchFormatsDefaultDuration = "matchFormatsDefaultDuration" |
||||
case _bracketMatchFormatPreference = "bracketMatchFormatPreference" |
||||
case _groupStageMatchFormatPreference = "groupStageMatchFormatPreference" |
||||
case _loserBracketMatchFormatPreference = "loserBracketMatchFormatPreference" |
||||
case _loserBracketMode = "loserBracketMode" |
||||
case _deviceId = "deviceId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.username = try container.decodeIfPresent(String.self, forKey: ._username) ?? "" |
||||
self.email = try container.decodeIfPresent(String.self, forKey: ._email) ?? "" |
||||
self.clubs = try container.decodeIfPresent([String].self, forKey: ._clubs) ?? [] |
||||
self.umpireCode = try container.decodeIfPresent(String.self, forKey: ._umpireCode) ?? nil |
||||
self.licenceId = try container.decodeIfPresent(String.self, forKey: ._licenceId) ?? nil |
||||
self.firstName = try container.decodeIfPresent(String.self, forKey: ._firstName) ?? "" |
||||
self.lastName = try container.decodeIfPresent(String.self, forKey: ._lastName) ?? "" |
||||
self.phone = try container.decodeIfPresent(String.self, forKey: ._phone) ?? nil |
||||
self.country = try container.decodeIfPresent(String.self, forKey: ._country) ?? nil |
||||
self.summonsMessageBody = try container.decodeIfPresent(String.self, forKey: ._summonsMessageBody) ?? nil |
||||
self.summonsMessageSignature = try container.decodeIfPresent(String.self, forKey: ._summonsMessageSignature) ?? nil |
||||
self.summonsAvailablePaymentMethods = try container.decodeIfPresent(String.self, forKey: ._summonsAvailablePaymentMethods) ?? nil |
||||
self.summonsDisplayFormat = try container.decodeIfPresent(Bool.self, forKey: ._summonsDisplayFormat) ?? false |
||||
self.summonsDisplayEntryFee = try container.decodeIfPresent(Bool.self, forKey: ._summonsDisplayEntryFee) ?? false |
||||
self.summonsUseFullCustomMessage = try container.decodeIfPresent(Bool.self, forKey: ._summonsUseFullCustomMessage) ?? false |
||||
self.matchFormatsDefaultDuration = try container.decodeIfPresent([MatchFormat: Int].self, forKey: ._matchFormatsDefaultDuration) ?? nil |
||||
self.bracketMatchFormatPreference = try container.decodeIfPresent(MatchFormat.self, forKey: ._bracketMatchFormatPreference) ?? nil |
||||
self.groupStageMatchFormatPreference = try container.decodeIfPresent(MatchFormat.self, forKey: ._groupStageMatchFormatPreference) ?? nil |
||||
self.loserBracketMatchFormatPreference = try container.decodeIfPresent(MatchFormat.self, forKey: ._loserBracketMatchFormatPreference) ?? nil |
||||
self.loserBracketMode = try container.decodeIfPresent(LoserBracketMode.self, forKey: ._loserBracketMode) ?? .automatic |
||||
self.deviceId = try container.decodeIfPresent(String.self, forKey: ._deviceId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.username, forKey: ._username) |
||||
try container.encode(self.email, forKey: ._email) |
||||
try container.encode(self.clubs, forKey: ._clubs) |
||||
try container.encode(self.umpireCode, forKey: ._umpireCode) |
||||
try container.encode(self.licenceId, forKey: ._licenceId) |
||||
try container.encode(self.firstName, forKey: ._firstName) |
||||
try container.encode(self.lastName, forKey: ._lastName) |
||||
try container.encode(self.phone, forKey: ._phone) |
||||
try container.encode(self.country, forKey: ._country) |
||||
try container.encode(self.summonsMessageBody, forKey: ._summonsMessageBody) |
||||
try container.encode(self.summonsMessageSignature, forKey: ._summonsMessageSignature) |
||||
try container.encode(self.summonsAvailablePaymentMethods, forKey: ._summonsAvailablePaymentMethods) |
||||
try container.encode(self.summonsDisplayFormat, forKey: ._summonsDisplayFormat) |
||||
try container.encode(self.summonsDisplayEntryFee, forKey: ._summonsDisplayEntryFee) |
||||
try container.encode(self.summonsUseFullCustomMessage, forKey: ._summonsUseFullCustomMessage) |
||||
try container.encode(self.matchFormatsDefaultDuration, forKey: ._matchFormatsDefaultDuration) |
||||
try container.encode(self.bracketMatchFormatPreference, forKey: ._bracketMatchFormatPreference) |
||||
try container.encode(self.groupStageMatchFormatPreference, forKey: ._groupStageMatchFormatPreference) |
||||
try container.encode(self.loserBracketMatchFormatPreference, forKey: ._loserBracketMatchFormatPreference) |
||||
try container.encode(self.loserBracketMode, forKey: ._loserBracketMode) |
||||
try container.encode(self.deviceId, forKey: ._deviceId) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let customuser = other as? BaseCustomUser else { return } |
||||
self.id = customuser.id |
||||
self.lastUpdate = customuser.lastUpdate |
||||
self.username = customuser.username |
||||
self.email = customuser.email |
||||
self.clubs = customuser.clubs |
||||
self.umpireCode = customuser.umpireCode |
||||
self.licenceId = customuser.licenceId |
||||
self.firstName = customuser.firstName |
||||
self.lastName = customuser.lastName |
||||
self.phone = customuser.phone |
||||
self.country = customuser.country |
||||
self.summonsMessageBody = customuser.summonsMessageBody |
||||
self.summonsMessageSignature = customuser.summonsMessageSignature |
||||
self.summonsAvailablePaymentMethods = customuser.summonsAvailablePaymentMethods |
||||
self.summonsDisplayFormat = customuser.summonsDisplayFormat |
||||
self.summonsDisplayEntryFee = customuser.summonsDisplayEntryFee |
||||
self.summonsUseFullCustomMessage = customuser.summonsUseFullCustomMessage |
||||
self.matchFormatsDefaultDuration = customuser.matchFormatsDefaultDuration |
||||
self.bracketMatchFormatPreference = customuser.bracketMatchFormatPreference |
||||
self.groupStageMatchFormatPreference = customuser.groupStageMatchFormatPreference |
||||
self.loserBracketMatchFormatPreference = customuser.loserBracketMatchFormatPreference |
||||
self.loserBracketMode = customuser.loserBracketMode |
||||
self.deviceId = customuser.deviceId |
||||
} |
||||
} |
||||
@ -0,0 +1,78 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseDateInterval: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "date-intervals" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var event: String = "" |
||||
var courtIndex: Int = 0 |
||||
var startDate: Date = Date() |
||||
var endDate: Date = Date() |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
event: String = "", |
||||
courtIndex: Int = 0, |
||||
startDate: Date = Date(), |
||||
endDate: Date = Date() |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.event = event |
||||
self.courtIndex = courtIndex |
||||
self.startDate = startDate |
||||
self.endDate = endDate |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _event = "event" |
||||
case _courtIndex = "courtIndex" |
||||
case _startDate = "startDate" |
||||
case _endDate = "endDate" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.event = try container.decodeIfPresent(String.self, forKey: ._event) ?? "" |
||||
self.courtIndex = try container.decodeIfPresent(Int.self, forKey: ._courtIndex) ?? 0 |
||||
self.startDate = try container.decodeIfPresent(Date.self, forKey: ._startDate) ?? Date() |
||||
self.endDate = try container.decodeIfPresent(Date.self, forKey: ._endDate) ?? Date() |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.event, forKey: ._event) |
||||
try container.encode(self.courtIndex, forKey: ._courtIndex) |
||||
try container.encode(self.startDate, forKey: ._startDate) |
||||
try container.encode(self.endDate, forKey: ._endDate) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let dateinterval = other as? BaseDateInterval else { return } |
||||
self.id = dateinterval.id |
||||
self.lastUpdate = dateinterval.lastUpdate |
||||
self.event = dateinterval.event |
||||
self.courtIndex = dateinterval.courtIndex |
||||
self.startDate = dateinterval.startDate |
||||
self.endDate = dateinterval.endDate |
||||
} |
||||
} |
||||
@ -0,0 +1,95 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseEvent: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "events" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var creator: String? = nil |
||||
var club: String? = nil |
||||
var creationDate: Date = Date() |
||||
var name: String? = nil |
||||
var tenupId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
creator: String? = nil, |
||||
club: String? = nil, |
||||
creationDate: Date = Date(), |
||||
name: String? = nil, |
||||
tenupId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.creator = creator |
||||
self.club = club |
||||
self.creationDate = creationDate |
||||
self.name = name |
||||
self.tenupId = tenupId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _creator = "creator" |
||||
case _club = "club" |
||||
case _creationDate = "creationDate" |
||||
case _name = "name" |
||||
case _tenupId = "tenupId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.creator = try container.decodeIfPresent(String.self, forKey: ._creator) ?? nil |
||||
self.club = try container.decodeIfPresent(String.self, forKey: ._club) ?? nil |
||||
self.creationDate = try container.decodeIfPresent(Date.self, forKey: ._creationDate) ?? Date() |
||||
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil |
||||
self.tenupId = try container.decodeIfPresent(String.self, forKey: ._tenupId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.creator, forKey: ._creator) |
||||
try container.encode(self.club, forKey: ._club) |
||||
try container.encode(self.creationDate, forKey: ._creationDate) |
||||
try container.encode(self.name, forKey: ._name) |
||||
try container.encode(self.tenupId, forKey: ._tenupId) |
||||
} |
||||
|
||||
func creatorValue() -> CustomUser? { |
||||
guard let creator = self.creator else { return nil } |
||||
return Store.main.findById(creator) |
||||
} |
||||
|
||||
func clubValue() -> Club? { |
||||
guard let club = self.club else { return nil } |
||||
return Store.main.findById(club) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let event = other as? BaseEvent else { return } |
||||
self.id = event.id |
||||
self.lastUpdate = event.lastUpdate |
||||
self.creator = event.creator |
||||
self.club = event.club |
||||
self.creationDate = event.creationDate |
||||
self.name = event.name |
||||
self.tenupId = event.tenupId |
||||
} |
||||
} |
||||
@ -0,0 +1,110 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseGroupStage: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "group-stages" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return true } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var tournament: String = "" |
||||
var index: Int = 0 |
||||
var size: Int = 0 |
||||
var format: MatchFormat? = nil |
||||
var startDate: Date? = nil |
||||
var name: String? = nil |
||||
var step: Int = 0 |
||||
var storeId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
tournament: String = "", |
||||
index: Int = 0, |
||||
size: Int = 0, |
||||
format: MatchFormat? = nil, |
||||
startDate: Date? = nil, |
||||
name: String? = nil, |
||||
step: Int = 0, |
||||
storeId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.tournament = tournament |
||||
self.index = index |
||||
self.size = size |
||||
self.format = format |
||||
self.startDate = startDate |
||||
self.name = name |
||||
self.step = step |
||||
self.storeId = storeId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _tournament = "tournament" |
||||
case _index = "index" |
||||
case _size = "size" |
||||
case _format = "format" |
||||
case _startDate = "startDate" |
||||
case _name = "name" |
||||
case _step = "step" |
||||
case _storeId = "storeId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.tournament = try container.decodeIfPresent(String.self, forKey: ._tournament) ?? "" |
||||
self.index = try container.decodeIfPresent(Int.self, forKey: ._index) ?? 0 |
||||
self.size = try container.decodeIfPresent(Int.self, forKey: ._size) ?? 0 |
||||
self.format = try container.decodeIfPresent(MatchFormat.self, forKey: ._format) ?? nil |
||||
self.startDate = try container.decodeIfPresent(Date.self, forKey: ._startDate) ?? nil |
||||
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil |
||||
self.step = try container.decodeIfPresent(Int.self, forKey: ._step) ?? 0 |
||||
self.storeId = try container.decodeIfPresent(String.self, forKey: ._storeId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.tournament, forKey: ._tournament) |
||||
try container.encode(self.index, forKey: ._index) |
||||
try container.encode(self.size, forKey: ._size) |
||||
try container.encode(self.format, forKey: ._format) |
||||
try container.encode(self.startDate, forKey: ._startDate) |
||||
try container.encode(self.name, forKey: ._name) |
||||
try container.encode(self.step, forKey: ._step) |
||||
try container.encode(self.storeId, forKey: ._storeId) |
||||
} |
||||
|
||||
func tournamentValue() -> Tournament? { |
||||
return Store.main.findById(tournament) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let groupstage = other as? BaseGroupStage else { return } |
||||
self.id = groupstage.id |
||||
self.lastUpdate = groupstage.lastUpdate |
||||
self.tournament = groupstage.tournament |
||||
self.index = groupstage.index |
||||
self.size = groupstage.size |
||||
self.format = groupstage.format |
||||
self.startDate = groupstage.startDate |
||||
self.name = groupstage.name |
||||
self.step = groupstage.step |
||||
self.storeId = groupstage.storeId |
||||
} |
||||
} |
||||
@ -0,0 +1,158 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseMatch: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "matches" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return true } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var round: String? = nil |
||||
var groupStage: String? = nil |
||||
var startDate: Date? = nil |
||||
var endDate: Date? = nil |
||||
var index: Int = 0 |
||||
var format: MatchFormat? = nil |
||||
var servingTeamId: String? = nil |
||||
var winningTeamId: String? = nil |
||||
var losingTeamId: String? = nil |
||||
var name: String? = nil |
||||
var disabled: Bool = false |
||||
var courtIndex: Int? = nil |
||||
var confirmed: Bool = false |
||||
var storeId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
round: String? = nil, |
||||
groupStage: String? = nil, |
||||
startDate: Date? = nil, |
||||
endDate: Date? = nil, |
||||
index: Int = 0, |
||||
format: MatchFormat? = nil, |
||||
servingTeamId: String? = nil, |
||||
winningTeamId: String? = nil, |
||||
losingTeamId: String? = nil, |
||||
name: String? = nil, |
||||
disabled: Bool = false, |
||||
courtIndex: Int? = nil, |
||||
confirmed: Bool = false, |
||||
storeId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.round = round |
||||
self.groupStage = groupStage |
||||
self.startDate = startDate |
||||
self.endDate = endDate |
||||
self.index = index |
||||
self.format = format |
||||
self.servingTeamId = servingTeamId |
||||
self.winningTeamId = winningTeamId |
||||
self.losingTeamId = losingTeamId |
||||
self.name = name |
||||
self.disabled = disabled |
||||
self.courtIndex = courtIndex |
||||
self.confirmed = confirmed |
||||
self.storeId = storeId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _round = "round" |
||||
case _groupStage = "groupStage" |
||||
case _startDate = "startDate" |
||||
case _endDate = "endDate" |
||||
case _index = "index" |
||||
case _format = "format" |
||||
case _servingTeamId = "servingTeamId" |
||||
case _winningTeamId = "winningTeamId" |
||||
case _losingTeamId = "losingTeamId" |
||||
case _name = "name" |
||||
case _disabled = "disabled" |
||||
case _courtIndex = "courtIndex" |
||||
case _confirmed = "confirmed" |
||||
case _storeId = "storeId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.round = try container.decodeIfPresent(String.self, forKey: ._round) ?? nil |
||||
self.groupStage = try container.decodeIfPresent(String.self, forKey: ._groupStage) ?? nil |
||||
self.startDate = try container.decodeIfPresent(Date.self, forKey: ._startDate) ?? nil |
||||
self.endDate = try container.decodeIfPresent(Date.self, forKey: ._endDate) ?? nil |
||||
self.index = try container.decodeIfPresent(Int.self, forKey: ._index) ?? 0 |
||||
self.format = try container.decodeIfPresent(MatchFormat.self, forKey: ._format) ?? nil |
||||
self.servingTeamId = try container.decodeIfPresent(String.self, forKey: ._servingTeamId) ?? nil |
||||
self.winningTeamId = try container.decodeIfPresent(String.self, forKey: ._winningTeamId) ?? nil |
||||
self.losingTeamId = try container.decodeIfPresent(String.self, forKey: ._losingTeamId) ?? nil |
||||
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil |
||||
self.disabled = try container.decodeIfPresent(Bool.self, forKey: ._disabled) ?? false |
||||
self.courtIndex = try container.decodeIfPresent(Int.self, forKey: ._courtIndex) ?? nil |
||||
self.confirmed = try container.decodeIfPresent(Bool.self, forKey: ._confirmed) ?? false |
||||
self.storeId = try container.decodeIfPresent(String.self, forKey: ._storeId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.round, forKey: ._round) |
||||
try container.encode(self.groupStage, forKey: ._groupStage) |
||||
try container.encode(self.startDate, forKey: ._startDate) |
||||
try container.encode(self.endDate, forKey: ._endDate) |
||||
try container.encode(self.index, forKey: ._index) |
||||
try container.encode(self.format, forKey: ._format) |
||||
try container.encode(self.servingTeamId, forKey: ._servingTeamId) |
||||
try container.encode(self.winningTeamId, forKey: ._winningTeamId) |
||||
try container.encode(self.losingTeamId, forKey: ._losingTeamId) |
||||
try container.encode(self.name, forKey: ._name) |
||||
try container.encode(self.disabled, forKey: ._disabled) |
||||
try container.encode(self.courtIndex, forKey: ._courtIndex) |
||||
try container.encode(self.confirmed, forKey: ._confirmed) |
||||
try container.encode(self.storeId, forKey: ._storeId) |
||||
} |
||||
|
||||
func roundValue() -> Round? { |
||||
guard let round = self.round else { return nil } |
||||
return self.store?.findById(round) |
||||
} |
||||
|
||||
func groupStageValue() -> GroupStage? { |
||||
guard let groupStage = self.groupStage else { return nil } |
||||
return self.store?.findById(groupStage) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let match = other as? BaseMatch else { return } |
||||
self.id = match.id |
||||
self.lastUpdate = match.lastUpdate |
||||
self.round = match.round |
||||
self.groupStage = match.groupStage |
||||
self.startDate = match.startDate |
||||
self.endDate = match.endDate |
||||
self.index = match.index |
||||
self.format = match.format |
||||
self.servingTeamId = match.servingTeamId |
||||
self.winningTeamId = match.winningTeamId |
||||
self.losingTeamId = match.losingTeamId |
||||
self.name = match.name |
||||
self.disabled = match.disabled |
||||
self.courtIndex = match.courtIndex |
||||
self.confirmed = match.confirmed |
||||
self.storeId = match.storeId |
||||
} |
||||
} |
||||
@ -0,0 +1,138 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseMatchScheduler: ModelObject, Storable, Codable { |
||||
|
||||
static func resourceName() -> String { return "match-schedulers" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var tournament: String = "" |
||||
var timeDifferenceLimit: Int = 0 |
||||
var loserBracketRotationDifference: Int = 0 |
||||
var upperBracketRotationDifference: Int = 0 |
||||
var accountUpperBracketBreakTime: Bool = false |
||||
var accountLoserBracketBreakTime: Bool = false |
||||
var randomizeCourts: Bool = false |
||||
var rotationDifferenceIsImportant: Bool = false |
||||
var shouldHandleUpperRoundSlice: Bool = false |
||||
var shouldEndRoundBeforeStartingNext: Bool = false |
||||
var groupStageChunkCount: Int? = nil |
||||
var overrideCourtsUnavailability: Bool = false |
||||
var shouldTryToFillUpCourtsAvailable: Bool = false |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
tournament: String = "", |
||||
timeDifferenceLimit: Int = 0, |
||||
loserBracketRotationDifference: Int = 0, |
||||
upperBracketRotationDifference: Int = 0, |
||||
accountUpperBracketBreakTime: Bool = false, |
||||
accountLoserBracketBreakTime: Bool = false, |
||||
randomizeCourts: Bool = false, |
||||
rotationDifferenceIsImportant: Bool = false, |
||||
shouldHandleUpperRoundSlice: Bool = false, |
||||
shouldEndRoundBeforeStartingNext: Bool = false, |
||||
groupStageChunkCount: Int? = nil, |
||||
overrideCourtsUnavailability: Bool = false, |
||||
shouldTryToFillUpCourtsAvailable: Bool = false |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.tournament = tournament |
||||
self.timeDifferenceLimit = timeDifferenceLimit |
||||
self.loserBracketRotationDifference = loserBracketRotationDifference |
||||
self.upperBracketRotationDifference = upperBracketRotationDifference |
||||
self.accountUpperBracketBreakTime = accountUpperBracketBreakTime |
||||
self.accountLoserBracketBreakTime = accountLoserBracketBreakTime |
||||
self.randomizeCourts = randomizeCourts |
||||
self.rotationDifferenceIsImportant = rotationDifferenceIsImportant |
||||
self.shouldHandleUpperRoundSlice = shouldHandleUpperRoundSlice |
||||
self.shouldEndRoundBeforeStartingNext = shouldEndRoundBeforeStartingNext |
||||
self.groupStageChunkCount = groupStageChunkCount |
||||
self.overrideCourtsUnavailability = overrideCourtsUnavailability |
||||
self.shouldTryToFillUpCourtsAvailable = shouldTryToFillUpCourtsAvailable |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _tournament = "tournament" |
||||
case _timeDifferenceLimit = "timeDifferenceLimit" |
||||
case _loserBracketRotationDifference = "loserBracketRotationDifference" |
||||
case _upperBracketRotationDifference = "upperBracketRotationDifference" |
||||
case _accountUpperBracketBreakTime = "accountUpperBracketBreakTime" |
||||
case _accountLoserBracketBreakTime = "accountLoserBracketBreakTime" |
||||
case _randomizeCourts = "randomizeCourts" |
||||
case _rotationDifferenceIsImportant = "rotationDifferenceIsImportant" |
||||
case _shouldHandleUpperRoundSlice = "shouldHandleUpperRoundSlice" |
||||
case _shouldEndRoundBeforeStartingNext = "shouldEndRoundBeforeStartingNext" |
||||
case _groupStageChunkCount = "groupStageChunkCount" |
||||
case _overrideCourtsUnavailability = "overrideCourtsUnavailability" |
||||
case _shouldTryToFillUpCourtsAvailable = "shouldTryToFillUpCourtsAvailable" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.tournament = try container.decodeIfPresent(String.self, forKey: ._tournament) ?? "" |
||||
self.timeDifferenceLimit = try container.decodeIfPresent(Int.self, forKey: ._timeDifferenceLimit) ?? 0 |
||||
self.loserBracketRotationDifference = try container.decodeIfPresent(Int.self, forKey: ._loserBracketRotationDifference) ?? 0 |
||||
self.upperBracketRotationDifference = try container.decodeIfPresent(Int.self, forKey: ._upperBracketRotationDifference) ?? 0 |
||||
self.accountUpperBracketBreakTime = try container.decodeIfPresent(Bool.self, forKey: ._accountUpperBracketBreakTime) ?? false |
||||
self.accountLoserBracketBreakTime = try container.decodeIfPresent(Bool.self, forKey: ._accountLoserBracketBreakTime) ?? false |
||||
self.randomizeCourts = try container.decodeIfPresent(Bool.self, forKey: ._randomizeCourts) ?? false |
||||
self.rotationDifferenceIsImportant = try container.decodeIfPresent(Bool.self, forKey: ._rotationDifferenceIsImportant) ?? false |
||||
self.shouldHandleUpperRoundSlice = try container.decodeIfPresent(Bool.self, forKey: ._shouldHandleUpperRoundSlice) ?? false |
||||
self.shouldEndRoundBeforeStartingNext = try container.decodeIfPresent(Bool.self, forKey: ._shouldEndRoundBeforeStartingNext) ?? false |
||||
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 |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.tournament, forKey: ._tournament) |
||||
try container.encode(self.timeDifferenceLimit, forKey: ._timeDifferenceLimit) |
||||
try container.encode(self.loserBracketRotationDifference, forKey: ._loserBracketRotationDifference) |
||||
try container.encode(self.upperBracketRotationDifference, forKey: ._upperBracketRotationDifference) |
||||
try container.encode(self.accountUpperBracketBreakTime, forKey: ._accountUpperBracketBreakTime) |
||||
try container.encode(self.accountLoserBracketBreakTime, forKey: ._accountLoserBracketBreakTime) |
||||
try container.encode(self.randomizeCourts, forKey: ._randomizeCourts) |
||||
try container.encode(self.rotationDifferenceIsImportant, forKey: ._rotationDifferenceIsImportant) |
||||
try container.encode(self.shouldHandleUpperRoundSlice, forKey: ._shouldHandleUpperRoundSlice) |
||||
try container.encode(self.shouldEndRoundBeforeStartingNext, forKey: ._shouldEndRoundBeforeStartingNext) |
||||
try container.encode(self.groupStageChunkCount, forKey: ._groupStageChunkCount) |
||||
try container.encode(self.overrideCourtsUnavailability, forKey: ._overrideCourtsUnavailability) |
||||
try container.encode(self.shouldTryToFillUpCourtsAvailable, forKey: ._shouldTryToFillUpCourtsAvailable) |
||||
} |
||||
|
||||
func tournamentValue() -> Tournament? { |
||||
return Store.main.findById(tournament) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let matchscheduler = other as? BaseMatchScheduler else { return } |
||||
self.id = matchscheduler.id |
||||
self.tournament = matchscheduler.tournament |
||||
self.timeDifferenceLimit = matchscheduler.timeDifferenceLimit |
||||
self.loserBracketRotationDifference = matchscheduler.loserBracketRotationDifference |
||||
self.upperBracketRotationDifference = matchscheduler.upperBracketRotationDifference |
||||
self.accountUpperBracketBreakTime = matchscheduler.accountUpperBracketBreakTime |
||||
self.accountLoserBracketBreakTime = matchscheduler.accountLoserBracketBreakTime |
||||
self.randomizeCourts = matchscheduler.randomizeCourts |
||||
self.rotationDifferenceIsImportant = matchscheduler.rotationDifferenceIsImportant |
||||
self.shouldHandleUpperRoundSlice = matchscheduler.shouldHandleUpperRoundSlice |
||||
self.shouldEndRoundBeforeStartingNext = matchscheduler.shouldEndRoundBeforeStartingNext |
||||
self.groupStageChunkCount = matchscheduler.groupStageChunkCount |
||||
self.overrideCourtsUnavailability = matchscheduler.overrideCourtsUnavailability |
||||
self.shouldTryToFillUpCourtsAvailable = matchscheduler.shouldTryToFillUpCourtsAvailable |
||||
} |
||||
} |
||||
@ -0,0 +1,113 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseMonthData: ModelObject, Storable, Codable { |
||||
|
||||
static func resourceName() -> String { return "month-datas" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var monthKey: String = "" |
||||
var creationDate: Date = Date() |
||||
var maleUnrankedValue: Int? = nil |
||||
var femaleUnrankedValue: Int? = nil |
||||
var maleCount: Int? = nil |
||||
var femaleCount: Int? = nil |
||||
var anonymousCount: Int? = nil |
||||
var incompleteMode: Bool = false |
||||
var dataModelIdentifier: String? = nil |
||||
var fileModelIdentifier: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
monthKey: String = "", |
||||
creationDate: Date = Date(), |
||||
maleUnrankedValue: Int? = nil, |
||||
femaleUnrankedValue: Int? = nil, |
||||
maleCount: Int? = nil, |
||||
femaleCount: Int? = nil, |
||||
anonymousCount: Int? = nil, |
||||
incompleteMode: Bool = false, |
||||
dataModelIdentifier: String? = nil, |
||||
fileModelIdentifier: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.monthKey = monthKey |
||||
self.creationDate = creationDate |
||||
self.maleUnrankedValue = maleUnrankedValue |
||||
self.femaleUnrankedValue = femaleUnrankedValue |
||||
self.maleCount = maleCount |
||||
self.femaleCount = femaleCount |
||||
self.anonymousCount = anonymousCount |
||||
self.incompleteMode = incompleteMode |
||||
self.dataModelIdentifier = dataModelIdentifier |
||||
self.fileModelIdentifier = fileModelIdentifier |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _monthKey = "monthKey" |
||||
case _creationDate = "creationDate" |
||||
case _maleUnrankedValue = "maleUnrankedValue" |
||||
case _femaleUnrankedValue = "femaleUnrankedValue" |
||||
case _maleCount = "maleCount" |
||||
case _femaleCount = "femaleCount" |
||||
case _anonymousCount = "anonymousCount" |
||||
case _incompleteMode = "incompleteMode" |
||||
case _dataModelIdentifier = "dataModelIdentifier" |
||||
case _fileModelIdentifier = "fileModelIdentifier" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.monthKey = try container.decodeIfPresent(String.self, forKey: ._monthKey) ?? "" |
||||
self.creationDate = try container.decodeIfPresent(Date.self, forKey: ._creationDate) ?? Date() |
||||
self.maleUnrankedValue = try container.decodeIfPresent(Int.self, forKey: ._maleUnrankedValue) ?? nil |
||||
self.femaleUnrankedValue = try container.decodeIfPresent(Int.self, forKey: ._femaleUnrankedValue) ?? nil |
||||
self.maleCount = try container.decodeIfPresent(Int.self, forKey: ._maleCount) ?? nil |
||||
self.femaleCount = try container.decodeIfPresent(Int.self, forKey: ._femaleCount) ?? nil |
||||
self.anonymousCount = try container.decodeIfPresent(Int.self, forKey: ._anonymousCount) ?? nil |
||||
self.incompleteMode = try container.decodeIfPresent(Bool.self, forKey: ._incompleteMode) ?? false |
||||
self.dataModelIdentifier = try container.decodeIfPresent(String.self, forKey: ._dataModelIdentifier) ?? nil |
||||
self.fileModelIdentifier = try container.decodeIfPresent(String.self, forKey: ._fileModelIdentifier) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.monthKey, forKey: ._monthKey) |
||||
try container.encode(self.creationDate, forKey: ._creationDate) |
||||
try container.encode(self.maleUnrankedValue, forKey: ._maleUnrankedValue) |
||||
try container.encode(self.femaleUnrankedValue, forKey: ._femaleUnrankedValue) |
||||
try container.encode(self.maleCount, forKey: ._maleCount) |
||||
try container.encode(self.femaleCount, forKey: ._femaleCount) |
||||
try container.encode(self.anonymousCount, forKey: ._anonymousCount) |
||||
try container.encode(self.incompleteMode, forKey: ._incompleteMode) |
||||
try container.encode(self.dataModelIdentifier, forKey: ._dataModelIdentifier) |
||||
try container.encode(self.fileModelIdentifier, forKey: ._fileModelIdentifier) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let monthdata = other as? BaseMonthData else { return } |
||||
self.id = monthdata.id |
||||
self.monthKey = monthdata.monthKey |
||||
self.creationDate = monthdata.creationDate |
||||
self.maleUnrankedValue = monthdata.maleUnrankedValue |
||||
self.femaleUnrankedValue = monthdata.femaleUnrankedValue |
||||
self.maleCount = monthdata.maleCount |
||||
self.femaleCount = monthdata.femaleCount |
||||
self.anonymousCount = monthdata.anonymousCount |
||||
self.incompleteMode = monthdata.incompleteMode |
||||
self.dataModelIdentifier = monthdata.dataModelIdentifier |
||||
self.fileModelIdentifier = monthdata.fileModelIdentifier |
||||
} |
||||
} |
||||
@ -0,0 +1,188 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BasePlayerRegistration: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "player-registrations" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return true } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var teamRegistration: String? = nil |
||||
var firstName: String = "" |
||||
var lastName: String = "" |
||||
var licenceId: String? = nil |
||||
var rank: Int? = nil |
||||
var paymentType: PlayerPaymentType? = nil |
||||
var sex: PlayerSexType? = nil |
||||
var tournamentPlayed: Int? = nil |
||||
var points: Double? = nil |
||||
var clubName: String? = nil |
||||
var ligueName: String? = nil |
||||
var assimilation: String? = nil |
||||
var phoneNumber: String? = nil |
||||
var email: String? = nil |
||||
var birthdate: String? = nil |
||||
var computedRank: Int = 0 |
||||
var source: PlayerDataSource? = nil |
||||
var hasArrived: Bool = false |
||||
var storeId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
teamRegistration: String? = nil, |
||||
firstName: String = "", |
||||
lastName: String = "", |
||||
licenceId: String? = nil, |
||||
rank: Int? = nil, |
||||
paymentType: PlayerPaymentType? = nil, |
||||
sex: PlayerSexType? = nil, |
||||
tournamentPlayed: Int? = nil, |
||||
points: Double? = nil, |
||||
clubName: String? = nil, |
||||
ligueName: String? = nil, |
||||
assimilation: String? = nil, |
||||
phoneNumber: String? = nil, |
||||
email: String? = nil, |
||||
birthdate: String? = nil, |
||||
computedRank: Int = 0, |
||||
source: PlayerDataSource? = nil, |
||||
hasArrived: Bool = false, |
||||
storeId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.teamRegistration = teamRegistration |
||||
self.firstName = firstName |
||||
self.lastName = lastName |
||||
self.licenceId = licenceId |
||||
self.rank = rank |
||||
self.paymentType = paymentType |
||||
self.sex = sex |
||||
self.tournamentPlayed = tournamentPlayed |
||||
self.points = points |
||||
self.clubName = clubName |
||||
self.ligueName = ligueName |
||||
self.assimilation = assimilation |
||||
self.phoneNumber = phoneNumber |
||||
self.email = email |
||||
self.birthdate = birthdate |
||||
self.computedRank = computedRank |
||||
self.source = source |
||||
self.hasArrived = hasArrived |
||||
self.storeId = storeId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _teamRegistration = "teamRegistration" |
||||
case _firstName = "firstName" |
||||
case _lastName = "lastName" |
||||
case _licenceId = "licenceId" |
||||
case _rank = "rank" |
||||
case _paymentType = "paymentType" |
||||
case _sex = "sex" |
||||
case _tournamentPlayed = "tournamentPlayed" |
||||
case _points = "points" |
||||
case _clubName = "clubName" |
||||
case _ligueName = "ligueName" |
||||
case _assimilation = "assimilation" |
||||
case _phoneNumber = "phoneNumber" |
||||
case _email = "email" |
||||
case _birthdate = "birthdate" |
||||
case _computedRank = "computedRank" |
||||
case _source = "source" |
||||
case _hasArrived = "hasArrived" |
||||
case _storeId = "storeId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.teamRegistration = try container.decodeIfPresent(String.self, forKey: ._teamRegistration) ?? nil |
||||
self.firstName = try container.decodeIfPresent(String.self, forKey: ._firstName) ?? "" |
||||
self.lastName = try container.decodeIfPresent(String.self, forKey: ._lastName) ?? "" |
||||
self.licenceId = try container.decodeIfPresent(String.self, forKey: ._licenceId) ?? nil |
||||
self.rank = try container.decodeIfPresent(Int.self, forKey: ._rank) ?? nil |
||||
self.paymentType = try container.decodeIfPresent(PlayerPaymentType.self, forKey: ._paymentType) ?? nil |
||||
self.sex = try container.decodeIfPresent(PlayerSexType.self, forKey: ._sex) ?? nil |
||||
self.tournamentPlayed = try container.decodeIfPresent(Int.self, forKey: ._tournamentPlayed) ?? nil |
||||
self.points = try container.decodeIfPresent(Double.self, forKey: ._points) ?? nil |
||||
self.clubName = try container.decodeIfPresent(String.self, forKey: ._clubName) ?? nil |
||||
self.ligueName = try container.decodeIfPresent(String.self, forKey: ._ligueName) ?? nil |
||||
self.assimilation = try container.decodeIfPresent(String.self, forKey: ._assimilation) ?? nil |
||||
self.phoneNumber = try container.decodeIfPresent(String.self, forKey: ._phoneNumber) ?? nil |
||||
self.email = try container.decodeIfPresent(String.self, forKey: ._email) ?? nil |
||||
self.birthdate = try container.decodeIfPresent(String.self, forKey: ._birthdate) ?? nil |
||||
self.computedRank = try container.decodeIfPresent(Int.self, forKey: ._computedRank) ?? 0 |
||||
self.source = try container.decodeIfPresent(PlayerDataSource.self, forKey: ._source) ?? nil |
||||
self.hasArrived = try container.decodeIfPresent(Bool.self, forKey: ._hasArrived) ?? false |
||||
self.storeId = try container.decodeIfPresent(String.self, forKey: ._storeId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.teamRegistration, forKey: ._teamRegistration) |
||||
try container.encode(self.firstName, forKey: ._firstName) |
||||
try container.encode(self.lastName, forKey: ._lastName) |
||||
try container.encode(self.licenceId, forKey: ._licenceId) |
||||
try container.encode(self.rank, forKey: ._rank) |
||||
try container.encode(self.paymentType, forKey: ._paymentType) |
||||
try container.encode(self.sex, forKey: ._sex) |
||||
try container.encode(self.tournamentPlayed, forKey: ._tournamentPlayed) |
||||
try container.encode(self.points, forKey: ._points) |
||||
try container.encode(self.clubName, forKey: ._clubName) |
||||
try container.encode(self.ligueName, forKey: ._ligueName) |
||||
try container.encode(self.assimilation, forKey: ._assimilation) |
||||
try container.encode(self.phoneNumber, forKey: ._phoneNumber) |
||||
try container.encode(self.email, forKey: ._email) |
||||
try container.encode(self.birthdate, forKey: ._birthdate) |
||||
try container.encode(self.computedRank, forKey: ._computedRank) |
||||
try container.encode(self.source, forKey: ._source) |
||||
try container.encode(self.hasArrived, forKey: ._hasArrived) |
||||
try container.encode(self.storeId, forKey: ._storeId) |
||||
} |
||||
|
||||
func teamRegistrationValue() -> TeamRegistration? { |
||||
guard let teamRegistration = self.teamRegistration else { return nil } |
||||
return Store.main.findById(teamRegistration) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let playerregistration = other as? BasePlayerRegistration else { return } |
||||
self.id = playerregistration.id |
||||
self.lastUpdate = playerregistration.lastUpdate |
||||
self.teamRegistration = playerregistration.teamRegistration |
||||
self.firstName = playerregistration.firstName |
||||
self.lastName = playerregistration.lastName |
||||
self.licenceId = playerregistration.licenceId |
||||
self.rank = playerregistration.rank |
||||
self.paymentType = playerregistration.paymentType |
||||
self.sex = playerregistration.sex |
||||
self.tournamentPlayed = playerregistration.tournamentPlayed |
||||
self.points = playerregistration.points |
||||
self.clubName = playerregistration.clubName |
||||
self.ligueName = playerregistration.ligueName |
||||
self.assimilation = playerregistration.assimilation |
||||
self.phoneNumber = playerregistration.phoneNumber |
||||
self.email = playerregistration.email |
||||
self.birthdate = playerregistration.birthdate |
||||
self.computedRank = playerregistration.computedRank |
||||
self.source = playerregistration.source |
||||
self.hasArrived = playerregistration.hasArrived |
||||
self.storeId = playerregistration.storeId |
||||
} |
||||
} |
||||
@ -0,0 +1,95 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
|
||||
class BasePurchase: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "purchases" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: UInt64 = 0 |
||||
var lastUpdate: Date = Date() |
||||
var user: String = "" |
||||
var purchaseDate: Date = Date() |
||||
var productId: String = "" |
||||
var quantity: Int? = nil |
||||
var revocationDate: Date? = nil |
||||
var expirationDate: Date? = nil |
||||
|
||||
init( |
||||
id: UInt64 = 0, |
||||
lastUpdate: Date = Date(), |
||||
user: String = "", |
||||
purchaseDate: Date = Date(), |
||||
productId: String = "", |
||||
quantity: Int? = nil, |
||||
revocationDate: Date? = nil, |
||||
expirationDate: Date? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.user = user |
||||
self.purchaseDate = purchaseDate |
||||
self.productId = productId |
||||
self.quantity = quantity |
||||
self.revocationDate = revocationDate |
||||
self.expirationDate = expirationDate |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case id = "id" |
||||
case lastUpdate = "lastUpdate" |
||||
case user = "user" |
||||
case purchaseDate = "purchaseDate" |
||||
case productId = "productId" |
||||
case quantity = "quantity" |
||||
case revocationDate = "revocationDate" |
||||
case expirationDate = "expirationDate" |
||||
} |
||||
|
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(UInt64.self, forKey: .id) ?? 0 |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: .lastUpdate) ?? Date() |
||||
self.user = try container.decodeEncrypted(key: .user) |
||||
self.purchaseDate = try container.decodeIfPresent(Date.self, forKey: .purchaseDate) ?? Date() |
||||
self.productId = try container.decodeIfPresent(String.self, forKey: .productId) ?? "" |
||||
self.quantity = try container.decodeIfPresent(Int.self, forKey: .quantity) ?? nil |
||||
self.revocationDate = try container.decodeIfPresent(Date.self, forKey: .revocationDate) ?? nil |
||||
self.expirationDate = try container.decodeIfPresent(Date.self, forKey: .expirationDate) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: .id) |
||||
try container.encode(self.lastUpdate, forKey: .lastUpdate) |
||||
try container.encodeAndEncryptIfPresent(self.user.data(using: .utf8), forKey: .user) |
||||
try container.encode(self.purchaseDate, forKey: .purchaseDate) |
||||
try container.encode(self.productId, forKey: .productId) |
||||
try container.encode(self.quantity, forKey: .quantity) |
||||
try container.encode(self.revocationDate, forKey: .revocationDate) |
||||
try container.encode(self.expirationDate, forKey: .expirationDate) |
||||
} |
||||
|
||||
func userValue() -> CustomUser? { |
||||
return Store.main.findById(user) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let purchase = other as? BasePurchase else { return } |
||||
self.id = purchase.id |
||||
self.lastUpdate = purchase.lastUpdate |
||||
self.user = purchase.user |
||||
self.purchaseDate = purchase.purchaseDate |
||||
self.productId = purchase.productId |
||||
self.quantity = purchase.quantity |
||||
self.revocationDate = purchase.revocationDate |
||||
self.expirationDate = purchase.expirationDate |
||||
} |
||||
} |
||||
@ -0,0 +1,110 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseRound: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "rounds" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return true } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var tournament: String = "" |
||||
var index: Int = 0 |
||||
var parent: String? = nil |
||||
var format: MatchFormat? = nil |
||||
var startDate: Date? = nil |
||||
var groupStageLoserBracket: Bool = false |
||||
var loserBracketMode: LoserBracketMode = .automatic |
||||
var storeId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
tournament: String = "", |
||||
index: Int = 0, |
||||
parent: String? = nil, |
||||
format: MatchFormat? = nil, |
||||
startDate: Date? = nil, |
||||
groupStageLoserBracket: Bool = false, |
||||
loserBracketMode: LoserBracketMode = .automatic, |
||||
storeId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.tournament = tournament |
||||
self.index = index |
||||
self.parent = parent |
||||
self.format = format |
||||
self.startDate = startDate |
||||
self.groupStageLoserBracket = groupStageLoserBracket |
||||
self.loserBracketMode = loserBracketMode |
||||
self.storeId = storeId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _tournament = "tournament" |
||||
case _index = "index" |
||||
case _parent = "parent" |
||||
case _format = "format" |
||||
case _startDate = "startDate" |
||||
case _groupStageLoserBracket = "groupStageLoserBracket" |
||||
case _loserBracketMode = "loserBracketMode" |
||||
case _storeId = "storeId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.tournament = try container.decodeIfPresent(String.self, forKey: ._tournament) ?? "" |
||||
self.index = try container.decodeIfPresent(Int.self, forKey: ._index) ?? 0 |
||||
self.parent = try container.decodeIfPresent(String.self, forKey: ._parent) ?? nil |
||||
self.format = try container.decodeIfPresent(MatchFormat.self, forKey: ._format) ?? nil |
||||
self.startDate = try container.decodeIfPresent(Date.self, forKey: ._startDate) ?? nil |
||||
self.groupStageLoserBracket = try container.decodeIfPresent(Bool.self, forKey: ._groupStageLoserBracket) ?? false |
||||
self.loserBracketMode = try container.decodeIfPresent(LoserBracketMode.self, forKey: ._loserBracketMode) ?? .automatic |
||||
self.storeId = try container.decodeIfPresent(String.self, forKey: ._storeId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.tournament, forKey: ._tournament) |
||||
try container.encode(self.index, forKey: ._index) |
||||
try container.encode(self.parent, forKey: ._parent) |
||||
try container.encode(self.format, forKey: ._format) |
||||
try container.encode(self.startDate, forKey: ._startDate) |
||||
try container.encode(self.groupStageLoserBracket, forKey: ._groupStageLoserBracket) |
||||
try container.encode(self.loserBracketMode, forKey: ._loserBracketMode) |
||||
try container.encode(self.storeId, forKey: ._storeId) |
||||
} |
||||
|
||||
func tournamentValue() -> Tournament? { |
||||
return Store.main.findById(tournament) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let round = other as? BaseRound else { return } |
||||
self.id = round.id |
||||
self.lastUpdate = round.lastUpdate |
||||
self.tournament = round.tournament |
||||
self.index = round.index |
||||
self.parent = round.parent |
||||
self.format = round.format |
||||
self.startDate = round.startDate |
||||
self.groupStageLoserBracket = round.groupStageLoserBracket |
||||
self.loserBracketMode = round.loserBracketMode |
||||
self.storeId = round.storeId |
||||
} |
||||
} |
||||
@ -0,0 +1,202 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseTeamRegistration: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "team-registrations" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return true } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var tournament: String = "" |
||||
var groupStage: String? = nil |
||||
var registrationDate: Date? = nil |
||||
var callDate: Date? = nil |
||||
var bracketPosition: Int? = nil |
||||
var groupStagePosition: Int? = nil |
||||
var comment: String? = nil |
||||
var source: String? = nil |
||||
var sourceValue: String? = nil |
||||
var logo: String? = nil |
||||
var name: String? = nil |
||||
var walkOut: Bool = false |
||||
var wildCardBracket: Bool = false |
||||
var wildCardGroupStage: Bool = false |
||||
var weight: Int = 0 |
||||
var lockedWeight: Int? = nil |
||||
var confirmationDate: Date? = nil |
||||
var qualified: Bool = false |
||||
var finalRanking: Int? = nil |
||||
var pointsEarned: Int? = nil |
||||
var storeId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
tournament: String = "", |
||||
groupStage: String? = nil, |
||||
registrationDate: Date? = nil, |
||||
callDate: Date? = nil, |
||||
bracketPosition: Int? = nil, |
||||
groupStagePosition: Int? = nil, |
||||
comment: String? = nil, |
||||
source: String? = nil, |
||||
sourceValue: String? = nil, |
||||
logo: String? = nil, |
||||
name: String? = nil, |
||||
walkOut: Bool = false, |
||||
wildCardBracket: Bool = false, |
||||
wildCardGroupStage: Bool = false, |
||||
weight: Int = 0, |
||||
lockedWeight: Int? = nil, |
||||
confirmationDate: Date? = nil, |
||||
qualified: Bool = false, |
||||
finalRanking: Int? = nil, |
||||
pointsEarned: Int? = nil, |
||||
storeId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.tournament = tournament |
||||
self.groupStage = groupStage |
||||
self.registrationDate = registrationDate |
||||
self.callDate = callDate |
||||
self.bracketPosition = bracketPosition |
||||
self.groupStagePosition = groupStagePosition |
||||
self.comment = comment |
||||
self.source = source |
||||
self.sourceValue = sourceValue |
||||
self.logo = logo |
||||
self.name = name |
||||
self.walkOut = walkOut |
||||
self.wildCardBracket = wildCardBracket |
||||
self.wildCardGroupStage = wildCardGroupStage |
||||
self.weight = weight |
||||
self.lockedWeight = lockedWeight |
||||
self.confirmationDate = confirmationDate |
||||
self.qualified = qualified |
||||
self.finalRanking = finalRanking |
||||
self.pointsEarned = pointsEarned |
||||
self.storeId = storeId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _tournament = "tournament" |
||||
case _groupStage = "groupStage" |
||||
case _registrationDate = "registrationDate" |
||||
case _callDate = "callDate" |
||||
case _bracketPosition = "bracketPosition" |
||||
case _groupStagePosition = "groupStagePosition" |
||||
case _comment = "comment" |
||||
case _source = "source" |
||||
case _sourceValue = "sourceValue" |
||||
case _logo = "logo" |
||||
case _name = "name" |
||||
case _walkOut = "walkOut" |
||||
case _wildCardBracket = "wildCardBracket" |
||||
case _wildCardGroupStage = "wildCardGroupStage" |
||||
case _weight = "weight" |
||||
case _lockedWeight = "lockedWeight" |
||||
case _confirmationDate = "confirmationDate" |
||||
case _qualified = "qualified" |
||||
case _finalRanking = "finalRanking" |
||||
case _pointsEarned = "pointsEarned" |
||||
case _storeId = "storeId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.tournament = try container.decodeIfPresent(String.self, forKey: ._tournament) ?? "" |
||||
self.groupStage = try container.decodeIfPresent(String.self, forKey: ._groupStage) ?? nil |
||||
self.registrationDate = try container.decodeIfPresent(Date.self, forKey: ._registrationDate) ?? nil |
||||
self.callDate = try container.decodeIfPresent(Date.self, forKey: ._callDate) ?? nil |
||||
self.bracketPosition = try container.decodeIfPresent(Int.self, forKey: ._bracketPosition) ?? nil |
||||
self.groupStagePosition = try container.decodeIfPresent(Int.self, forKey: ._groupStagePosition) ?? nil |
||||
self.comment = try container.decodeIfPresent(String.self, forKey: ._comment) ?? nil |
||||
self.source = try container.decodeIfPresent(String.self, forKey: ._source) ?? nil |
||||
self.sourceValue = try container.decodeIfPresent(String.self, forKey: ._sourceValue) ?? nil |
||||
self.logo = try container.decodeIfPresent(String.self, forKey: ._logo) ?? nil |
||||
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil |
||||
self.walkOut = try container.decodeIfPresent(Bool.self, forKey: ._walkOut) ?? false |
||||
self.wildCardBracket = try container.decodeIfPresent(Bool.self, forKey: ._wildCardBracket) ?? false |
||||
self.wildCardGroupStage = try container.decodeIfPresent(Bool.self, forKey: ._wildCardGroupStage) ?? false |
||||
self.weight = try container.decodeIfPresent(Int.self, forKey: ._weight) ?? 0 |
||||
self.lockedWeight = try container.decodeIfPresent(Int.self, forKey: ._lockedWeight) ?? nil |
||||
self.confirmationDate = try container.decodeIfPresent(Date.self, forKey: ._confirmationDate) ?? nil |
||||
self.qualified = try container.decodeIfPresent(Bool.self, forKey: ._qualified) ?? false |
||||
self.finalRanking = try container.decodeIfPresent(Int.self, forKey: ._finalRanking) ?? nil |
||||
self.pointsEarned = try container.decodeIfPresent(Int.self, forKey: ._pointsEarned) ?? nil |
||||
self.storeId = try container.decodeIfPresent(String.self, forKey: ._storeId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.tournament, forKey: ._tournament) |
||||
try container.encode(self.groupStage, forKey: ._groupStage) |
||||
try container.encode(self.registrationDate, forKey: ._registrationDate) |
||||
try container.encode(self.callDate, forKey: ._callDate) |
||||
try container.encode(self.bracketPosition, forKey: ._bracketPosition) |
||||
try container.encode(self.groupStagePosition, forKey: ._groupStagePosition) |
||||
try container.encode(self.comment, forKey: ._comment) |
||||
try container.encode(self.source, forKey: ._source) |
||||
try container.encode(self.sourceValue, forKey: ._sourceValue) |
||||
try container.encode(self.logo, forKey: ._logo) |
||||
try container.encode(self.name, forKey: ._name) |
||||
try container.encode(self.walkOut, forKey: ._walkOut) |
||||
try container.encode(self.wildCardBracket, forKey: ._wildCardBracket) |
||||
try container.encode(self.wildCardGroupStage, forKey: ._wildCardGroupStage) |
||||
try container.encode(self.weight, forKey: ._weight) |
||||
try container.encode(self.lockedWeight, forKey: ._lockedWeight) |
||||
try container.encode(self.confirmationDate, forKey: ._confirmationDate) |
||||
try container.encode(self.qualified, forKey: ._qualified) |
||||
try container.encode(self.finalRanking, forKey: ._finalRanking) |
||||
try container.encode(self.pointsEarned, forKey: ._pointsEarned) |
||||
try container.encode(self.storeId, forKey: ._storeId) |
||||
} |
||||
|
||||
func groupStageValue() -> GroupStage? { |
||||
guard let groupStage = self.groupStage else { return nil } |
||||
return self.store?.findById(groupStage) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let teamregistration = other as? BaseTeamRegistration else { return } |
||||
self.id = teamregistration.id |
||||
self.lastUpdate = teamregistration.lastUpdate |
||||
self.tournament = teamregistration.tournament |
||||
self.groupStage = teamregistration.groupStage |
||||
self.registrationDate = teamregistration.registrationDate |
||||
self.callDate = teamregistration.callDate |
||||
self.bracketPosition = teamregistration.bracketPosition |
||||
self.groupStagePosition = teamregistration.groupStagePosition |
||||
self.comment = teamregistration.comment |
||||
self.source = teamregistration.source |
||||
self.sourceValue = teamregistration.sourceValue |
||||
self.logo = teamregistration.logo |
||||
self.name = teamregistration.name |
||||
self.walkOut = teamregistration.walkOut |
||||
self.wildCardBracket = teamregistration.wildCardBracket |
||||
self.wildCardGroupStage = teamregistration.wildCardGroupStage |
||||
self.weight = teamregistration.weight |
||||
self.lockedWeight = teamregistration.lockedWeight |
||||
self.confirmationDate = teamregistration.confirmationDate |
||||
self.qualified = teamregistration.qualified |
||||
self.finalRanking = teamregistration.finalRanking |
||||
self.pointsEarned = teamregistration.pointsEarned |
||||
self.storeId = teamregistration.storeId |
||||
} |
||||
} |
||||
@ -0,0 +1,101 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseTeamScore: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "team-scores" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return true } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var match: String = "" |
||||
var teamRegistration: String? = nil |
||||
var score: String? = nil |
||||
var walkOut: Int? = nil |
||||
var luckyLoser: Int? = nil |
||||
var storeId: String? = nil |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
match: String = "", |
||||
teamRegistration: String? = nil, |
||||
score: String? = nil, |
||||
walkOut: Int? = nil, |
||||
luckyLoser: Int? = nil, |
||||
storeId: String? = nil |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.match = match |
||||
self.teamRegistration = teamRegistration |
||||
self.score = score |
||||
self.walkOut = walkOut |
||||
self.luckyLoser = luckyLoser |
||||
self.storeId = storeId |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _match = "match" |
||||
case _teamRegistration = "teamRegistration" |
||||
case _score = "score" |
||||
case _walkOut = "walkOut" |
||||
case _luckyLoser = "luckyLoser" |
||||
case _storeId = "storeId" |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.match = try container.decodeIfPresent(String.self, forKey: ._match) ?? "" |
||||
self.teamRegistration = try container.decodeIfPresent(String.self, forKey: ._teamRegistration) ?? nil |
||||
self.score = try container.decodeIfPresent(String.self, forKey: ._score) ?? nil |
||||
self.walkOut = try container.decodeIfPresent(Int.self, forKey: ._walkOut) ?? nil |
||||
self.luckyLoser = try container.decodeIfPresent(Int.self, forKey: ._luckyLoser) ?? nil |
||||
self.storeId = try container.decodeIfPresent(String.self, forKey: ._storeId) ?? nil |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.match, forKey: ._match) |
||||
try container.encode(self.teamRegistration, forKey: ._teamRegistration) |
||||
try container.encode(self.score, forKey: ._score) |
||||
try container.encode(self.walkOut, forKey: ._walkOut) |
||||
try container.encode(self.luckyLoser, forKey: ._luckyLoser) |
||||
try container.encode(self.storeId, forKey: ._storeId) |
||||
} |
||||
|
||||
func matchValue() -> Match? { |
||||
return self.store?.findById(match) |
||||
} |
||||
|
||||
func teamRegistrationValue() -> TeamRegistration? { |
||||
guard let teamRegistration = self.teamRegistration else { return nil } |
||||
return self.store?.findById(teamRegistration) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let teamscore = other as? BaseTeamScore else { return } |
||||
self.id = teamscore.id |
||||
self.lastUpdate = teamscore.lastUpdate |
||||
self.match = teamscore.match |
||||
self.teamRegistration = teamscore.teamRegistration |
||||
self.score = teamscore.score |
||||
self.walkOut = teamscore.walkOut |
||||
self.luckyLoser = teamscore.luckyLoser |
||||
self.storeId = teamscore.storeId |
||||
} |
||||
} |
||||
@ -0,0 +1,396 @@ |
||||
// Generated by SwiftModelGenerator |
||||
// Do not modify this file manually |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
import SwiftUI |
||||
|
||||
@Observable |
||||
class BaseTournament: ModelObject, SyncedStorable, Codable { |
||||
|
||||
static func resourceName() -> String { return "tournaments" } |
||||
static func tokenExemptedMethods() -> [HTTPMethod] { return [] } |
||||
static func filterByStoreIdentifier() -> Bool { return false } |
||||
|
||||
var id: String = Store.randomId() |
||||
var lastUpdate: Date = Date() |
||||
var event: String? = nil |
||||
var name: String? = nil |
||||
var startDate: Date = Date() |
||||
var endDate: Date? = nil |
||||
var creationDate: Date = Date() |
||||
var isPrivate: Bool = false |
||||
var groupStageFormat: MatchFormat? = nil |
||||
var roundFormat: MatchFormat? = nil |
||||
var loserRoundFormat: MatchFormat? = nil |
||||
var groupStageSortMode: GroupStageOrderingMode = GroupStageOrderingMode.snake |
||||
var groupStageCount: Int = 0 |
||||
var rankSourceDate: Date? = nil |
||||
var dayDuration: Int = 0 |
||||
var teamCount: Int = 0 |
||||
var teamSorting: TeamSortingType = TeamSortingType.inscriptionDate |
||||
var federalCategory: TournamentCategory = TournamentCategory.men |
||||
var federalLevelCategory: TournamentLevel = TournamentLevel.unlisted |
||||
var federalAgeCategory: FederalTournamentAge = FederalTournamentAge.unlisted |
||||
var closedRegistrationDate: Date? = nil |
||||
var groupStageAdditionalQualified: Int = 0 |
||||
var courtCount: Int = 2 |
||||
var prioritizeClubMembers: Bool = false |
||||
var qualifiedPerGroupStage: Int = 0 |
||||
var teamsPerGroupStage: Int = 0 |
||||
var entryFee: Double? = nil |
||||
var payment: TournamentPayment? = nil |
||||
var additionalEstimationDuration: Int = 0 |
||||
var isDeleted: Bool = false |
||||
var isCanceled: Bool = false |
||||
var publishTeams: Bool = false |
||||
var publishSummons: Bool = false |
||||
var publishGroupStages: Bool = false |
||||
var publishBrackets: Bool = false |
||||
var shouldVerifyGroupStage: Bool = false |
||||
var shouldVerifyBracket: Bool = false |
||||
var hideTeamsWeight: Bool = false |
||||
var publishTournament: Bool = false |
||||
var hidePointsEarned: Bool = false |
||||
var publishRankings: Bool = false |
||||
var loserBracketMode: LoserBracketMode = .automatic |
||||
|
||||
init( |
||||
id: String = Store.randomId(), |
||||
lastUpdate: Date = Date(), |
||||
event: String? = nil, |
||||
name: String? = nil, |
||||
startDate: Date = Date(), |
||||
endDate: Date? = nil, |
||||
creationDate: Date = Date(), |
||||
isPrivate: Bool = false, |
||||
groupStageFormat: MatchFormat? = nil, |
||||
roundFormat: MatchFormat? = nil, |
||||
loserRoundFormat: MatchFormat? = nil, |
||||
groupStageSortMode: GroupStageOrderingMode = GroupStageOrderingMode.snake, |
||||
groupStageCount: Int = 0, |
||||
rankSourceDate: Date? = nil, |
||||
dayDuration: Int = 0, |
||||
teamCount: Int = 0, |
||||
teamSorting: TeamSortingType = TeamSortingType.inscriptionDate, |
||||
federalCategory: TournamentCategory = TournamentCategory.men, |
||||
federalLevelCategory: TournamentLevel = TournamentLevel.unlisted, |
||||
federalAgeCategory: FederalTournamentAge = FederalTournamentAge.unlisted, |
||||
closedRegistrationDate: Date? = nil, |
||||
groupStageAdditionalQualified: Int = 0, |
||||
courtCount: Int = 2, |
||||
prioritizeClubMembers: Bool = false, |
||||
qualifiedPerGroupStage: Int = 0, |
||||
teamsPerGroupStage: Int = 0, |
||||
entryFee: Double? = nil, |
||||
payment: TournamentPayment? = nil, |
||||
additionalEstimationDuration: Int = 0, |
||||
isDeleted: Bool = false, |
||||
isCanceled: Bool = false, |
||||
publishTeams: Bool = false, |
||||
publishSummons: Bool = false, |
||||
publishGroupStages: Bool = false, |
||||
publishBrackets: Bool = false, |
||||
shouldVerifyGroupStage: Bool = false, |
||||
shouldVerifyBracket: Bool = false, |
||||
hideTeamsWeight: Bool = false, |
||||
publishTournament: Bool = false, |
||||
hidePointsEarned: Bool = false, |
||||
publishRankings: Bool = false, |
||||
loserBracketMode: LoserBracketMode = .automatic |
||||
) { |
||||
super.init() |
||||
self.id = id |
||||
self.lastUpdate = lastUpdate |
||||
self.event = event |
||||
self.name = name |
||||
self.startDate = startDate |
||||
self.endDate = endDate |
||||
self.creationDate = creationDate |
||||
self.isPrivate = isPrivate |
||||
self.groupStageFormat = groupStageFormat |
||||
self.roundFormat = roundFormat |
||||
self.loserRoundFormat = loserRoundFormat |
||||
self.groupStageSortMode = groupStageSortMode |
||||
self.groupStageCount = groupStageCount |
||||
self.rankSourceDate = rankSourceDate |
||||
self.dayDuration = dayDuration |
||||
self.teamCount = teamCount |
||||
self.teamSorting = teamSorting |
||||
self.federalCategory = federalCategory |
||||
self.federalLevelCategory = federalLevelCategory |
||||
self.federalAgeCategory = federalAgeCategory |
||||
self.closedRegistrationDate = closedRegistrationDate |
||||
self.groupStageAdditionalQualified = groupStageAdditionalQualified |
||||
self.courtCount = courtCount |
||||
self.prioritizeClubMembers = prioritizeClubMembers |
||||
self.qualifiedPerGroupStage = qualifiedPerGroupStage |
||||
self.teamsPerGroupStage = teamsPerGroupStage |
||||
self.entryFee = entryFee |
||||
self.payment = payment |
||||
self.additionalEstimationDuration = additionalEstimationDuration |
||||
self.isDeleted = isDeleted |
||||
self.isCanceled = isCanceled |
||||
self.publishTeams = publishTeams |
||||
self.publishSummons = publishSummons |
||||
self.publishGroupStages = publishGroupStages |
||||
self.publishBrackets = publishBrackets |
||||
self.shouldVerifyGroupStage = shouldVerifyGroupStage |
||||
self.shouldVerifyBracket = shouldVerifyBracket |
||||
self.hideTeamsWeight = hideTeamsWeight |
||||
self.publishTournament = publishTournament |
||||
self.hidePointsEarned = hidePointsEarned |
||||
self.publishRankings = publishRankings |
||||
self.loserBracketMode = loserBracketMode |
||||
} |
||||
|
||||
enum CodingKeys: String, CodingKey { |
||||
case _id = "id" |
||||
case _lastUpdate = "lastUpdate" |
||||
case _event = "event" |
||||
case _name = "name" |
||||
case _startDate = "startDate" |
||||
case _endDate = "endDate" |
||||
case _creationDate = "creationDate" |
||||
case _isPrivate = "isPrivate" |
||||
case _groupStageFormat = "groupStageFormat" |
||||
case _roundFormat = "roundFormat" |
||||
case _loserRoundFormat = "loserRoundFormat" |
||||
case _groupStageSortMode = "groupStageSortMode" |
||||
case _groupStageCount = "groupStageCount" |
||||
case _rankSourceDate = "rankSourceDate" |
||||
case _dayDuration = "dayDuration" |
||||
case _teamCount = "teamCount" |
||||
case _teamSorting = "teamSorting" |
||||
case _federalCategory = "federalCategory" |
||||
case _federalLevelCategory = "federalLevelCategory" |
||||
case _federalAgeCategory = "federalAgeCategory" |
||||
case _closedRegistrationDate = "closedRegistrationDate" |
||||
case _groupStageAdditionalQualified = "groupStageAdditionalQualified" |
||||
case _courtCount = "courtCount" |
||||
case _prioritizeClubMembers = "prioritizeClubMembers" |
||||
case _qualifiedPerGroupStage = "qualifiedPerGroupStage" |
||||
case _teamsPerGroupStage = "teamsPerGroupStage" |
||||
case _entryFee = "entryFee" |
||||
case _payment = "payment" |
||||
case _additionalEstimationDuration = "additionalEstimationDuration" |
||||
case _isDeleted = "isDeleted" |
||||
case _isCanceled = "isCanceled" |
||||
case _publishTeams = "publishTeams" |
||||
case _publishSummons = "publishSummons" |
||||
case _publishGroupStages = "publishGroupStages" |
||||
case _publishBrackets = "publishBrackets" |
||||
case _shouldVerifyGroupStage = "shouldVerifyGroupStage" |
||||
case _shouldVerifyBracket = "shouldVerifyBracket" |
||||
case _hideTeamsWeight = "hideTeamsWeight" |
||||
case _publishTournament = "publishTournament" |
||||
case _hidePointsEarned = "hidePointsEarned" |
||||
case _publishRankings = "publishRankings" |
||||
case _loserBracketMode = "loserBracketMode" |
||||
} |
||||
|
||||
private static func _decodePayment(container: KeyedDecodingContainer<CodingKeys>) throws -> TournamentPayment? { |
||||
let data = try container.decodeIfPresent(Data.self, forKey: ._payment) |
||||
|
||||
if let data { |
||||
do { |
||||
let decoded: String = try data.decryptData(pass: CryptoKey.pass.rawValue) |
||||
let sequence = decoded.compactMap { NumberFormatter.standard.number(from: String($0))?.intValue } |
||||
return TournamentPayment(rawValue: sequence[18]) |
||||
} catch { |
||||
Logger.error(error) |
||||
} |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
private func _encodePayment(container: inout KeyedEncodingContainer<CodingKeys>) throws { |
||||
guard let payment else { |
||||
try container.encodeNil(forKey: ._payment) |
||||
return |
||||
} |
||||
|
||||
let max: Int = TournamentPayment.allCases.count |
||||
var sequence = (1...18).map { _ in Int.random(in: (0..<max)) } |
||||
sequence.append(payment.rawValue) |
||||
sequence.append(contentsOf: (1...13).map { _ in Int.random(in: (0..<max ))} ) |
||||
|
||||
let stringCombo: [String] = sequence.map { $0.formatted() } |
||||
let joined: String = stringCombo.joined(separator: "") |
||||
if let data = joined.data(using: .utf8) { |
||||
let encryped: Data = try data.encrypt(pass: CryptoKey.pass.rawValue) |
||||
try container.encodeIfPresent(encryped, forKey: ._payment) |
||||
} |
||||
} |
||||
private static func _decodeIscanceled(container: KeyedDecodingContainer<CodingKeys>) throws -> Bool { |
||||
let data = try container.decodeIfPresent(Data.self, forKey: ._isCanceled) |
||||
if let data { |
||||
do { |
||||
let decoded: String = try data.decryptData(pass: CryptoKey.pass.rawValue) |
||||
let sequence = decoded.compactMap { NumberFormatter.standard.number(from: String($0))?.intValue } |
||||
return Bool.decodeInt(sequence[18]) |
||||
} catch { |
||||
Logger.error(error) |
||||
} |
||||
} |
||||
return false |
||||
} |
||||
|
||||
private func _encodeIscanceled(container: inout KeyedEncodingContainer<CodingKeys>) throws { |
||||
let max: Int = 9 |
||||
var sequence = (1...18).map { _ in Int.random(in: (0...max)) } |
||||
sequence.append(self.isCanceled.encodedValue) |
||||
sequence.append(contentsOf: (1...13).map { _ in Int.random(in: (0...max ))} ) |
||||
|
||||
let stringCombo: [String] = sequence.map { $0.formatted() } |
||||
let joined: String = stringCombo.joined(separator: "") |
||||
if let data = joined.data(using: .utf8) { |
||||
let encryped: Data = try data.encrypt(pass: CryptoKey.pass.rawValue) |
||||
try container.encode(encryped, forKey: ._isCanceled) |
||||
} |
||||
} |
||||
|
||||
required init(from decoder: Decoder) throws { |
||||
super.init() |
||||
let container = try decoder.container(keyedBy: CodingKeys.self) |
||||
self.id = try container.decodeIfPresent(String.self, forKey: ._id) ?? Store.randomId() |
||||
self.lastUpdate = try container.decodeIfPresent(Date.self, forKey: ._lastUpdate) ?? Date() |
||||
self.event = try container.decodeIfPresent(String.self, forKey: ._event) ?? nil |
||||
self.name = try container.decodeIfPresent(String.self, forKey: ._name) ?? nil |
||||
self.startDate = try container.decodeIfPresent(Date.self, forKey: ._startDate) ?? Date() |
||||
self.endDate = try container.decodeIfPresent(Date.self, forKey: ._endDate) ?? nil |
||||
self.creationDate = try container.decodeIfPresent(Date.self, forKey: ._creationDate) ?? Date() |
||||
self.isPrivate = try container.decodeIfPresent(Bool.self, forKey: ._isPrivate) ?? false |
||||
self.groupStageFormat = try container.decodeIfPresent(MatchFormat.self, forKey: ._groupStageFormat) ?? nil |
||||
self.roundFormat = try container.decodeIfPresent(MatchFormat.self, forKey: ._roundFormat) ?? nil |
||||
self.loserRoundFormat = try container.decodeIfPresent(MatchFormat.self, forKey: ._loserRoundFormat) ?? nil |
||||
self.groupStageSortMode = try container.decodeIfPresent(GroupStageOrderingMode.self, forKey: ._groupStageSortMode) ?? GroupStageOrderingMode.snake |
||||
self.groupStageCount = try container.decodeIfPresent(Int.self, forKey: ._groupStageCount) ?? 0 |
||||
self.rankSourceDate = try container.decodeIfPresent(Date.self, forKey: ._rankSourceDate) ?? nil |
||||
self.dayDuration = try container.decodeIfPresent(Int.self, forKey: ._dayDuration) ?? 0 |
||||
self.teamCount = try container.decodeIfPresent(Int.self, forKey: ._teamCount) ?? 0 |
||||
self.teamSorting = try container.decodeIfPresent(TeamSortingType.self, forKey: ._teamSorting) ?? TeamSortingType.inscriptionDate |
||||
self.federalCategory = try container.decodeIfPresent(TournamentCategory.self, forKey: ._federalCategory) ?? TournamentCategory.men |
||||
self.federalLevelCategory = try container.decodeIfPresent(TournamentLevel.self, forKey: ._federalLevelCategory) ?? TournamentLevel.unlisted |
||||
self.federalAgeCategory = try container.decodeIfPresent(FederalTournamentAge.self, forKey: ._federalAgeCategory) ?? FederalTournamentAge.unlisted |
||||
self.closedRegistrationDate = try container.decodeIfPresent(Date.self, forKey: ._closedRegistrationDate) ?? nil |
||||
self.groupStageAdditionalQualified = try container.decodeIfPresent(Int.self, forKey: ._groupStageAdditionalQualified) ?? 0 |
||||
self.courtCount = try container.decodeIfPresent(Int.self, forKey: ._courtCount) ?? 2 |
||||
self.prioritizeClubMembers = try container.decodeIfPresent(Bool.self, forKey: ._prioritizeClubMembers) ?? false |
||||
self.qualifiedPerGroupStage = try container.decodeIfPresent(Int.self, forKey: ._qualifiedPerGroupStage) ?? 0 |
||||
self.teamsPerGroupStage = try container.decodeIfPresent(Int.self, forKey: ._teamsPerGroupStage) ?? 0 |
||||
self.entryFee = try container.decodeIfPresent(Double.self, forKey: ._entryFee) ?? nil |
||||
self.payment = try Self._decodePayment(container: container) |
||||
self.additionalEstimationDuration = try container.decodeIfPresent(Int.self, forKey: ._additionalEstimationDuration) ?? 0 |
||||
self.isDeleted = try container.decodeIfPresent(Bool.self, forKey: ._isDeleted) ?? false |
||||
self.isCanceled = try Self._decodeIscanceled(container: container) |
||||
self.publishTeams = try container.decodeIfPresent(Bool.self, forKey: ._publishTeams) ?? false |
||||
self.publishSummons = try container.decodeIfPresent(Bool.self, forKey: ._publishSummons) ?? false |
||||
self.publishGroupStages = try container.decodeIfPresent(Bool.self, forKey: ._publishGroupStages) ?? false |
||||
self.publishBrackets = try container.decodeIfPresent(Bool.self, forKey: ._publishBrackets) ?? false |
||||
self.shouldVerifyGroupStage = try container.decodeIfPresent(Bool.self, forKey: ._shouldVerifyGroupStage) ?? false |
||||
self.shouldVerifyBracket = try container.decodeIfPresent(Bool.self, forKey: ._shouldVerifyBracket) ?? false |
||||
self.hideTeamsWeight = try container.decodeIfPresent(Bool.self, forKey: ._hideTeamsWeight) ?? false |
||||
self.publishTournament = try container.decodeIfPresent(Bool.self, forKey: ._publishTournament) ?? false |
||||
self.hidePointsEarned = try container.decodeIfPresent(Bool.self, forKey: ._hidePointsEarned) ?? false |
||||
self.publishRankings = try container.decodeIfPresent(Bool.self, forKey: ._publishRankings) ?? false |
||||
self.loserBracketMode = try container.decodeIfPresent(LoserBracketMode.self, forKey: ._loserBracketMode) ?? .automatic |
||||
} |
||||
|
||||
func encode(to encoder: Encoder) throws { |
||||
var container = encoder.container(keyedBy: CodingKeys.self) |
||||
try container.encode(self.id, forKey: ._id) |
||||
try container.encode(self.lastUpdate, forKey: ._lastUpdate) |
||||
try container.encode(self.event, forKey: ._event) |
||||
try container.encode(self.name, forKey: ._name) |
||||
try container.encode(self.startDate, forKey: ._startDate) |
||||
try container.encode(self.endDate, forKey: ._endDate) |
||||
try container.encode(self.creationDate, forKey: ._creationDate) |
||||
try container.encode(self.isPrivate, forKey: ._isPrivate) |
||||
try container.encode(self.groupStageFormat, forKey: ._groupStageFormat) |
||||
try container.encode(self.roundFormat, forKey: ._roundFormat) |
||||
try container.encode(self.loserRoundFormat, forKey: ._loserRoundFormat) |
||||
try container.encode(self.groupStageSortMode, forKey: ._groupStageSortMode) |
||||
try container.encode(self.groupStageCount, forKey: ._groupStageCount) |
||||
try container.encode(self.rankSourceDate, forKey: ._rankSourceDate) |
||||
try container.encode(self.dayDuration, forKey: ._dayDuration) |
||||
try container.encode(self.teamCount, forKey: ._teamCount) |
||||
try container.encode(self.teamSorting, forKey: ._teamSorting) |
||||
try container.encode(self.federalCategory, forKey: ._federalCategory) |
||||
try container.encode(self.federalLevelCategory, forKey: ._federalLevelCategory) |
||||
try container.encode(self.federalAgeCategory, forKey: ._federalAgeCategory) |
||||
try container.encode(self.closedRegistrationDate, forKey: ._closedRegistrationDate) |
||||
try container.encode(self.groupStageAdditionalQualified, forKey: ._groupStageAdditionalQualified) |
||||
try container.encode(self.courtCount, forKey: ._courtCount) |
||||
try container.encode(self.prioritizeClubMembers, forKey: ._prioritizeClubMembers) |
||||
try container.encode(self.qualifiedPerGroupStage, forKey: ._qualifiedPerGroupStage) |
||||
try container.encode(self.teamsPerGroupStage, forKey: ._teamsPerGroupStage) |
||||
try container.encode(self.entryFee, forKey: ._entryFee) |
||||
try _encodePayment(container: &container) |
||||
try container.encode(self.additionalEstimationDuration, forKey: ._additionalEstimationDuration) |
||||
try container.encode(self.isDeleted, forKey: ._isDeleted) |
||||
try _encodeIscanceled(container: &container) |
||||
try container.encode(self.publishTeams, forKey: ._publishTeams) |
||||
try container.encode(self.publishSummons, forKey: ._publishSummons) |
||||
try container.encode(self.publishGroupStages, forKey: ._publishGroupStages) |
||||
try container.encode(self.publishBrackets, forKey: ._publishBrackets) |
||||
try container.encode(self.shouldVerifyGroupStage, forKey: ._shouldVerifyGroupStage) |
||||
try container.encode(self.shouldVerifyBracket, forKey: ._shouldVerifyBracket) |
||||
try container.encode(self.hideTeamsWeight, forKey: ._hideTeamsWeight) |
||||
try container.encode(self.publishTournament, forKey: ._publishTournament) |
||||
try container.encode(self.hidePointsEarned, forKey: ._hidePointsEarned) |
||||
try container.encode(self.publishRankings, forKey: ._publishRankings) |
||||
try container.encode(self.loserBracketMode, forKey: ._loserBracketMode) |
||||
} |
||||
|
||||
func eventValue() -> Event? { |
||||
guard let event = self.event else { return nil } |
||||
return Store.main.findById(event) |
||||
} |
||||
|
||||
func copy(from other: any Storable) { |
||||
guard let tournament = other as? BaseTournament else { return } |
||||
self.id = tournament.id |
||||
self.lastUpdate = tournament.lastUpdate |
||||
self.event = tournament.event |
||||
self.name = tournament.name |
||||
self.startDate = tournament.startDate |
||||
self.endDate = tournament.endDate |
||||
self.creationDate = tournament.creationDate |
||||
self.isPrivate = tournament.isPrivate |
||||
self.groupStageFormat = tournament.groupStageFormat |
||||
self.roundFormat = tournament.roundFormat |
||||
self.loserRoundFormat = tournament.loserRoundFormat |
||||
self.groupStageSortMode = tournament.groupStageSortMode |
||||
self.groupStageCount = tournament.groupStageCount |
||||
self.rankSourceDate = tournament.rankSourceDate |
||||
self.dayDuration = tournament.dayDuration |
||||
self.teamCount = tournament.teamCount |
||||
self.teamSorting = tournament.teamSorting |
||||
self.federalCategory = tournament.federalCategory |
||||
self.federalLevelCategory = tournament.federalLevelCategory |
||||
self.federalAgeCategory = tournament.federalAgeCategory |
||||
self.closedRegistrationDate = tournament.closedRegistrationDate |
||||
self.groupStageAdditionalQualified = tournament.groupStageAdditionalQualified |
||||
self.courtCount = tournament.courtCount |
||||
self.prioritizeClubMembers = tournament.prioritizeClubMembers |
||||
self.qualifiedPerGroupStage = tournament.qualifiedPerGroupStage |
||||
self.teamsPerGroupStage = tournament.teamsPerGroupStage |
||||
self.entryFee = tournament.entryFee |
||||
self.payment = tournament.payment |
||||
self.additionalEstimationDuration = tournament.additionalEstimationDuration |
||||
self.isDeleted = tournament.isDeleted |
||||
self.isCanceled = tournament.isCanceled |
||||
self.publishTeams = tournament.publishTeams |
||||
self.publishSummons = tournament.publishSummons |
||||
self.publishGroupStages = tournament.publishGroupStages |
||||
self.publishBrackets = tournament.publishBrackets |
||||
self.shouldVerifyGroupStage = tournament.shouldVerifyGroupStage |
||||
self.shouldVerifyBracket = tournament.shouldVerifyBracket |
||||
self.hideTeamsWeight = tournament.hideTeamsWeight |
||||
self.publishTournament = tournament.publishTournament |
||||
self.hidePointsEarned = tournament.hidePointsEarned |
||||
self.publishRankings = tournament.publishRankings |
||||
self.loserBracketMode = tournament.loserBracketMode |
||||
} |
||||
} |
||||
@ -0,0 +1,90 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "Club", |
||||
"synchronizable": true, |
||||
"observable": true, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "creator", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil", |
||||
"foreignKey": "CustomUser" |
||||
}, |
||||
{ |
||||
"name": "name", |
||||
"type": "String", |
||||
"defaultValue": "\"\"" |
||||
}, |
||||
{ |
||||
"name": "acronym", |
||||
"type": "String", |
||||
"defaultValue": "\"\"" |
||||
}, |
||||
{ |
||||
"name": "phone", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "code", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "address", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "city", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "zipCode", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "latitude", |
||||
"type": "Double", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "longitude", |
||||
"type": "Double", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "courtCount", |
||||
"type": "Int", |
||||
"defaultValue": "2" |
||||
}, |
||||
{ |
||||
"name": "broadcastCode", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "Court", |
||||
"synchronizable": true, |
||||
"observable": true, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "index", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "club", |
||||
"type": "String", |
||||
"foreignKey": "Club" |
||||
}, |
||||
{ |
||||
"name": "name", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "exitAllowed", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "indoor", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
} |
||||
], |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": false |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,136 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "CustomUser", |
||||
"resource_name": "users", |
||||
"synchronizable": true, |
||||
"observable": true, |
||||
"tokenExemptedMethods": ["post"], |
||||
"filterByStoreIdentifier": false, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "username", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "email", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "clubs", |
||||
"type": "[String]", |
||||
"defaultValue": "[]" |
||||
}, |
||||
{ |
||||
"name": "umpireCode", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "licenceId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "firstName", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "lastName", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "phone", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "country", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "summonsMessageBody", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "summonsMessageSignature", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "summonsAvailablePaymentMethods", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "summonsDisplayFormat", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "summonsDisplayEntryFee", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "summonsUseFullCustomMessage", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "matchFormatsDefaultDuration", |
||||
"type": "[MatchFormat: Int]", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "bracketMatchFormatPreference", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "groupStageMatchFormatPreference", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "loserBracketMatchFormatPreference", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "loserBracketMode", |
||||
"type": "LoserBracketMode", |
||||
"defaultValue": ".automatic" |
||||
}, |
||||
{ |
||||
"name": "deviceId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "DateInterval", |
||||
"synchronizable": true, |
||||
"observable": true, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "event", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "courtIndex", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "startDate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "endDate", |
||||
"type": "Date" |
||||
} |
||||
], |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": false |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,53 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "Event", |
||||
"synchronizable": true, |
||||
"observable": true, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "creator", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil", |
||||
"foreignKey": "CustomUser" |
||||
}, |
||||
{ |
||||
"name": "club", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil", |
||||
"foreignKey": "Club" |
||||
}, |
||||
{ |
||||
"name": "creationDate", |
||||
"type": "Date", |
||||
"defaultValue": "Date()" |
||||
}, |
||||
{ |
||||
"name": "name", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "tenupId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
], |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": false |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,64 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "GroupStage", |
||||
"synchronizable": true, |
||||
"observable": true, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "tournament", |
||||
"type": "String", |
||||
"foreignKey": "Tournament" |
||||
}, |
||||
{ |
||||
"name": "index", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "size", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "format", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "startDate", |
||||
"type": "Date", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "name", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "step", |
||||
"type": "Int", |
||||
"defaultValue": "0" |
||||
}, |
||||
{ |
||||
"name": "storeId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
], |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": true |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,93 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "Match", |
||||
"synchronizable": true, |
||||
"observable": true, |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": true, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "round", |
||||
"type": "String", |
||||
"optional": true, |
||||
"foreignKey": "Round*" |
||||
}, |
||||
{ |
||||
"name": "groupStage", |
||||
"type": "String", |
||||
"optional": true, |
||||
"foreignKey": "GroupStage*" |
||||
}, |
||||
{ |
||||
"name": "startDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "endDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "index", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "format", |
||||
"type": "MatchFormat", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "servingTeamId", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "winningTeamId", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "losingTeamId", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "name", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "disabled", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "courtIndex", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "confirmed", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "storeId", |
||||
"type": "String", |
||||
"optional": true |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,75 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "MatchScheduler", |
||||
"resource_name": "match-scheduler", |
||||
"synchronizable": false, |
||||
"observable": true, |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": false, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "tournament", |
||||
"type": "String", |
||||
"foreignKey": "Tournament" |
||||
}, |
||||
{ |
||||
"name": "timeDifferenceLimit", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "loserBracketRotationDifference", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "upperBracketRotationDifference", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "accountUpperBracketBreakTime", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "accountLoserBracketBreakTime", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "randomizeCourts", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "rotationDifferenceIsImportant", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "shouldHandleUpperRoundSlice", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "shouldEndRoundBeforeStartingNext", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "groupStageChunkCount", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "overrideCourtsUnavailability", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "shouldTryToFillUpCourtsAvailable", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,72 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "MonthData", |
||||
"resource_name": "month-data", |
||||
"synchronizable": false, |
||||
"observable": true, |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": false, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "monthKey", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "creationDate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "maleUnrankedValue", |
||||
"type": "Int", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "femaleUnrankedValue", |
||||
"type": "Int", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "maleCount", |
||||
"type": "Int", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "femaleCount", |
||||
"type": "Int", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "anonymousCount", |
||||
"type": "Int", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "incompleteMode", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "dataModelIdentifier", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "fileModelIdentifier", |
||||
"type": "String", |
||||
"optional": true |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,118 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "PlayerRegistration", |
||||
"synchronizable": true, |
||||
"sideStorable": true, |
||||
"filterByStoreIdentifier": true, |
||||
"observable": true, |
||||
"relationshipNames": ["teamRegistration"], |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "teamRegistration", |
||||
"type": "String", |
||||
"optional": true, |
||||
"foreignKey": "TeamRegistration" |
||||
}, |
||||
{ |
||||
"name": "firstName", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "lastName", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "licenceId", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "rank", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "paymentType", |
||||
"type": "PlayerPaymentType", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "sex", |
||||
"type": "PlayerSexType", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "tournamentPlayed", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "points", |
||||
"type": "Double", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "clubName", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "ligueName", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "assimilation", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "phoneNumber", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "email", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "birthdate", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "computedRank", |
||||
"type": "Int", |
||||
"defaultValue": "0" |
||||
}, |
||||
{ |
||||
"name": "source", |
||||
"type": "PlayerDataSource", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "hasArrived", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "storeId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,56 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "Purchase", |
||||
"synchronizable": true, |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "UInt64", |
||||
"defaultValue": "0" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "user", |
||||
"type": "String", |
||||
"defaultValue": "\"\"", |
||||
"encryption": "standard", |
||||
"foreignKey": "CustomUser" |
||||
}, |
||||
{ |
||||
"name": "purchaseDate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "productId", |
||||
"type": "String", |
||||
"defaultValue": "\"\"" |
||||
}, |
||||
{ |
||||
"name": "quantity", |
||||
"type": "Int", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "revocationDate", |
||||
"type": "Date", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
}, |
||||
{ |
||||
"name": "expirationDate", |
||||
"type": "Date", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
], |
||||
"tokenExemptedMethods": [], |
||||
"filterByStoreIdentifier": false, |
||||
"relationshipNames": [] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,64 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "Round", |
||||
"synchronizable": true, |
||||
"sideStorable": true, |
||||
"filterByStoreIdentifier": true, |
||||
"observable": true, |
||||
"relationshipNames": [], |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "tournament", |
||||
"type": "String", |
||||
"foreignKey": "Tournament" |
||||
}, |
||||
{ |
||||
"name": "index", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "parent", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "format", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"private": true |
||||
}, |
||||
{ |
||||
"name": "startDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "groupStageLoserBracket", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "loserBracketMode", |
||||
"type": "LoserBracketMode", |
||||
"defaultValue": ".automatic" |
||||
}, |
||||
{ |
||||
"name": "storeId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,129 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "TeamRegistration", |
||||
"synchronizable": true, |
||||
"sideStorable": true, |
||||
"filterByStoreIdentifier": true, |
||||
"observable": true, |
||||
"relationshipNames": [], |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "tournament", |
||||
"type": "String" |
||||
}, |
||||
{ |
||||
"name": "groupStage", |
||||
"type": "String", |
||||
"optional": true, |
||||
"foreignKey": "GroupStage*" |
||||
}, |
||||
{ |
||||
"name": "registrationDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "callDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "bracketPosition", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "groupStagePosition", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "comment", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "source", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "sourceValue", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "logo", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "name", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "walkOut", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "wildCardBracket", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "wildCardGroupStage", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "weight", |
||||
"type": "Int", |
||||
"defaultValue": "0" |
||||
}, |
||||
{ |
||||
"name": "lockedWeight", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "confirmationDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "qualified", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "finalRanking", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "pointsEarned", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "storeId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,55 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "TeamScore", |
||||
"synchronizable": true, |
||||
"sideStorable": true, |
||||
"filterByStoreIdentifier": true, |
||||
"observable": true, |
||||
"relationshipNames": ["match"], |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "match", |
||||
"type": "String", |
||||
"foreignKey": "Match*" |
||||
}, |
||||
{ |
||||
"name": "teamRegistration", |
||||
"type": "String", |
||||
"optional": true, |
||||
"foreignKey": "TeamRegistration*" |
||||
}, |
||||
{ |
||||
"name": "score", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "walkOut", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "luckyLoser", |
||||
"type": "Int", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "storeId", |
||||
"type": "String", |
||||
"optional": true, |
||||
"defaultValue": "nil" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,221 @@ |
||||
{ |
||||
"models": [ |
||||
{ |
||||
"name": "Tournament", |
||||
"synchronizable": true, |
||||
"copyable": true, |
||||
"filterByStoreIdentifier": false, |
||||
"observable": true, |
||||
"relationshipNames": [], |
||||
"properties": [ |
||||
{ |
||||
"name": "id", |
||||
"type": "String", |
||||
"defaultValue": "Store.randomId()" |
||||
}, |
||||
{ |
||||
"name": "lastUpdate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "event", |
||||
"type": "String", |
||||
"optional": true, |
||||
"foreignKey": "Event" |
||||
}, |
||||
{ |
||||
"name": "name", |
||||
"type": "String", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "startDate", |
||||
"type": "Date" |
||||
}, |
||||
{ |
||||
"name": "endDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "creationDate", |
||||
"type": "Date", |
||||
"private": true |
||||
}, |
||||
{ |
||||
"name": "isPrivate", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "groupStageFormat", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"private": true |
||||
}, |
||||
{ |
||||
"name": "roundFormat", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"private": true |
||||
}, |
||||
{ |
||||
"name": "loserRoundFormat", |
||||
"type": "MatchFormat", |
||||
"optional": true, |
||||
"private": true |
||||
}, |
||||
{ |
||||
"name": "groupStageSortMode", |
||||
"type": "GroupStageOrderingMode", |
||||
"defaultValue": "GroupStageOrderingMode.snake" |
||||
}, |
||||
{ |
||||
"name": "groupStageCount", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "rankSourceDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "dayDuration", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "teamCount", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "teamSorting", |
||||
"type": "TeamSortingType", |
||||
"defaultValue": "TeamSortingType.inscriptionDate" |
||||
}, |
||||
{ |
||||
"name": "federalCategory", |
||||
"type": "TournamentCategory", |
||||
"defaultValue": "TournamentCategory.men" |
||||
}, |
||||
{ |
||||
"name": "federalLevelCategory", |
||||
"type": "TournamentLevel", |
||||
"defaultValue": "TournamentLevel.unlisted" |
||||
}, |
||||
{ |
||||
"name": "federalAgeCategory", |
||||
"type": "FederalTournamentAge", |
||||
"defaultValue": "FederalTournamentAge.unlisted" |
||||
}, |
||||
{ |
||||
"name": "closedRegistrationDate", |
||||
"type": "Date", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "groupStageAdditionalQualified", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "courtCount", |
||||
"type": "Int", |
||||
"defaultValue": "2" |
||||
}, |
||||
{ |
||||
"name": "prioritizeClubMembers", |
||||
"type": "Bool" |
||||
}, |
||||
{ |
||||
"name": "qualifiedPerGroupStage", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "teamsPerGroupStage", |
||||
"type": "Int" |
||||
}, |
||||
{ |
||||
"name": "entryFee", |
||||
"type": "Double", |
||||
"optional": true |
||||
}, |
||||
{ |
||||
"name": "payment", |
||||
"type": "TournamentPayment", |
||||
"optional": true, |
||||
"defaultValue": "nil", |
||||
"encryption": "tournament_payment" |
||||
}, |
||||
{ |
||||
"name": "additionalEstimationDuration", |
||||
"type": "Int", |
||||
"defaultValue": "0" |
||||
}, |
||||
{ |
||||
"name": "isDeleted", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "isCanceled", |
||||
"type": "Bool", |
||||
"defaultValue": "false", |
||||
"encryption": "tournament_iscanceled" |
||||
}, |
||||
{ |
||||
"name": "publishTeams", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "publishSummons", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "publishGroupStages", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "publishBrackets", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "shouldVerifyGroupStage", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "shouldVerifyBracket", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "hideTeamsWeight", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "publishTournament", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "hidePointsEarned", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "publishRankings", |
||||
"type": "Bool", |
||||
"defaultValue": "false" |
||||
}, |
||||
{ |
||||
"name": "loserBracketMode", |
||||
"type": "LoserBracketMode", |
||||
"defaultValue": ".automatic" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
@ -0,0 +1,504 @@ |
||||
import json |
||||
import re |
||||
import os |
||||
from pathlib import Path |
||||
from typing import Dict, List, Any |
||||
import argparse |
||||
import sys |
||||
import logging |
||||
from datetime import datetime |
||||
import inflect |
||||
|
||||
class SwiftModelGenerator: |
||||
def __init__(self, json_data: Dict[str, Any]): |
||||
self.data = json_data |
||||
self.pluralizer = inflect.engine() |
||||
|
||||
def generate_model(self, model_data: Dict[str, Any]) -> str: |
||||
model_name = model_data["name"] |
||||
is_sync = model_data.get("synchronizable", False) |
||||
is_observable = model_data.get("observable", False) |
||||
properties = model_data["properties"] |
||||
|
||||
# Get protocol specific configurations |
||||
resource = self.make_resource_name(model_name) |
||||
resource_name = model_data.get("resource_name", resource) |
||||
token_exempted = model_data.get("tokenExemptedMethods", []) |
||||
filter_by_store = model_data.get("filterByStoreIdentifier", False) |
||||
|
||||
lines = ["// Generated by SwiftModelGenerator", "// Do not modify this file manually", ""] |
||||
|
||||
# Import statement |
||||
lines.append("import Foundation") |
||||
lines.append("import LeStorage") |
||||
if is_observable: |
||||
lines.append("import SwiftUI") |
||||
lines.append("") |
||||
|
||||
# Class declaration |
||||
if is_observable: |
||||
lines.append("@Observable") |
||||
protocol = "SyncedStorable" if is_sync else "Storable" |
||||
lines.append(f"class Base{model_name}: ModelObject, {protocol}, Codable {{") |
||||
lines.append("") |
||||
|
||||
# Add SyncedStorable protocol requirements |
||||
lines.extend(self._generate_protocol_requirements(resource_name, token_exempted, filter_by_store)) |
||||
lines.append("") |
||||
|
||||
# Properties |
||||
for prop in properties: |
||||
swift_type = prop["type"] |
||||
if prop.get("optional", False): |
||||
swift_type += "?" |
||||
default_value = prop.get("defaultValue", "nil" if prop.get("optional", False) else self._get_default_value(swift_type)) |
||||
lines.append(f" var {prop['name']}: {swift_type} = {default_value}") |
||||
|
||||
lines.append("") |
||||
|
||||
# Add constructor |
||||
lines.extend(self._generate_constructor(model_name, properties)) |
||||
lines.append("") |
||||
|
||||
# CodingKeys |
||||
lines.extend(self._generate_coding_keys(properties, is_observable)) |
||||
lines.append("") |
||||
|
||||
# Encryption methods |
||||
encrypted_props = [p for p in properties if "encryption" in p] |
||||
if encrypted_props: |
||||
lines.extend(self._generate_encryption_methods(properties)) |
||||
lines.append("") |
||||
|
||||
# Codable implementation |
||||
lines.extend(self._generate_decoder(model_name, properties, is_observable)) |
||||
lines.append("") |
||||
lines.extend(self._generate_encoder(properties, is_observable)) |
||||
lines.append("") |
||||
|
||||
# Foreign Key convenience |
||||
foreign_key_methods = self._generate_foreign_key_methods(properties) |
||||
if foreign_key_methods: |
||||
lines.extend(foreign_key_methods) |
||||
# lines.append("") |
||||
|
||||
# Copy method |
||||
lines.extend(self._generate_copy_method(model_name, properties)) |
||||
|
||||
lines.append("}") |
||||
return "\n".join(lines) |
||||
|
||||
def _generate_constructor(self, model_name: str, properties: List[Dict[str, Any]]) -> List[str]: |
||||
"""Generate a constructor with all properties as parameters with default values.""" |
||||
lines = [" init("] |
||||
|
||||
# Generate parameter list |
||||
params = [] |
||||
for prop in properties: |
||||
name = prop['name'] |
||||
type_name = prop['type'] |
||||
is_optional = prop.get("optional", False) |
||||
|
||||
# Always include a default value |
||||
default_value = prop.get("defaultValue") |
||||
if default_value is None: |
||||
if is_optional: |
||||
default_value = "nil" |
||||
else: |
||||
default_value = self._get_default_value(type_name) |
||||
|
||||
# Format the parameter with its type and default value |
||||
param = f" {name}: {type_name}" |
||||
if is_optional: |
||||
param += "?" |
||||
param += f" = {default_value}" |
||||
params.append(param) |
||||
|
||||
# Join parameters with commas |
||||
lines.extend([f"{param}," for param in params[:-1]]) |
||||
lines.append(f"{params[-1]}") # Last parameter without comma |
||||
|
||||
# Constructor body |
||||
lines.extend([ |
||||
" ) {", |
||||
" super.init()", |
||||
]) |
||||
|
||||
# Property assignments |
||||
for prop in properties: |
||||
name = prop['name'] |
||||
lines.append(f" self.{name} = {name}") |
||||
|
||||
lines.append(" }") |
||||
return lines |
||||
|
||||
def _generate_foreign_key_methods(self, properties: List[Dict[str, Any]]) -> List[str]: |
||||
lines = [] |
||||
for prop in properties: |
||||
if "foreignKey" in prop: |
||||
foreign_key = prop["foreignKey"] |
||||
prop_name = prop["name"] |
||||
method_name = f"{prop_name}Value" |
||||
is_optional = prop.get("optional", False) |
||||
|
||||
lines.extend([f" func {method_name}() -> {foreign_key.rstrip('*')}? {{"]) |
||||
|
||||
if is_optional: |
||||
lines.extend([ |
||||
f" guard let {prop_name} = self.{prop_name} else {{ return nil }}" |
||||
]) |
||||
|
||||
if foreign_key.endswith("*"): |
||||
foreign_key = foreign_key[:-1] # Remove the asterisk |
||||
lines.extend([ |
||||
f" return self.store?.findById({prop_name})" |
||||
]) |
||||
else: |
||||
lines.extend([ |
||||
f" return Store.main.findById({prop_name})" |
||||
]) |
||||
|
||||
lines.extend([" }", ""]) # Close the method and add a blank line |
||||
return lines |
||||
|
||||
def _generate_coding_keys(self, properties: List[Dict[str, Any]], is_observable: bool) -> List[str]: |
||||
lines = [" enum CodingKeys: String, CodingKey {"] |
||||
for prop in properties: |
||||
name = prop['name'] |
||||
# Add underscore prefix to case name if observable, but keep the string value without underscore |
||||
case_name = f"_{name}" if is_observable else name |
||||
lines.append(f" case {case_name} = \"{name}\"") |
||||
lines.append(" }") |
||||
return lines |
||||
|
||||
def _generate_encryption_methods(self, properties: List[Dict[str, Any]]) -> List[str]: |
||||
lines = [] |
||||
for prop in properties: |
||||
if "encryption" in prop: |
||||
name = prop['name'] |
||||
enc_type = prop['encryption'] |
||||
if enc_type == "tournament_payment": |
||||
lines.extend([ |
||||
f" private static func _decode{name.capitalize()}(container: KeyedDecodingContainer<CodingKeys>) throws -> TournamentPayment? {{", |
||||
f" let data = try container.decodeIfPresent(Data.self, forKey: ._{name})", |
||||
" ", |
||||
" if let data {", |
||||
" do {", |
||||
" let decoded: String = try data.decryptData(pass: CryptoKey.pass.rawValue)", |
||||
" let sequence = decoded.compactMap { NumberFormatter.standard.number(from: String($0))?.intValue }", |
||||
" return TournamentPayment(rawValue: sequence[18])", |
||||
" } catch {", |
||||
" Logger.error(error)", |
||||
" }", |
||||
" }", |
||||
" return nil", |
||||
" }", |
||||
"", |
||||
f" private func _encode{name.capitalize()}(container: inout KeyedEncodingContainer<CodingKeys>) throws {{", |
||||
f" guard let {name} else {{", |
||||
f" try container.encodeNil(forKey: ._{name})", |
||||
" return", |
||||
" }", |
||||
" ", |
||||
" let max: Int = TournamentPayment.allCases.count", |
||||
" var sequence = (1...18).map { _ in Int.random(in: (0..<max)) }", |
||||
f" sequence.append({name}.rawValue)", |
||||
" sequence.append(contentsOf: (1...13).map { _ in Int.random(in: (0..<max ))} )", |
||||
"", |
||||
" let stringCombo: [String] = sequence.map { $0.formatted() }", |
||||
" let joined: String = stringCombo.joined(separator: \"\")", |
||||
" if let data = joined.data(using: .utf8) {", |
||||
" let encryped: Data = try data.encrypt(pass: CryptoKey.pass.rawValue)", |
||||
f" try container.encodeIfPresent(encryped, forKey: ._{name})", |
||||
" }", |
||||
" }" |
||||
]) |
||||
elif enc_type == "tournament_iscanceled": |
||||
lines.extend([ |
||||
f" private static func _decode{name.capitalize()}(container: KeyedDecodingContainer<CodingKeys>) throws -> Bool {{", |
||||
f" let data = try container.decodeIfPresent(Data.self, forKey: ._{name})", |
||||
" if let data {", |
||||
" do {", |
||||
" let decoded: String = try data.decryptData(pass: CryptoKey.pass.rawValue)", |
||||
" let sequence = decoded.compactMap { NumberFormatter.standard.number(from: String($0))?.intValue }", |
||||
" return Bool.decodeInt(sequence[18])", |
||||
" } catch {", |
||||
" Logger.error(error)", |
||||
" }", |
||||
" }", |
||||
" return false", |
||||
" }", |
||||
"", |
||||
f" private func _encode{name.capitalize()}(container: inout KeyedEncodingContainer<CodingKeys>) throws {{", |
||||
" let max: Int = 9", |
||||
" var sequence = (1...18).map { _ in Int.random(in: (0...max)) }", |
||||
f" sequence.append(self.{name}.encodedValue)", |
||||
" sequence.append(contentsOf: (1...13).map { _ in Int.random(in: (0...max ))} )", |
||||
" ", |
||||
" let stringCombo: [String] = sequence.map { $0.formatted() }", |
||||
" let joined: String = stringCombo.joined(separator: \"\")", |
||||
" if let data = joined.data(using: .utf8) {", |
||||
" let encryped: Data = try data.encrypt(pass: CryptoKey.pass.rawValue)", |
||||
f" try container.encode(encryped, forKey: ._{name})", |
||||
" }", |
||||
" }" |
||||
]) |
||||
return lines |
||||
|
||||
def _generate_decoder(self, model_name: str, properties: List[Dict[str, Any]], is_observable: bool) -> List[str]: |
||||
lines = [" required init(from decoder: Decoder) throws {", |
||||
" super.init()", |
||||
" let container = try decoder.container(keyedBy: CodingKeys.self)"] |
||||
|
||||
for prop in properties: |
||||
name = prop['name'] |
||||
type_name = prop['type'] |
||||
is_optional = prop.get("optional", False) |
||||
default_value = prop.get("defaultValue", "nil" if is_optional else self._get_default_value(type_name)) |
||||
|
||||
# Use the correct case reference based on observable flag |
||||
case_ref = f"_{name}" if is_observable else name |
||||
|
||||
if "encryption" in prop: |
||||
enc_type = prop['encryption'] |
||||
if enc_type == "standard": |
||||
if is_optional: |
||||
lines.append(f" self.{name} = try container.decodeEncryptedIfPresent(key: .{case_ref})") |
||||
else: |
||||
lines.append(f" self.{name} = try container.decodeEncrypted(key: .{case_ref})") |
||||
elif enc_type in ["tournament_payment", "tournament_iscanceled"]: |
||||
lines.append(f" self.{name} = try Self._decode{name.capitalize()}(container: container)") |
||||
else: |
||||
lines.append(f" self.{name} = try container.decodeIfPresent({type_name}.self, forKey: .{case_ref}) ?? {default_value}") |
||||
|
||||
lines.append(" }") |
||||
return lines |
||||
|
||||
def _generate_encoder(self, properties: List[Dict[str, Any]], is_observable: bool) -> List[str]: |
||||
lines = [" func encode(to encoder: Encoder) throws {", |
||||
" var container = encoder.container(keyedBy: CodingKeys.self)"] |
||||
|
||||
for prop in properties: |
||||
name = prop['name'] |
||||
is_optional = prop.get('optional', False) |
||||
|
||||
# Use the correct case reference based on observable flag |
||||
case_ref = f"_{name}" if is_observable else name |
||||
|
||||
if "encryption" in prop: |
||||
enc_type = prop['encryption'] |
||||
if enc_type == "standard": |
||||
if is_optional: |
||||
lines.append(f" try container.encodeAndEncryptIfPresent(self.{name}?.data(using: .utf8), forKey: .{case_ref})") |
||||
else: |
||||
lines.append(f" try container.encodeAndEncryptIfPresent(self.{name}.data(using: .utf8), forKey: .{case_ref})") |
||||
elif enc_type in ["tournament_payment", "tournament_iscanceled"]: |
||||
lines.append(f" try _encode{name.capitalize()}(container: &container)") |
||||
else: |
||||
lines.append(f" try container.encode(self.{name}, forKey: .{case_ref})") |
||||
|
||||
lines.append(" }") |
||||
return lines |
||||
|
||||
def _generate_copy_method(self, model_name: str, properties: List[Dict[str, Any]]) -> List[str]: |
||||
|
||||
model_variable = model_name.lower() |
||||
lines = [f" func copy(from other: any Storable) {{"] |
||||
lines.append(f" guard let {model_variable} = other as? Base{model_name} else {{ return }}") |
||||
|
||||
for prop in properties: |
||||
name = prop['name'] |
||||
lines.append(f" self.{name} = {model_variable}.{name}") |
||||
|
||||
lines.append(" }") |
||||
return lines |
||||
|
||||
def _generate_protocol_requirements(self, resource_name: str, token_exempted: List[str], filter_by_store: bool) -> List[str]: |
||||
"""Generate the static functions required by SyncedStorable protocol.""" |
||||
# Convert HTTP methods to proper format |
||||
formatted_methods = [f".{method.lower()}" for method in token_exempted] |
||||
methods_str = ", ".join(formatted_methods) if formatted_methods else "" |
||||
|
||||
return [ |
||||
f" static func resourceName() -> String {{ return \"{resource_name}\" }}", |
||||
f" static func tokenExemptedMethods() -> [HTTPMethod] {{ return [{methods_str}] }}", |
||||
f" static func filterByStoreIdentifier() -> Bool {{ return {str(filter_by_store).lower()} }}" |
||||
] |
||||
|
||||
|
||||
def _get_default_value(self, type_name: str) -> str: |
||||
"""Get default value for non-optional types""" |
||||
if "String" in type_name: |
||||
return "\"\"" |
||||
elif "Int" in type_name: |
||||
return "0" |
||||
elif "Double" in type_name: |
||||
return "0.0" |
||||
elif "Bool" in type_name: |
||||
return "false" |
||||
elif "Date" in type_name: |
||||
return "Date()" |
||||
else: |
||||
return "nil" # For any other type |
||||
|
||||
def get_output_filename(self, model_name: str) -> str: |
||||
"""Generate the output filename for a model.""" |
||||
return f"Base{model_name}.swift" |
||||
|
||||
def make_resource_name(self, text): |
||||
p = inflect.engine() |
||||
# Split camelCase into words |
||||
words = re.findall('[A-Z][^A-Z]*', text) |
||||
|
||||
if not words: |
||||
words = [text] |
||||
|
||||
words = [word.lower() for word in words] |
||||
words[-1] = p.plural(words[-1]) |
||||
return '-'.join(words) |
||||
|
||||
def process_directory(input_dir: str, output_dir: str, logger: logging.Logger, dry_run: bool = False) -> int: |
||||
"""Process all JSON files in the input directory and generate Swift models.""" |
||||
try: |
||||
input_path = validate_directory(input_dir) |
||||
if not dry_run: |
||||
output_path = validate_directory(output_dir, create=True) |
||||
|
||||
json_files = list(input_path.glob("*.json")) |
||||
if not json_files: |
||||
logger.warning(f"No JSON files found in '{input_dir}'") |
||||
return 0 |
||||
|
||||
logger.info(f"Found {len(json_files)} JSON files to process") |
||||
successful_files = 0 |
||||
|
||||
for json_file in json_files: |
||||
try: |
||||
with open(json_file, 'r') as f: |
||||
json_data = json.load(f) |
||||
|
||||
generator = SwiftModelGenerator(json_data) |
||||
|
||||
# Generate each model in the JSON file |
||||
for model in json_data["models"]: |
||||
model_name = model["name"] |
||||
swift_code = generator.generate_model(model) |
||||
|
||||
if dry_run: |
||||
logger.info(f"Would generate Base{model_name}.swift") |
||||
continue |
||||
|
||||
# Write to output file with Base prefix |
||||
output_file = output_path / generator.get_output_filename(model_name) |
||||
with open(output_file, 'w') as f: |
||||
f.write(swift_code) |
||||
|
||||
logger.info(f"Generated Base{model_name}.swift") |
||||
|
||||
successful_files += 1 |
||||
|
||||
except json.JSONDecodeError as e: |
||||
logger.error(f"Error parsing {json_file.name}: {e}") |
||||
except KeyError as e: |
||||
logger.error(f"Missing required key in {json_file.name}: {e}") |
||||
except Exception as e: |
||||
logger.error(f"Error processing {json_file.name}: {e}") |
||||
|
||||
return successful_files |
||||
|
||||
except Exception as e: |
||||
logger.error(f"Fatal error: {e}") |
||||
return 0 |
||||
|
||||
|
||||
def setup_logging(verbose: bool) -> logging.Logger: |
||||
"""Configure logging based on verbosity level.""" |
||||
logger = logging.getLogger('SwiftModelGenerator') |
||||
handler = logging.StreamHandler() |
||||
|
||||
if verbose: |
||||
logger.setLevel(logging.DEBUG) |
||||
handler.setFormatter(logging.Formatter( |
||||
'%(asctime)s - %(levelname)s - %(message)s' |
||||
)) |
||||
else: |
||||
logger.setLevel(logging.INFO) |
||||
handler.setFormatter(logging.Formatter('%(message)s')) |
||||
|
||||
logger.addHandler(handler) |
||||
return logger |
||||
|
||||
def validate_directory(path: str, create: bool = False) -> Path: |
||||
"""Validate and optionally create a directory.""" |
||||
dir_path = Path(path) |
||||
if dir_path.exists(): |
||||
if not dir_path.is_dir(): |
||||
raise ValueError(f"'{path}' exists but is not a directory") |
||||
elif create: |
||||
dir_path.mkdir(parents=True) |
||||
else: |
||||
raise ValueError(f"Directory '{path}' does not exist") |
||||
return dir_path |
||||
|
||||
def main(): |
||||
parser = argparse.ArgumentParser( |
||||
description="Generate Swift model classes from JSON definitions", |
||||
epilog="Example: %(prog)s -i ./model_definitions -o ../MyProject/Models" |
||||
) |
||||
|
||||
parser.add_argument( |
||||
"-i", "--input-dir", |
||||
required=True, |
||||
help="Directory containing JSON model definitions" |
||||
) |
||||
|
||||
parser.add_argument( |
||||
"-o", "--output-dir", |
||||
required=True, |
||||
help="Directory where Swift files will be generated" |
||||
) |
||||
|
||||
parser.add_argument( |
||||
"-v", "--verbose", |
||||
action="store_true", |
||||
help="Enable verbose output" |
||||
) |
||||
|
||||
parser.add_argument( |
||||
"--dry-run", |
||||
action="store_true", |
||||
help="Show what would be generated without actually creating files" |
||||
) |
||||
|
||||
parser.add_argument( |
||||
"--version", |
||||
action="version", |
||||
version="%(prog)s 1.0.0" |
||||
) |
||||
|
||||
args = parser.parse_args() |
||||
|
||||
# Setup logging |
||||
logger = setup_logging(args.verbose) |
||||
|
||||
# Process the directories |
||||
start_time = datetime.now() |
||||
logger.info("Starting model generation...") |
||||
|
||||
successful_files = process_directory( |
||||
args.input_dir, |
||||
args.output_dir, |
||||
logger, |
||||
args.dry_run |
||||
) |
||||
|
||||
# Report results |
||||
duration = datetime.now() - start_time |
||||
logger.info(f"\nGeneration completed in {duration.total_seconds():.2f} seconds") |
||||
logger.info(f"Successfully processed {successful_files} files") |
||||
|
||||
# Return appropriate exit code |
||||
sys.exit(0 if successful_files > 0 else 1) |
||||
|
||||
if __name__ == "__main__": |
||||
main() |
||||
Loading…
Reference in new issue