Drop items on tags in edit favorites sheet to tag them

This commit is contained in:
MM20
2022-09-24 23:01:32 +02:00
parent 2c307693f2
commit 60990e767c
5 changed files with 99 additions and 8 deletions
@@ -41,4 +41,17 @@ interface CustomAttrsDao {
@Query("SELECT key FROM CustomAttributes WHERE type = 'tag' AND value = :tag")
fun getItemsWithTag(tag: String): Flow<List<String>>
@Transaction
suspend fun addTag(key: String, tag: String) {
removeTag(key, tag)
insertTag(key, tag)
}
@Query("DELETE FROM CustomAttributes WHERE type = 'tag' AND key = :key AND value = :tag")
suspend fun removeTag(key: String, tag: String)
@Query("INSERT INTO CustomAttributes (key, value, type) VALUES (:key, :tag, 'tag')")
suspend fun insertTag(key: String, tag: String)
}