summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-08-31 04:29:33 +0200
committerRory& <root@rory.gay>2026-08-31 04:29:33 +0200
commit14d59653d70c9649ae8851942e845e57eb7cc87a (patch)
treedcb5a4ea846264378cb6af553803771c0e4f6daf /src/api
parentOAuth2 userinfo endpoint (diff)
downloadserver-ts-14d59653d70c9649ae8851942e845e57eb7cc87a.tar.xz
Document audit log endpoint somewhat
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/guilds/#guild_id/audit-logs.ts70
1 files changed, 58 insertions, 12 deletions
diff --git a/src/api/routes/guilds/#guild_id/audit-logs.ts b/src/api/routes/guilds/#guild_id/audit-logs.ts

index e8765a99b..2f99aea00 100644 --- a/src/api/routes/guilds/#guild_id/audit-logs.ts +++ b/src/api/routes/guilds/#guild_id/audit-logs.ts
@@ -1,6 +1,6 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors + Copyright (C) 2026 Spacebar and Spacebar Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -18,18 +18,64 @@ import { Router, Response, Request } from "express"; import { route } from "@spacebar/api/middlewares"; +import { AuditLogResponse } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); //TODO: implement audit logs -router.get("/", route({}), (req: Request, res: Response) => { - res.json({ - audit_log_entries: [], - users: [], - integrations: [], - webhooks: [], - guild_scheduled_events: [], - threads: [], - application_commands: [], - }); -}); +router.get( + "/", + route({ + permission: "VIEW_AUDIT_LOG", + query: { + before: { + required: false, + type: "string", + description: "Entries before this ID", + }, + after: { + required: false, + type: "string", + description: "Entries after this ID", + }, + limit: { + required: false, + type: "number", + description: "Amount of results to return", + default: 50, + }, + user_id: { + required: false, + type: "string", + description: "User ID of the user taking the action", + }, + target_id: { + required: false, + type: "string", + description: "User ID of the user targeted by the action", + }, + action_type: { + required: false, + type: "number", + description: "Type of audit log event", + }, + }, + responses: { + 200: { + body: "AuditLogResponse", + }, + }, + }), + (req: Request, res: Response) => { + res.json({ + audit_log_entries: [], + users: [], + integrations: [], + webhooks: [], + guild_scheduled_events: [], + threads: [], + application_commands: [], + auto_moderation_rules: [], + } satisfies AuditLogResponse); + }, +); export default router;