summary refs log tree commit diff
path: root/api/src/routes/discoverable-guilds.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2022-08-13 02:00:50 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-13 22:00:55 +0200
commit5e86d7ab9c5200d794c3adb2b422d20a2aefd2ce (patch)
tree0a4b23ee96862077b21dea20cf71205709e15f7c /api/src/routes/discoverable-guilds.ts
parenttry to update build script (diff)
downloadserver-5e86d7ab9c5200d794c3adb2b422d20a2aefd2ce.tar.xz
restructure to single project
Diffstat (limited to 'api/src/routes/discoverable-guilds.ts')
-rw-r--r--api/src/routes/discoverable-guilds.ts39
1 files changed, 0 insertions, 39 deletions
diff --git a/api/src/routes/discoverable-guilds.ts b/api/src/routes/discoverable-guilds.ts
deleted file mode 100644

index 35ecf28c..00000000 --- a/api/src/routes/discoverable-guilds.ts +++ /dev/null
@@ -1,39 +0,0 @@ -import { Guild, Config } from "@fosscord/util"; - -import { Router, Request, Response } from "express"; -import { route } from ".."; -import { Like } from "typeorm"; - -const router = Router(); - -router.get("/", route({}), async (req: Request, res: Response) => { - const { offset, limit, categories } = req.query; - let showAllGuilds = Config.get().guild.discovery.showAllGuilds; - let configLimit = Config.get().guild.discovery.limit; - // ! this only works using SQL querys - // const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) }); - let guilds; - 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)) }); - } else { - guilds = showAllGuilds - ? 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) - }); -}); - -export default router;