From 2cd210cb7cbd001269316d3b6ecbbe61d7bd3471 Mon Sep 17 00:00:00 2001 From: The Arcane Brony Date: Fri, 1 Oct 2021 22:43:58 +0200 Subject: [PATCH] Add default value to guild discovery" --- api/src/routes/discoverable-guilds.ts | 3 +-- 1 file changed, 1 insertion(+), 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 }); });