feat : copy buzzy audit logs
CI / Verify (push) Successful in 2m2s
CI / Build immutable images and deploy (push) Successful in 2m47s

This commit is contained in:
2026-09-27 17:00:25 +07:00 Unverified
parent 8ddb5896b6
commit 188cec9bda
10 changed files with 152 additions and 353 deletions
+10 -1
View File
@@ -691,6 +691,7 @@ export async function cancelCatalogSyncJob(
action: "catalog_sync.cancel_requested",
targetType: "catalog_sync",
targetId: id,
metadata: { status: job.status },
});
return writeSyncJob({ ...job, message: "กำลังยกเลิก Sync…", status: "cancelled" });
}
@@ -701,6 +702,7 @@ export async function startCatalogSyncJob(actor: AuditActor): Promise<CatalogSyn
action: "catalog_sync.requested",
targetType: "catalog_sync",
targetId: id,
metadata: { status: "queued" },
});
const job = await writeSyncJob({ id, status: "queued", phase: "queued", completed: 0, total: 0, message: "กำลังเตรียม Sync" });
void executeCatalogSyncJob(job, actor).catch(() => undefined);
@@ -738,6 +740,9 @@ async function executeCatalogSyncJob(initial: CatalogSyncJob, actor: AuditActor)
: "catalog_sync.completed",
targetType: "catalog_sync",
targetId: initial.id,
metadata: {
status: result === "unchanged" ? "unchanged" : "completed",
},
});
} catch (cause) {
if (cause instanceof Error && cause.message === "CATALOG_SYNC_CANCELLED") {
@@ -746,6 +751,7 @@ async function executeCatalogSyncJob(initial: CatalogSyncJob, actor: AuditActor)
action: "catalog_sync.cancelled",
targetType: "catalog_sync",
targetId: initial.id,
metadata: { status: "cancelled" },
});
} else {
const error = cause instanceof Error ? cause.message : "Unknown sync error";
@@ -754,7 +760,10 @@ async function executeCatalogSyncJob(initial: CatalogSyncJob, actor: AuditActor)
action: "catalog_sync.failed",
targetType: "catalog_sync",
targetId: initial.id,
metadata: { error: error.slice(0, 500) },
metadata: {
error: error.slice(0, 500),
status: "error",
},
});
}
}