From d7031052ead361cfb140948195db9ae2dc96392b Mon Sep 17 00:00:00 2001 From: faisolavolut Date: Mon, 24 Nov 2025 10:29:40 +0700 Subject: [PATCH] fix: add activity logging for existing records fetched during database sync process --- src/controllers/syncController.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/controllers/syncController.ts b/src/controllers/syncController.ts index 5c25332..712d59f 100644 --- a/src/controllers/syncController.ts +++ b/src/controllers/syncController.ts @@ -133,15 +133,20 @@ async function processDatabaseSync(database: any) { ); dbInserted += ops.length; } else { - // Check existing records in bulk instead of one by one - const invoiceIds = ops.map((op) => op.c_invoice_id).filter(Boolean); const existingRecords = await db.rv_openitem.findMany({ where: { db_id: database.db_id, }, select: { id: true, c_invoice_id: true }, }); - + await db.activity_logs.create({ + data: { + action: "sync_rv_openitem", + status: "info", + message: `Existing records fetched: ${existingRecords.length}`, + // extra_json: database, + }, + }); for (const op of ops) { const removeSpace = (string: string) => { return string