@heyhru/business-dms-audit
v0.6.5
Published
DMS audit log domain logic: service, model, sql
Readme
@heyhru/business-dms-audit
DMS audit log domain logic: service, model, sql.
Exports
writeAuditLog(entry) — cross-module function
Records an audit log entry. Called by other service modules (e.g. approvals).
import { writeAuditLog } from "@heyhru/business-dms-audit";
await writeAuditLog({
userId: "user-id",
dataSourceId: "ds-id",
action: "DML_EXECUTE",
sqlText: "UPDATE ...",
resultSummary: "1 rows affected",
ipAddress: "1.2.3.4",
});logList(req, reply) — Fastify route handler
Lists audit logs with optional filters. Bind directly to a route.
import { logList } from "@heyhru/business-dms-audit";
app.post("/logs/list", logList);Request body (all optional):
| Field | Type | Description |
| -------------- | ------ | ----------------------------- |
| userId | string | Filter by user |
| dataSourceId | string | Filter by data source |
| limit | string | Max results (default 50) |
| offset | string | Pagination offset (default 0) |
