diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/api/routes/sticker-packs/index.ts | 22 | ||||
-rw-r--r-- | src/util/schemas/responses/StickerPacksResponse.ts | 3 | ||||
-rw-r--r-- | src/util/schemas/responses/index.ts | 1 |
3 files changed, 21 insertions, 5 deletions
diff --git a/src/api/routes/sticker-packs/index.ts b/src/api/routes/sticker-packs/index.ts index 234e03c6..627ce061 100644 --- a/src/api/routes/sticker-packs/index.ts +++ b/src/api/routes/sticker-packs/index.ts @@ -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; diff --git a/src/util/schemas/responses/StickerPacksResponse.ts b/src/util/schemas/responses/StickerPacksResponse.ts new file mode 100644 index 00000000..4f382df0 --- /dev/null +++ b/src/util/schemas/responses/StickerPacksResponse.ts @@ -0,0 +1,3 @@ +import { StickerPack } from "../../entities"; + +export type StickerPacksResponse = StickerPack[]; diff --git a/src/util/schemas/responses/index.ts b/src/util/schemas/responses/index.ts index 1e4f30cb..3f29b779 100644 --- a/src/util/schemas/responses/index.ts +++ b/src/util/schemas/responses/index.ts @@ -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"; |