diff --git a/assets/openapi.json b/assets/openapi.json index 7407a75..faf286c 100644 --- a/assets/openapi.json +++ b/assets/openapi.json @@ -27717,7 +27717,7 @@ ] } }, - "/users/@me/relationships/{id}": { + "/users/@me/relationships/{user_id}": { "put": { "security": [ { @@ -27761,13 +27761,13 @@ }, "parameters": [ { - "name": "id", + "name": "user_id", "in": "path", "required": true, "schema": { "type": "string" }, - "description": "id" + "description": "user_id" } ], "tags": [ @@ -27807,13 +27807,13 @@ }, "parameters": [ { - "name": "id", + "name": "user_id", "in": "path", "required": true, "schema": { "type": "string" }, - "description": "id" + "description": "user_id" } ], "tags": [ @@ -27821,7 +27821,7 @@ ] } }, - "/users/@me/notes/{id}": { + "/users/@me/notes/{user_id}": { "get": { "security": [ { @@ -27852,13 +27852,13 @@ }, "parameters": [ { - "name": "id", + "name": "user_id", "in": "path", "required": true, "schema": { "type": "string" }, - "description": "id" + "description": "user_id" } ], "tags": [ @@ -27898,13 +27898,13 @@ }, "parameters": [ { - "name": "id", + "name": "user_id", "in": "path", "required": true, "schema": { "type": "string" }, - "description": "id" + "description": "user_id" } ], "tags": [ diff --git a/src/api/middlewares/RateLimit.ts b/src/api/middlewares/RateLimit.ts index f5bfbb4..81ccbc5 100644 --- a/src/api/middlewares/RateLimit.ts +++ b/src/api/middlewares/RateLimit.ts @@ -209,9 +209,9 @@ ...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 254a835..82491e3 100644 --- a/src/api/routes/oauth2/applications/@me.ts +++ b/src/api/routes/oauth2/applications/@me.ts @@ -37,7 +37,7 @@ }), 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 64d0032..e468c36 100644 --- a/src/api/routes/users/@me/notes.ts +++ b/src/api/routes/users/@me/notes.ts @@ -23,7 +23,7 @@ const router: Router = Router({ mergeParams: true }); router.get( - "/:id", + "/:user_id", route({ responses: { 200: { @@ -35,25 +35,25 @@ }, }), 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 @@ }, }), 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 e806461..76746e3 100644 --- a/src/api/routes/users/@me/relationships.ts +++ b/src/api/routes/users/@me/relationships.ts @@ -72,7 +72,7 @@ ); router.put( - "/:id", + "/:user_id", route({ requestBody: "RelationshipPutSchema", responses: { @@ -90,7 +90,7 @@ 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.delete( - "/:id", + "/:user_id", route({ responses: { 204: {},