diff options
Diffstat (limited to 'api/src/routes/discovery.ts')
-rw-r--r-- | api/src/routes/discovery.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/api/src/routes/discovery.ts b/api/src/routes/discovery.ts index bc495d42..1991400e 100644 --- a/api/src/routes/discovery.ts +++ b/api/src/routes/discovery.ts @@ -1,12 +1,18 @@ +import { Categories } from "@fosscord/util"; import { Router, Response, Request } from "express"; import { route } from "@fosscord/api"; const router = Router(); -router.get("/categories", route({}), (req: Request, res: Response) => { +router.get("/categories", route({}), async (req: Request, res: Response) => { // TODO: - //const { locale, primary_only } = req.query; - res.json([]).status(200); + // Get locale instead + + const { locale, primary_only } = req.query; + + const out = primary_only ? await Categories.find() : await Categories.find({ where: `"is_primary" = "true"` }); + + res.send(out); }); export default router; |