// // Map.swift // App // // Created by Michael Simard on 10/29/21. // import Fluent import Vapor final class Map: Model, Content { // Name of the table or collection. static let schema = "map" @ID(key: .id) var id: UUID? @Field(key: "name") var name: String @Field(key: "image_name") var imageName: String @Field(key: "game_mode_group_ids") var gameModeGroupIds: String @Field(key: "map_id") var mapId: Int // Creates a new, empty . init() { } // Creates a new with all properties set. init(id: UUID? = nil, name: String, imageName: String, gameModeGroupIds: String, mapId:Int) { self.id = id self.name = name self.imageName = imageName self.gameModeGroupIds = gameModeGroupIds self.mapId = mapId } var mapConfig:MapConfig { return MapConfig(mapId: mapId, name: name, imageName: imageName, gameModeGroupIds: gameModeGroupIds.components(separatedBy: ",")) } }