1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-07 03:12:39 +01:00
server/api/src/routes/discoverable-guilds.ts
Flam3rboy 1cd4b81917 Revert "🚧 webhook"
This reverts commit f691aa4c5a.
2021-09-16 20:49:07 +02:00

18 lines
632 B
TypeScript

import { Guild } from "@fosscord/util";
import { Router, Request, Response } from "express";
import { route } from "@fosscord/api";
const router = Router();
router.get("/", route({}), async (req: Request, res: Response) => {
const { limit } = req.params;
// ! 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 = await Guild.find({ where: `"features" LIKE 'COMMUNITY'`, take: Math.abs(Number(limit)) });
res.send({ guilds: guilds });
});
export default router;