1.1.3
This commit is contained in:
@@ -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;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user