Only look for synchronization request from when the app is opened

This commit is contained in:
Kgothatso Ngako
2026-04-20 01:21:48 +02:00
parent 08e4271333
commit 7443dec65c

View File

@@ -6,11 +6,13 @@ import androidx.room.Insert
import androidx.room.Query
import androidx.room.Upsert
import kotlinx.coroutines.flow.Flow
import kotlin.time.Clock
import kotlin.time.Instant
@Dao
interface SynchronizeNostrEventRequestDao {
@Query("SELECT * FROM SynchronizeNostrEventRequest WHERE status = :status")
fun observeSynchronizeNostrEventRequestsByStatus(status: String): Flow<SynchronizeNostrEventRequest?>
@Query("SELECT * FROM SynchronizeNostrEventRequest WHERE status = :status AND createdAt > :createdAt")
fun observeSynchronizeNostrEventRequestsByStatus(status: String, createdAt: Instant = Clock.System.now()): Flow<SynchronizeNostrEventRequest?>
@Query("SELECT COUNT(*) FROM SynchronizeNostrEventRequest WHERE purpose = :purpose AND status IN (:status)")
fun observeSynchronizeNostrEventRequestByPurposeAndStatusCount(purpose: String, status: List<String>): Flow<Int>