map, player, game, gamemode data now database driven
This commit is contained in:
35
Sources/App/Controllers/MapsController.swift
Normal file
35
Sources/App/Controllers/MapsController.swift
Normal 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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user