song and nostar searching

This commit is contained in:
oatmealine 2020-01-25 17:37:29 +03:00
parent 783c373d41
commit e52f31882f
No known key found for this signature in database
GPG Key ID: C4CB49CFAD721145
1 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,15 @@ module.exports = (app, db) : void => {
if (req.body.twoPlayer != '0') searchQuery.twoPlayer = true;
if (req.body.star) searchQuery.stars = {$gt: 0};
if (req.body.original != '0') searchQuery.original = true;
if (req.body.noStar) searchQuery.stars = 0;
if (req.body.song) {
if (Number(req.body.song) <= 50) { // lets assume a limit of 50 official songs
searchQuery.audio_track = Number(req.body.song); // official song
} else {
searchQuery.song_id = Number(req.body.song); // newgrounds/custom songs
}
}
if (req.body.diff != '-') {
// if the client requests -1, -2 or -3 then it cant request any other difficulties