map, player, game, gamemode data now database driven

This commit is contained in:
Michael Simard
2021-10-31 00:01:27 -05:00
parent b0b0b7bc60
commit 64a66e28b8
22 changed files with 711 additions and 143 deletions

View File

@@ -0,0 +1,35 @@
//
// MapsController.swift
// App
//
// Created by Michael Simard on 10/29/21.
//
import Fluent
import Vapor
import Foundation
struct MapsController: RouteCollection {
func boot(routes: RoutesBuilder) throws {
let matchRoute = routes.grouped("cod-tracker","api", "maps")
matchRoute.get("all", use: maps)
matchRoute.get("game-modes", use: gameModes)
matchRoute.get("game-mode-groups", use: gameModeGroups)
}
func maps(req:Request) -> EventLoopFuture<[Map]>{
return Map.query(on: req.db).all()
}
func gameModes(req:Request) -> EventLoopFuture<[GameMode]>{
return GameMode.query(on: req.db).all()
}
func gameModeGroups(req:Request) -> EventLoopFuture<[GameModeGroup]>{
return GameModeGroup.query(on: req.db).all()
}
}