map, player, game, gamemode data now database driven
This commit is contained in:
48
Sources/App/Models/Map.swift
Normal file
48
Sources/App/Models/Map.swift
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// 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: ","))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user