Skip to content

Commit

Permalink
refactor: delete metadata from deleted nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir committed Dec 17, 2024
1 parent cffbdbc commit 68bdedc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class NodeRepository @Inject constructor(

suspend fun deleteNode(num: Int) = withContext(dispatchers.io) {
nodeInfoDao.deleteNode(num)
nodeInfoDao.deleteMetadata(num)
}

suspend fun insertMetadata(metadata: MetadataEntity) = withContext(dispatchers.io) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.geeksville.mesh.database.entity.NodeWithRelations
import com.geeksville.mesh.database.entity.NodeEntity
import kotlinx.coroutines.flow.Flow

@Suppress("TooManyFunctions")
@Dao
interface NodeInfoDao {

Expand Down Expand Up @@ -117,4 +118,7 @@ interface NodeInfoDao {

@Upsert
fun upsert(meta: MetadataEntity)

@Query("DELETE FROM metadata WHERE num=:num")
fun deleteMetadata(num: Int)
}

0 comments on commit 68bdedc

Please sign in to comment.