fix: add activity logging for database sync process
Deploy Application / deploy (push) Successful in 49s
Details
Deploy Application / deploy (push) Successful in 49s
Details
This commit is contained in:
parent
e09b2517e1
commit
1ee8c91611
|
|
@ -84,6 +84,14 @@ function mapRowToRvOpenitem(row: any) {
|
||||||
|
|
||||||
// Function to process a single database sync
|
// Function to process a single database sync
|
||||||
async function processDatabaseSync(database: any) {
|
async function processDatabaseSync(database: any) {
|
||||||
|
await db.activity_logs.create({
|
||||||
|
data: {
|
||||||
|
action: "sync_rv_openitem",
|
||||||
|
status: "start",
|
||||||
|
message: `Starting sync for database ${database.name} (${database.db_id})`,
|
||||||
|
extra_json: database,
|
||||||
|
},
|
||||||
|
});
|
||||||
const pool = await getPoolForDbId(database.db_id);
|
const pool = await getPoolForDbId(database.db_id);
|
||||||
const q = "SELECT * FROM rv_openitem";
|
const q = "SELECT * FROM rv_openitem";
|
||||||
|
|
||||||
|
|
@ -191,6 +199,14 @@ async function processDatabaseSync(database: any) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await db.activity_logs.create({
|
||||||
|
data: {
|
||||||
|
action: "sync_rv_openitem",
|
||||||
|
status: "success",
|
||||||
|
message: `Completed sync for database ${database.name} (${database.db_id})`,
|
||||||
|
extra_json: database,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return { inserted: dbInserted, updated: dbUpdated };
|
return { inserted: dbInserted, updated: dbUpdated };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue