summary refs log tree commit diff
path: root/src/api/routes/users
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-10-11 04:08:46 +0200
committerRory& <root@rory.gay>2025-10-11 04:08:46 +0200
commitef9b4f5be7242c01ba4ec326f23d29064ce5c618 (patch)
treec6dc93a9610b7bfa23ed6847a2380e9abff834fc /src/api/routes/users
parentUpdate path variables (diff)
downloadserver-ts-ef9b4f5be7242c01ba4ec326f23d29064ce5c618.tar.xz
Update more path variables
Diffstat (limited to 'src/api/routes/users')
-rw-r--r--src/api/routes/users/@me/notes.ts14
-rw-r--r--src/api/routes/users/@me/relationships.ts6
2 files changed, 10 insertions, 10 deletions
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: {},