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 | 2cd210cb7cbd001269316d3b6ecbbe61d7bd3471 (patch) | |
tree | ed4d5e29a9edef940155fe5dd6ec5ee1f573a712 /api | |
parent | Add setting to show all guilds in discovery, fix query for guild discovery (diff) | |
download | server-2cd210cb7cbd001269316d3b6ecbbe61d7bd3471.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 }); }); |