fix(server): also fix these broken user isolation SQL statements

This commit is contained in:
perf3ct 2025-06-24 17:43:58 +00:00
parent 78f87d49ef
commit 6c2f16e666
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
1 changed files with 2 additions and 2 deletions

View File

@ -691,7 +691,7 @@ async fn get_failed_ocr_documents(
SELECT COUNT(*)
FROM documents
WHERE ocr_status = 'failed'
AND ($1 = $1 OR user_id = $1)
AND ($1::uuid IS NULL OR user_id = $1)
"#
)
.bind(if auth_user.user.role == crate::models::UserRole::Admin {
@ -802,7 +802,7 @@ async fn get_failure_statistics(
COUNT(*) as count
FROM documents
WHERE ocr_status = 'failed'
AND ($1 = $1 OR user_id = $1)
AND ($1::uuid IS NULL OR user_id = $1)
GROUP BY ocr_failure_reason
ORDER BY count DESC
"#