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