fix: add activity logging for existing records fetched during database sync process
Deploy Application / deploy (push) Successful in 36s Details

This commit is contained in:
faisolavolut 2025-11-24 10:29:40 +07:00
parent f248c5889f
commit d7031052ea
1 changed files with 8 additions and 3 deletions

View File

@ -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