new history function
This commit is contained in:
@@ -23,10 +23,20 @@ struct StatsController: RouteCollection {
|
||||
statsRoute.get("test", use: test)
|
||||
statsRoute.post("logMatch", use: logMatch)
|
||||
|
||||
|
||||
statsRoute.get("history", use: history)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
func history(req: Request) throws -> EventLoopFuture<[Match]> {
|
||||
return Match.query(on: req.db).sort(\.$date, .descending).limit(20).all().map { (matches) -> ([Match]) in
|
||||
return matches
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func logMatch(req: Request) throws -> EventLoopFuture<Match> {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user