Coverage Summary for Class: FirebaseWorkspaceCollectionReader (com.georgeci.moneysurfer.data.sync)

Class Method, % Branch, % Line, % Instruction, %
FirebaseWorkspaceCollectionReader 0% (0/7) 0% (0/2) 0% (0/25) 0% (0/181)
FirebaseWorkspaceCollectionReader$fetchInvitesForUser$1
FirebaseWorkspaceCollectionReader$fetchInvitesForUser$lambda$0$$inlined$equalTo$1 0% (0/1)
FirebaseWorkspaceCollectionReader$fetchInvitesForUser$lambda$1$$inlined$greaterThan$1 0% (0/1)
FirebaseWorkspaceCollectionReader$fetchUpdatedSince$1
FirebaseWorkspaceCollectionReader$fetchUpdatedSince$lambda$0$$inlined$greaterThan$1 0% (0/1)
FirebaseWorkspaceCollectionReader$fetchWorkspaceDoc$1
Total 0% (0/10) 0% (0/2) 0% (0/25) 0% (0/181)


 package com.georgeci.moneysurfer.data.sync
 
 import com.georgeci.moneysurfer.sync.api.SyncCollection
 import com.georgeci.moneysurfer.sync.plugin.RemoteDocument
 import dev.gitlive.firebase.firestore.FirebaseFirestore
 import org.koin.core.annotation.Single
 
 @Single(binds = [WorkspaceCollectionReader::class])
 class FirebaseWorkspaceCollectionReader(
     private val firestore: FirebaseFirestore,
 ) : WorkspaceCollectionReader {
 
     override suspend fun fetchWorkspaceDoc(workspaceId: String): RemoteDocument? {
         val snap = firestore.collection(SyncCollection.WORKSPACES).document(workspaceId).get()
         return if (snap.exists) FirebaseRemoteDocument(snap) else null
     }
 
     override suspend fun fetchUpdatedSince(
         workspaceId: String,
         collectionName: String,
         sinceMillis: Long,
         limit: Int,
     ): List<RemoteDocument> =
         firestore
             .collection(SyncCollection.WORKSPACES)
             .document(workspaceId)
             .collection(collectionName)
             .where { "updatedAt" greaterThan sinceMillis }
             .orderBy(field = "updatedAt")
             .limit(limit.toLong())
             .get()
             .documents
             .map { FirebaseRemoteDocument(it) }
 
     override suspend fun fetchInvitesForUser(
         workspaceId: String,
         uid: String,
         sinceMillis: Long,
         limit: Int,
     ): List<RemoteDocument> =
         firestore
             .collection(SyncCollection.WORKSPACES)
             .document(workspaceId)
             .collection(SyncCollection.WORKSPACE_INVITES)
             .where { "targetUserId" equalTo uid }
             .where { "updatedAt" greaterThan sinceMillis }
             .orderBy(field = "updatedAt")
             .limit(limit.toLong())
             .get()
             .documents
             .map { FirebaseRemoteDocument(it) }
 }