Files
community-rule/lib/server/adminRuleReadLog.ts
T
adilallo 5cbda35e32 Start every Rule private, with a rotating link and files that follow its readers.
New Rules stay off lists until the person who holds the pen turns on a share link, or the team features one. Uploaded files are readable only by those readers, stripped of location metadata, and deleted with the Rule, draft, or account.
2026-11-09 19:54:04 -07:00

24 lines
613 B
TypeScript

import { logger } from "../logger";
import { prisma } from "./db";
/** Best-effort audit row. Never throws to the caller. */
export async function logAdminRuleRead(opts: {
ruleId: string;
adminEmail: string;
adminUserId: string | null;
path: string;
}): Promise<void> {
try {
await prisma.adminRuleReadLog.create({
data: {
ruleId: opts.ruleId,
adminEmail: opts.adminEmail.trim().toLowerCase(),
adminUserId: opts.adminUserId,
path: opts.path.slice(0, 500),
},
});
} catch (err) {
logger.warn("[admin-rule-read] failed to write log", err);
}
}