store events into a collection

This commit is contained in:
2025-07-23 09:54:02 +05:30
parent 089c034dd6
commit 05abf66d66
7 changed files with 86 additions and 1 deletions

View File

@@ -36,8 +36,10 @@ export async function createPermit(
dbEvents.emit(
"change",
{
tenantId: user.tenantId,
type: "insert",
collection: "permits",
orgId: permit.client.toString(),
document: permit,
} as ChangeEvent,
["permit:read"]
@@ -223,8 +225,11 @@ export async function updatePermit(
dbEvents.emit(
"change",
{
tenantId: user.tenantId,
type: "update",
collection: "permits",
//@ts-ignore
orgId: updatePermitResult.client._id.toString(),
document: updatePermitResult,
} as ChangeEvent,
["permit:read"]
@@ -242,6 +247,7 @@ export async function deletePermit(permitId: string, tenantId: string) {
dbEvents.emit(
"change",
{
tenantId: tenantId,
type: "delete",
collection: "permits",
document: {