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)
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user