Bug 1890623 - Adds methods to retreive unsent crashes from the database r=android-reviewers,mcarare

Differential Revision: https://phabricator.services.mozilla.com/D211123
This commit is contained in:
Jeff Boek 2024-05-30 17:31:26 +00:00
parent aa59c116e7
commit a3f59dbcea

View file

@ -37,6 +37,32 @@ internal interface CrashDao {
@Query("SELECT * FROM crashes ORDER BY created_at DESC")
fun getCrashesWithReports(): LiveData<List<CrashWithReports>>
/**
* Returns saved crashes that haven't been reported.
*/
@Transaction
@Query(
"""
SELECT * FROM crashes
LEFT JOIN reports ON crashes.uuid = reports.crash_uuid
WHERE reports.crash_uuid IS NULL
""",
)
suspend fun getCrashesWithoutReports(): List<CrashEntity>
/**
* Returns saved crashes that haven't been reported.
*/
@Transaction
@Query(
"""
SELECT COUNT(*) FROM crashes
LEFT JOIN reports ON crashes.uuid = reports.crash_uuid
WHERE reports.crash_uuid IS NULL
""",
)
suspend fun numberOfUnsentCrashes(): Int
/**
* Delete table.
*/