fix: relay sync create/update classification to prevent false create mode on updates (#56)

Co-authored-by: userAdityaa <aditya.chaudhary1558@gmail.com>
Co-committed-by: userAdityaa <aditya.chaudhary1558@gmail.com>
This commit was merged in pull request #56.
This commit is contained in:
2026-05-01 14:21:37 +00:00
committed by hodlbod
parent 9556a34b19
commit 29f657635c
2 changed files with 28 additions and 3 deletions
+16
View File
@@ -194,4 +194,20 @@ impl Query {
.await?;
Ok(rows)
}
pub async fn relay_has_completed_sync(&self, relay_id: &str) -> Result<bool> {
let found = sqlx::query_scalar::<_, i64>(
"SELECT 1
FROM activity
WHERE resource_type = 'relay'
AND resource_id = ?
AND activity_type = 'complete_relay_sync'
LIMIT 1",
)
.bind(relay_id)
.fetch_optional(&self.pool)
.await?;
Ok(found.is_some())
}
}