map, player, game, gamemode data now database driven
This commit is contained in:
31
Sources/App/Content/Config/Configuration.swift
Normal file
31
Sources/App/Content/Config/Configuration.swift
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Configuration.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/29/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
|
||||
|
||||
struct Configuration : Content {
|
||||
|
||||
var games:[GameConfig]
|
||||
var gameModes:[GameModeConfig]
|
||||
var gameModeGroups:[GameModeGroupConfig]
|
||||
var players:[PlayerConfig]
|
||||
var lossReasons:[LossReasonConfig]
|
||||
|
||||
|
||||
init (games:[GameConfig], gameModes:[GameModeConfig], gameModeGroups:[GameModeGroupConfig], players:[PlayerConfig], lossReasons:[LossReasonConfig]){
|
||||
self.games = games
|
||||
self.gameModes = gameModes
|
||||
self.gameModeGroups = gameModeGroups
|
||||
self.players = players
|
||||
self.lossReasons = lossReasons
|
||||
}
|
||||
|
||||
}
|
||||
22
Sources/App/Content/Config/GameConfig.swift
Normal file
22
Sources/App/Content/Config/GameConfig.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// GameConfig.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/29/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
struct GameConfig: Content {
|
||||
|
||||
var gameId: String
|
||||
var name: String
|
||||
var maps: [MapConfig]
|
||||
var enabled:Bool
|
||||
|
||||
|
||||
}
|
||||
18
Sources/App/Content/Config/GameModeConfig.swift
Normal file
18
Sources/App/Content/Config/GameModeConfig.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// GameModeConfig.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/29/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
struct GameModeConfig:Content {
|
||||
|
||||
var gameModeId:Int
|
||||
var name:String
|
||||
var competitive:Bool
|
||||
|
||||
}
|
||||
19
Sources/App/Content/Config/GameModeGroupConfig.swift
Normal file
19
Sources/App/Content/Config/GameModeGroupConfig.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// GameModeGroupConfig.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/29/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
|
||||
struct GameModeGroupConfig: Content {
|
||||
|
||||
var gameModeIds: String
|
||||
var gameModeGroupId: String
|
||||
var name: String
|
||||
|
||||
}
|
||||
15
Sources/App/Content/Config/LossReasonsConfig.swift
Normal file
15
Sources/App/Content/Config/LossReasonsConfig.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// LossReasonsConfig.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/30/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
struct LossReasonConfig: Content {
|
||||
var reasonId: Int
|
||||
var name: String
|
||||
}
|
||||
19
Sources/App/Content/Config/MapConfig.swift
Normal file
19
Sources/App/Content/Config/MapConfig.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MapConfig.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/29/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
struct MapConfig:Content, Hashable{
|
||||
|
||||
var mapId:Int
|
||||
var name:String
|
||||
var imageName:String
|
||||
var gameModeGroupIds:[String]
|
||||
|
||||
}
|
||||
15
Sources/App/Content/Config/PlayerConfig.swift
Normal file
15
Sources/App/Content/Config/PlayerConfig.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// PlayerConfig.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 10/30/21.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
struct PlayerConfig: Content {
|
||||
var playerId: Int
|
||||
var name: String
|
||||
}
|
||||
Reference in New Issue
Block a user