Files
cod-backend/Sources/App/Models/Map.swift
2021-10-31 00:01:27 -05:00

49 lines
1022 B
Swift

//
// 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: ","))
}
}