This commit is contained in:
Bryan1029384756
2026-04-18 15:41:51 -05:00
parent 938df217f4
commit 593eaba82e
47 changed files with 3539 additions and 212 deletions

View File

@@ -1,6 +1,7 @@
import { query, mutation, internalMutation } from "./_generated/server";
import { v } from "convex/values";
import { getRolesForUser } from "./roles";
import { AUDIT_ACTIONS, logAudit } from "./audit";
export const get = query({
args: {},
@@ -58,6 +59,13 @@ export const update = mutation({
});
}
await logAudit(ctx, {
actorId: args.userId,
action: AUDIT_ACTIONS.SERVER_SETTINGS_UPDATE,
targetType: "server",
metadata: { afkChannelId: args.afkChannelId, afkTimeout: args.afkTimeout },
});
return null;
},
});
@@ -85,6 +93,7 @@ export const updateName = mutation({
}
const existing = await ctx.db.query("serverSettings").first();
const oldName = existing?.serverName;
if (existing) {
await ctx.db.patch(existing._id, { serverName: name });
} else {
@@ -94,6 +103,16 @@ export const updateName = mutation({
});
}
if (oldName !== name) {
await logAudit(ctx, {
actorId: args.userId,
action: AUDIT_ACTIONS.SERVER_SETTINGS_UPDATE,
targetType: "server",
targetName: name,
metadata: { field: "serverName", from: oldName, to: name },
});
}
return null;
},
});