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 38eb98e68b - Show all commits

View File

@@ -172,7 +172,8 @@ const latest = () => {
};
// lottery - byDate
const groupByDate = (includeWines = false, sort = "desc") => {
const groupByDate = (includeWines = false, sort = "asc") => {
const sortDirection = sort == "asc" ? -1 : 1;
const query = [
{
$unwind: "$wins"
@@ -198,7 +199,7 @@ const groupByDate = (includeWines = false, sort = "desc") => {
},
{
$sort: {
_id: -1
date: sortDirection
}
}
];
@@ -214,7 +215,7 @@ const groupByDate = (includeWines = false, sort = "desc") => {
});
}
return Winner.aggregate(query).then(lotteries => (sort != "asc" ? lotteries : lotteries.reverse()));
return Winner.aggregate(query);
};
// highscore - byColor