fix(db): skip UPDATE and audit on no-op object update (keep updated_at consistent)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 09:40:27 +02:00
parent a690c60ec6
commit 2938649d62
+6 -4
View File
@@ -188,6 +188,12 @@ pub async fn update_object(
return Ok(false);
};
let changes = update_changes(&old.to_input(), input);
if changes.is_empty() {
// No-op: don't touch updated_at or the audit log.
return Ok(true);
}
sqlx::query(
"UPDATE object SET \
object_number = $2, object_name = $3, number_of_objects = $4, \
@@ -208,9 +214,6 @@ pub async fn update_object(
.execute(&mut *conn)
.await?;
let changes = update_changes(&old.to_input(), input);
if !changes.is_empty() {
audit::record(
&mut *conn,
&NewAuditEvent {
@@ -222,7 +225,6 @@ pub async fn update_object(
},
)
.await?;
}
Ok(true)
}