From ef9b4f5be7242c01ba4ec326f23d29064ce5c618 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sat, 11 Oct 2025 04:08:46 +0200 Subject: [PATCH] Update more path variables --- assets/openapi.json | Bin 1512590 -> 1512640 bytes src/api/middlewares/RateLimit.ts | 6 +++--- src/api/routes/oauth2/applications/@me.ts | 2 +- src/api/routes/users/@me/notes.ts | 14 +++++++------- src/api/routes/users/@me/relationships.ts | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/assets/openapi.json b/assets/openapi.json index 7407a75a0d90860ead6650ee707e1f902d925f8e..faf286c9a59d9e2224e9e8f8f4e248f598f0437e 100644 GIT binary patch delta 185 zcmeBM8FOG|OhXG}3sVbo3rh=Y3tJ0&3r7oQ3s(zw3r`Dg3ttO=i@+8^*3RkuPehHk zKQI!^W!%1?OK=*?_Wy50{TZik=nzz!exP1ddwallL0QJ_2`nN-%uu-n(*%7%`lPlu zlnQNQoG$Q&mu35&8G;o|$eJ$*2?}gqKS!_&$w;^90jmTh+wU$C1Y#i|76xJwAQs(z Jcahk}LIC$8OhW(w delta 163 zcmX@GGNx~3OhXG}3sVbo3rh=Y3tJ0&3r7oQ3s(zw3r`Dg3ttO=i@+8^*3Rh#KSV{h z%XbROux)SP6nABuzM(@`~1d0Gf8apxo diff --git a/src/api/middlewares/RateLimit.ts b/src/api/middlewares/RateLimit.ts index f5bfbb4f..81ccbc51 100644 --- a/src/api/middlewares/RateLimit.ts +++ b/src/api/middlewares/RateLimit.ts @@ -209,9 +209,9 @@ export async function initRateLimits(app: Router) { ...error, }), ); - app.use("/guilds/:id", rateLimit(routes.guild)); - app.use("/webhooks/:id", rateLimit(routes.webhook)); - app.use("/channels/:id", rateLimit(routes.channel)); + app.use("/guilds/:guild_id", rateLimit(routes.guild)); + app.use("/webhooks/:webhook_id", rateLimit(routes.webhook)); + app.use("/channels/:channel_id", rateLimit(routes.channel)); app.use("/auth/login", rateLimit(routes.auth.login)); app.use( "/auth/register", diff --git a/src/api/routes/oauth2/applications/@me.ts b/src/api/routes/oauth2/applications/@me.ts index 254a835e..82491e33 100644 --- a/src/api/routes/oauth2/applications/@me.ts +++ b/src/api/routes/oauth2/applications/@me.ts @@ -37,7 +37,7 @@ router.get( }), async (req: Request, res: Response) => { const app = await Application.findOneOrFail({ - where: { id: req.params.id }, + where: { id: req.params.id }, // ...huh? there's no ID in the path... relations: ["bot", "owner"], select: { owner: Object.fromEntries( diff --git a/src/api/routes/users/@me/notes.ts b/src/api/routes/users/@me/notes.ts index 64d0032f..e468c36f 100644 --- a/src/api/routes/users/@me/notes.ts +++ b/src/api/routes/users/@me/notes.ts @@ -23,7 +23,7 @@ import { Request, Response, Router } from "express"; const router: Router = Router({ mergeParams: true }); router.get( - "/:id", + "/:user_id", route({ responses: { 200: { @@ -35,25 +35,25 @@ router.get( }, }), async (req: Request, res: Response) => { - const { id } = req.params; + const { user_id } = req.params; const note = await Note.findOneOrFail({ where: { owner: { id: req.user_id }, - target: { id: id }, + target: { id: user_id }, }, }); return res.json({ note: note?.content, - note_user_id: id, + note_user_id: user_id, user_id: req.user_id, }); }, ); router.put( - "/:id", + "/:user_id", route({ requestBody: "UserNoteUpdateSchema", responses: { @@ -64,9 +64,9 @@ router.put( }, }), async (req: Request, res: Response) => { - const { id } = req.params; + const { user_id } = req.params; const owner = await User.findOneOrFail({ where: { id: req.user_id } }); - const target = await User.findOneOrFail({ where: { id: id } }); //if noted user does not exist throw + const target = await User.findOneOrFail({ where: { id: user_id } }); //if noted user does not exist throw const { note } = req.body; if (note && note.length) { diff --git a/src/api/routes/users/@me/relationships.ts b/src/api/routes/users/@me/relationships.ts index e8064615..76746e3f 100644 --- a/src/api/routes/users/@me/relationships.ts +++ b/src/api/routes/users/@me/relationships.ts @@ -72,7 +72,7 @@ router.get( ); router.put( - "/:id", + "/:user_id", route({ requestBody: "RelationshipPutSchema", responses: { @@ -90,7 +90,7 @@ router.put( req, res, await User.findOneOrFail({ - where: { id: req.params.id }, + where: { id: req.params.user_id }, relations: ["relationships", "relationships.to"], select: userProjection, }), @@ -134,7 +134,7 @@ router.post( ); router.delete( - "/:id", + "/:user_id", route({ responses: { 204: {},