map, player, game, gamemode data now database driven
This commit is contained in:
51
Sources/App/Models/GameMode.swift
Normal file
51
Sources/App/Models/GameMode.swift
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// GameModes.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/29/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
final class GameMode: Model, Content {
|
||||
// Name of the table or collection.
|
||||
static let schema = "game_mode"
|
||||
|
||||
@ID(key: .id)
|
||||
var id: UUID?
|
||||
|
||||
@Field(key: "game_mode_id")
|
||||
var gameModeId: Int
|
||||
|
||||
@Field(key: "name")
|
||||
var name: String
|
||||
|
||||
@Field(key: "competitive")
|
||||
var competitive: Bool
|
||||
|
||||
|
||||
|
||||
|
||||
// Creates a new, empty .
|
||||
init() { }
|
||||
|
||||
// Creates a new with all properties set.
|
||||
init(id: UUID? = nil, gameModeId: Int, name: String, competitive:Bool) {
|
||||
self.id = id
|
||||
self.gameModeId = gameModeId
|
||||
self.name = name
|
||||
self.competitive = competitive
|
||||
|
||||
}
|
||||
|
||||
|
||||
var gameModeConfig:GameModeConfig {
|
||||
return GameModeConfig(gameModeId: gameModeId, name: name, competitive: competitive)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user