diff options
author | The Arcane Brony <myrainbowdash949@gmail.com> | 2021-10-01 22:43:58 +0200 |
---|---|---|
committer | The Arcane Brony <myrainbowdash949@gmail.com> | 2021-10-01 22:43:58 +0200 |
commit | c772816fd9037505baebc6f82fb4185ff4d2abf0 (patch) | |
tree | 03020bdc75a34849726d9e114ba4aedab3488c5f /api | |
parent | Add setting to show all guilds in discovery, fix query for guild discovery (diff) | |
download | server-c772816fd9037505baebc6f82fb4185ff4d2abf0.tar.xz |
Add default value to guild discovery"
Diffstat (limited to 'api')
-rw-r--r-- | api/src/routes/discoverable-guilds.ts | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/api/src/routes/discoverable-guilds.ts b/api/src/routes/discoverable-guilds.ts index 509abc9e..b626b084 100644 --- a/api/src/routes/discoverable-guilds.ts +++ b/api/src/routes/discoverable-guilds.ts @@ -9,11 +9,10 @@ const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { const { limit } = req.params; var showAllGuilds = Config.get().guild.showAllGuildsInDiscovery; - // ! this only works using SQL querys // TODO: implement this with default typeorm query // const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) }); - const guilds = showAllGuilds ? await Guild.find({take: Math.abs(Number(limit))}) : await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit)) }); + const guilds = showAllGuilds ? await Guild.find({take: Math.abs(Number(limit || 20))}) : await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit || 20)) }); res.send({ guilds: guilds }); }); |