mirror of
https://github.com/spacebarchat/server.git
synced 2026-09-17 18:56:46 +00:00
Document audit log endpoint somewhat
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
@@ -16,7 +16,18 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ChannelPermissionOverwrite } from "@spacebar/schemas";
|
||||
import { AutomodRuleSchema, ChannelPermissionOverwrite, PartialUser, PublicChannel, WebhookResponse } from "@spacebar/schemas";
|
||||
|
||||
export interface AuditLogResponse {
|
||||
audit_log_entries: unknown[]; // TODO: type
|
||||
application_commands: unknown[]; // TODO: type
|
||||
auto_moderation_rules: AutomodRuleSchema[];
|
||||
guild_scheduled_events: unknown[]; // TODO: type
|
||||
integrations: unknown[]; // TODO: type
|
||||
threads: PublicChannel[];
|
||||
users: PartialUser[];
|
||||
webhooks: WebhookResponse[];
|
||||
}
|
||||
|
||||
export enum AuditLogEvents {
|
||||
// guild level
|
||||
|
||||
Reference in New Issue
Block a user