oapi: sticker packs

This commit is contained in:
Puyodead1 committed 2023-04-13 15:32:37 -04:00
1 parent a1d8869271
commit ad5f5cb90d
5 files changed
+21 -5

No files matched your search

+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;
@@ -0,0 +1,3 @@
import { StickerPack } from "../../entities";
export type StickerPacksResponse = StickerPack[];
+1
View File
@@ -36,6 +36,7 @@ export * from "./LimitsConfigurationResponse";
export * from "./LocationMetadataResponse";
export * from "./MemberJoinGuildResponse";
export * from "./OAuthAuthorizeResponse";
export * from "./StickerPacksResponse";
export * from "./Tenor";
export * from "./TokenResponse";
export * from "./UserProfileResponse";