added post method for updating match
This commit is contained in:
@@ -26,6 +26,8 @@ struct StatsController: RouteCollection {
|
||||
|
||||
statsRoute.get("history","page",":page", use: history)
|
||||
statsRoute.get("history", use: history)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,43 +49,15 @@ struct StatsController: RouteCollection {
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
|
||||
|
||||
return Match.query(on: req.db).count().flatMap { (totalMatches) -> EventLoopFuture<MatchHistory> in
|
||||
|
||||
|
||||
return Match.query(on: req.db).sort(\.$date, .descending).limit(20).all().map { (matches) -> (MatchHistory) in
|
||||
|
||||
return MatchHistory(total:totalMatches, matches: matches, hasMorePages: totalMatches > 20)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// let startRecord = page * 20
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// if totalRecords.map
|
||||
//
|
||||
//
|
||||
// return Match.query(on: req.db).sort(\.$date, .descending).range(startRecord...).all().map { (matches) -> ([Match]) in
|
||||
// return matches
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// return Match.query(on: req.db).sort(\.$date, .descending).limit(20).all().map { (matches) -> ([Match]) in
|
||||
// return matches
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user