fix: add activity logging for existing records fetched during database sync process
Deploy Application / deploy (push) Successful in 36s
Details
Deploy Application / deploy (push) Successful in 36s
Details
This commit is contained in:
parent
f248c5889f
commit
d7031052ea
|
|
@ -133,15 +133,20 @@ async function processDatabaseSync(database: any) {
|
||||||
);
|
);
|
||||||
dbInserted += ops.length;
|
dbInserted += ops.length;
|
||||||
} else {
|
} 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({
|
const existingRecords = await db.rv_openitem.findMany({
|
||||||
where: {
|
where: {
|
||||||
db_id: database.db_id,
|
db_id: database.db_id,
|
||||||
},
|
},
|
||||||
select: { id: true, c_invoice_id: true },
|
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) {
|
for (const op of ops) {
|
||||||
const removeSpace = (string: string) => {
|
const removeSpace = (string: string) => {
|
||||||
return string
|
return string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue