// // Game.swift // App // // Created by Michael Simard on 10/29/21. // import Foundation import Fluent import Vapor final class Game: Model, Content { // Name of the table or collection. static let schema = "game" @ID(key: .id) var id: UUID? @Field(key: "game_id") var gameId: String @Field(key: "name") var name: String @Field(key: "maps") var maps: String @Field(key: "enabled") var enabled: Bool @Field(key: "short_name") var shortName: String @Field(key: "image_name") var imageName: String // Creates a new, empty . init() { } // Creates a new with all properties set. init(id: UUID? = nil, gameId: String, name: String, maps:String, enabled:Bool, shortName:String, imageName:String) { self.id = id self.gameId = gameId self.name = name self.maps = maps self.enabled = enabled self.shortName = shortName self.imageName = imageName } var mapIds:[Int] { maps.components(separatedBy: ",").map{Int($0)!} } }