Feat/controllers - refactor entire backend and new admin interface #75

Merged
KevinMidboe merged 117 commits from feat/controllers into master 2021-02-19 00:19:52 +00:00
Showing only changes of commit bca4558d59 - Show all commits

View File

@@ -269,7 +269,7 @@ const groupByColor = (includeWines = false) => {
// highscore - byWineOccurences
// highscore - byWinCount
const orderByWins = (includeWines = false) => {
const orderByWins = (includeWines = false, limit = undefined) => {
let query = [
{
$project: {
@@ -315,16 +315,15 @@ const orderByWins = (includeWines = false) => {
query = includeWinesSubQuery.concat(query);
}
return Winner.aggregate(query);
return Winner.aggregate(query).then(winners => {
if (limit == null) {
return winners;
}
return winners.slice(0, limit);
});
};
// highscore - deleteWinner : remove for GDPR purpose
// lottery - deleteWinner : remove for GDPR purpose
// lottery - update : manual lottery
// lottery - add : manual lottery
// lottery - archive
module.exports = {
addWinnerWithWine,
all,