oapi: sticker packs

This commit is contained in:
Puyodead1
2023-04-13 15:32:37 -04:00
parent a1d8869271
commit ad5f5cb90d
5 changed files with 21 additions and 5 deletions
+17 -5
View File
@@ -16,16 +16,28 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Request, Response, Router } from "express";
import { route } from "@spacebar/api";
import { StickerPack } from "@spacebar/util";
import { Request, Response, Router } from "express";
const router: Router = Router();
router.get("/", route({}), async (req: Request, res: Response) => {
const sticker_packs = await StickerPack.find({ relations: ["stickers"] });
router.get(
"/",
route({
responses: {
200: {
body: "StickerPacksResponse",
},
},
}),
async (req: Request, res: Response) => {
const sticker_packs = await StickerPack.find({
relations: ["stickers"],
});
res.json({ sticker_packs });
});
res.json({ sticker_packs });
},
);
export default router;