parent
6996ed5e09
commit
f8a34de73f
@ -1,39 +0,0 @@ |
||||
// |
||||
// ClubV1.swift |
||||
// PadelClub |
||||
// |
||||
// Created by Laurent Morvillier on 07/02/2024. |
||||
// |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
|
||||
class ClubV1 : ModelObject, Storable, MigrationSource { |
||||
|
||||
static func resourceName() -> String { return "clubs" } |
||||
|
||||
var id: String = Store.randomId() |
||||
var name: String |
||||
|
||||
init(name: String) { |
||||
self.name = name |
||||
} |
||||
|
||||
var tournaments: [Tournament] { |
||||
return [] |
||||
} |
||||
|
||||
override func deleteDependencies() throws { |
||||
try Store.main.deleteDependencies(items: self.tournaments) |
||||
} |
||||
|
||||
// MARK: - MigrationSource |
||||
|
||||
typealias Destination = Club |
||||
|
||||
func migrate() -> Club { |
||||
return Club(name: self.name, acronym: "test", address: "3 impasse des chevreuils") |
||||
// return Club(name: self.name, address: "3 impasse des chevreuils") |
||||
} |
||||
|
||||
} |
||||
@ -1,34 +0,0 @@ |
||||
// |
||||
// Tournament_v1.swift |
||||
// PadelClub |
||||
// |
||||
// Created by Laurent Morvillier on 07/02/2024. |
||||
// |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
|
||||
class TournamentV1 : ModelObject, Storable, MigrationSource { |
||||
|
||||
static func resourceName() -> String { "tournaments" } |
||||
|
||||
var id: String = Store.randomId() |
||||
var name: String |
||||
var club_id: String |
||||
|
||||
init(name: String, club_id: String) { |
||||
self.name = name |
||||
self.club_id = club_id |
||||
} |
||||
|
||||
var club: Club? { return self.findById(self.club_id) } |
||||
|
||||
// MARK: - MigrationSource |
||||
|
||||
typealias Destination = TournamentV2 |
||||
|
||||
func migrate() -> TournamentV2 { |
||||
return TournamentV2(name: self.name, club_id: self.club_id, category: 0) |
||||
} |
||||
|
||||
} |
||||
@ -1,36 +0,0 @@ |
||||
// |
||||
// TournamentV2.swift |
||||
// PadelClub |
||||
// |
||||
// Created by Laurent Morvillier on 07/02/2024. |
||||
// |
||||
|
||||
import Foundation |
||||
import LeStorage |
||||
|
||||
class TournamentV2 : ModelObject, Storable, MigrationSource { |
||||
|
||||
static func resourceName() -> String { "tournaments" } |
||||
|
||||
var id: String = Store.randomId() |
||||
var name: String |
||||
var club_id: String |
||||
var category: Int |
||||
|
||||
init(name: String, club_id: String, category: Int) { |
||||
self.name = name |
||||
self.club_id = club_id |
||||
self.category = category |
||||
} |
||||
|
||||
var club: Club? { return self.findById(self.club_id) } |
||||
|
||||
// MARK: - MigrationSource |
||||
|
||||
typealias Destination = Tournament |
||||
|
||||
func migrate() -> Tournament { |
||||
return Tournament.mock() |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue