diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2022-07-18 19:22:48 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-09 23:28:27 +0200 |
commit | 14e0842dfbc7bc67fb50be0b8dbf6443e5413687 (patch) | |
tree | 8dd696a04025a84e203055d899eacfb22c87a398 /api/src/routes/discoverable-guilds.ts | |
parent | Update FindConditions => FindOptionsWhere in BaseClass (diff) | |
download | server-14e0842dfbc7bc67fb50be0b8dbf6443e5413687.tar.xz |
fix ts errors
Diffstat (limited to 'api/src/routes/discoverable-guilds.ts')
-rw-r--r-- | api/src/routes/discoverable-guilds.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/api/src/routes/discoverable-guilds.ts b/api/src/routes/discoverable-guilds.ts index 984916f4..fb7b844f 100644 --- a/api/src/routes/discoverable-guilds.ts +++ b/api/src/routes/discoverable-guilds.ts @@ -16,19 +16,24 @@ router.get("/", route({}), async (req: Request, res: Response) => { if (categories == undefined) { guilds = showAllGuilds ? await Guild.find({ take: Math.abs(Number(limit || configLimit)) }) - : await Guild.find({ where: `"features" LIKE '%DISCOVERABLE%'`, take: Math.abs(Number(limit || configLimit)) }); + : await Guild.find({ where: { features: Like("%DISCOVERABLE%") }, take: Math.abs(Number(limit || configLimit)) }); } else { guilds = showAllGuilds - ? await Guild.find({ where: `"primary_category_id" = ${categories}`, take: Math.abs(Number(limit || configLimit)) }) - : await Guild.find({ - where: `"primary_category_id" = ${categories} AND "features" LIKE '%DISCOVERABLE%'`, - take: Math.abs(Number(limit || configLimit)) - }); + ? await Guild.find({ where: { primary_category_id: Number(categories) }, take: Math.abs(Number(limit || configLimit)) }) + : await Guild.find({ + where: { primary_category_id: Number(categories), features: Like("%DISCOVERABLE%") }, + take: Math.abs(Number(limit || configLimit)) + }); } const total = guilds ? guilds.length : undefined; - res.send({ total: total, guilds: guilds, offset: Number(offset || Config.get().guild.discovery.offset), limit: Number(limit || configLimit) }); + res.send({ + total: total, + guilds: guilds, + offset: Number(offset || Config.get().guild.discovery.offset), + limit: Number(limit || configLimit) + }); }); export default router; |