mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Add routes to conveniently set/toggle tags
This commit is contained in:
@ -55,6 +55,14 @@ object RTagItem {
|
||||
Vector.empty.pure[ConnectionIO]
|
||||
}
|
||||
|
||||
def removeAllTags(item: Ident, tags: Seq[Ident]): ConnectionIO[Int] =
|
||||
NonEmptyList.fromList(tags.toList) match {
|
||||
case None =>
|
||||
0.pure[ConnectionIO]
|
||||
case Some(nel) =>
|
||||
deleteFrom(table, and(itemId.is(item), tagId.isIn(nel))).update.run
|
||||
}
|
||||
|
||||
def setAllTags(item: Ident, tags: Seq[Ident]): ConnectionIO[Int] =
|
||||
if (tags.isEmpty) 0.pure[ConnectionIO]
|
||||
else
|
||||
|
Reference in New Issue
Block a user