chore: initial project import
Some checks failed
CI - Production Readiness / Verify (push) Has been cancelled

This commit is contained in:
Wira Basalamah
2026-04-21 09:29:29 +07:00
commit adde003fba
222 changed files with 37657 additions and 0 deletions

45
app/audit-log/page.tsx Normal file
View File

@ -0,0 +1,45 @@
import { redirect } from "next/navigation";
import { getSession } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import { ShellPage } from "@/components/page-templates";
import { TablePlaceholder } from "@/components/placeholders";
function toTime(value: Date) {
return new Intl.DateTimeFormat("id-ID", {
day: "2-digit",
month: "short",
year: "numeric",
hour: "2-digit",
minute: "2-digit"
}).format(value);
}
export default async function TenantAuditLogPage() {
const session = await getSession();
if (!session) {
redirect("/login");
}
const audits = await prisma.auditLog.findMany({
where: { tenantId: session.tenantId },
include: { actorUser: true },
orderBy: { createdAt: "desc" }
});
return (
<ShellPage shell="admin" title="Audit Log" description="User activity, message action, dan campaign action logs.">
<TablePlaceholder
title="Audit events"
columns={["Time", "Actor", "Module", "Action", "Entity"]}
rows={audits.map((audit) => [
toTime(audit.createdAt),
audit.actorUser?.fullName ?? "System",
audit.entityType,
audit.action,
audit.entityId
])}
/>
</ShellPage>
);
}