summary refs log tree commit diff
path: root/src/api/routes/users
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-04-19 22:14:01 +0200
committerRory& <root@rory.gay>2026-04-19 22:45:37 +0200
commitaf29e6b178493c4d323edb9a7838d7731e40df86 (patch)
tree70e1357da5d86d72c29ba3dcfa0277e7519a8d44 /src/api/routes/users
parenteslint: no-promise-executor-return (diff)
downloadserver-ts-af29e6b178493c4d323edb9a7838d7731e40df86.tar.xz
eslint: arrow-body-style=as-needed
Diffstat (limited to 'src/api/routes/users')
-rw-r--r--src/api/routes/users/@me/mentions.ts24
-rw-r--r--src/api/routes/users/@me/mfa/webauthn/credentials/index.ts9
-rw-r--r--src/api/routes/users/@me/relationships.ts14
3 files changed, 19 insertions, 28 deletions
diff --git a/src/api/routes/users/@me/mentions.ts b/src/api/routes/users/@me/mentions.ts

index d3c05b44..87602b3c 100644 --- a/src/api/routes/users/@me/mentions.ts +++ b/src/api/routes/users/@me/mentions.ts
@@ -137,20 +137,18 @@ router.get( }, take: limit, }) - ).map((m) => { - return { - ...m.toJSON(), - attachments: m.attachments?.map((attachment: Attachment) => - Attachment.prototype.signUrls.call( - attachment, - new NewUrlUserSignatureData({ - ip: req.ip, - userAgent: req.headers["user-agent"] as string, - }), - ), + ).map((m) => ({ + ...m.toJSON(), + attachments: m.attachments?.map((attachment: Attachment) => + Attachment.prototype.signUrls.call( + attachment, + new NewUrlUserSignatureData({ + ip: req.ip, + userAgent: req.headers["user-agent"] as string, + }), ), - }; - }); + ), + })); console.log(`[Inbox/mentions] User ${user.id} fetched full message data for ${finalMessages.length} messages in ${sw.elapsed().totalMilliseconds}ms`); diff --git a/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts b/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts
index f99f7b3d..778fb9d8 100644 --- a/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts +++ b/src/api/routes/users/@me/mfa/webauthn/credentials/index.ts
@@ -25,13 +25,8 @@ import { HTTPError } from "lambert-server"; import { CreateWebAuthnCredentialSchema, GenerateWebAuthnCredentialsSchema, WebAuthnPostSchema } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); -const isGenerateSchema = (body: WebAuthnPostSchema): body is GenerateWebAuthnCredentialsSchema => { - return "password" in body; -}; - -const isCreateSchema = (body: WebAuthnPostSchema): body is CreateWebAuthnCredentialSchema => { - return "credential" in body; -}; +const isGenerateSchema = (body: WebAuthnPostSchema): body is GenerateWebAuthnCredentialsSchema => "password" in body; +const isCreateSchema = (body: WebAuthnPostSchema): body is CreateWebAuthnCredentialSchema => "credential" in body; function toArrayBuffer(buf: Buffer) { const ab = new ArrayBuffer(buf.length); diff --git a/src/api/routes/users/@me/relationships.ts b/src/api/routes/users/@me/relationships.ts
index e049d152..5da62ce8 100644 --- a/src/api/routes/users/@me/relationships.ts +++ b/src/api/routes/users/@me/relationships.ts
@@ -64,8 +64,8 @@ router.put( }, }, }), - async (req: Request, res: Response) => { - return await updateRelationship( + async (req: Request, res: Response) => + await updateRelationship( req, res, await User.findOneOrFail({ @@ -74,8 +74,7 @@ router.put( select: userProjection, }), req.body.type ?? RelationshipType.friends, - ); - }, + ), ); router.patch( @@ -130,8 +129,8 @@ router.post( }, }, }), - async (req: Request, res: Response) => { - return await updateRelationship( + async (req: Request, res: Response) => + await updateRelationship( req, res, await User.findOneOrFail({ @@ -143,8 +142,7 @@ router.post( }, }), req.body.type, - ); - }, + ), ); router.delete(