diff options
Diffstat (limited to 'src/api/routes/discovery.ts')
-rw-r--r-- | src/api/routes/discovery.ts | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/api/routes/discovery.ts b/src/api/routes/discovery.ts index 0c8089e4..79bbc686 100644 --- a/src/api/routes/discovery.ts +++ b/src/api/routes/discovery.ts @@ -16,24 +16,34 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Categories } from "@spacebar/util"; -import { Router, Response, Request } from "express"; import { route } from "@spacebar/api"; +import { Categories } from "@spacebar/util"; +import { Request, Response, Router } from "express"; const router = Router(); -router.get("/categories", route({}), async (req: Request, res: Response) => { - // TODO: - // Get locale instead +router.get( + "/categories", + route({ + responses: { + 200: { + body: "DiscoveryCategoriesResponse", + }, + }, + }), + async (req: Request, res: Response) => { + // TODO: + // Get locale instead - // const { locale, primary_only } = req.query; - const { primary_only } = req.query; + // const { locale, primary_only } = req.query; + const { primary_only } = req.query; - const out = primary_only - ? await Categories.find() - : await Categories.find({ where: { is_primary: true } }); + const out = primary_only + ? await Categories.find() + : await Categories.find({ where: { is_primary: true } }); - res.send(out); -}); + res.send(out); + }, +); export default router; |