fixed bug with recording matches on older versions, added colour scheme models
This commit is contained in:
52
Sources/App/Models/ColourScheme.swift
Normal file
52
Sources/App/Models/ColourScheme.swift
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ColourScheme.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/31/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
final class ColourScheme: Model, Content {
|
||||
// Name of the table or collection.
|
||||
static let schema = "color_scheme"
|
||||
|
||||
@ID(key: .id)
|
||||
var id: UUID?
|
||||
|
||||
@Field(key: "game_id")
|
||||
var gameId: Int
|
||||
|
||||
@Field(key: "tile_colour")
|
||||
var tileColour: String?
|
||||
|
||||
@Field(key: "win_colour")
|
||||
var winColour: String?
|
||||
|
||||
@Field(key: "loss_colour")
|
||||
var lossColour: String?
|
||||
|
||||
|
||||
// Creates a new, empty .
|
||||
init() { }
|
||||
|
||||
// Creates a new with all properties set.
|
||||
init(id: UUID? = nil, gameId: Int, tileColour: String?,winColour: String?,lossColour: String? ) {
|
||||
self.id = id
|
||||
self.gameId = gameId
|
||||
self.tileColour = tileColour
|
||||
self.winColour = winColour
|
||||
self.lossColour = lossColour
|
||||
|
||||
}
|
||||
|
||||
|
||||
var colorSchemeConfig: ColorSchemeConfig {
|
||||
return ColorSchemeConfig(gameId: gameId, tileColour: tileColour, winColour:winColour, lossColour:lossColour)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ final class Game: Model, Content {
|
||||
self.gameId = gameId
|
||||
self.name = name
|
||||
self.maps = maps
|
||||
self.enabled = enabled
|
||||
self.enabled = enabled
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,13 +48,13 @@ final class Match: Model, Content {
|
||||
|
||||
|
||||
@Field(key: "lossReason")
|
||||
var lossReason: Int
|
||||
var lossReason: Int?
|
||||
|
||||
|
||||
|
||||
init() { }
|
||||
|
||||
init(id: UUID? = nil, map:String?, win:Bool, date:Date, roundsWon:Int?, roundsLost:Int?, codGame:String?, notes:String?, players:String?, sweaty:Bool?, finalKillRuinedPlayerId:Int?, numberOfFinalKillsRuined:Int?,competitive:Bool, gameMode:Int, lossReason:Int) {
|
||||
init(id: UUID? = nil, map:String?, win:Bool, date:Date, roundsWon:Int?, roundsLost:Int?, codGame:String?, notes:String?, players:String?, sweaty:Bool?, finalKillRuinedPlayerId:Int?, numberOfFinalKillsRuined:Int?,competitive:Bool, gameMode:Int, lossReason:Int = 0) {
|
||||
self.id = id
|
||||
self.map = map
|
||||
self.win = win
|
||||
|
||||
Reference in New Issue
Block a user