mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 18:38:26 +00:00
Add a task implementation to delete items
This commit is contained in:
@ -9,6 +9,7 @@ package docspell.store.records
|
||||
import cats.data.NonEmptyList
|
||||
import cats.effect.Sync
|
||||
import cats.implicits._
|
||||
import fs2.Stream
|
||||
|
||||
import docspell.common._
|
||||
import docspell.store.qb.DSL._
|
||||
@ -388,6 +389,11 @@ object RItem {
|
||||
def findById(itemId: Ident): ConnectionIO[Option[RItem]] =
|
||||
run(select(T.all), from(T), T.id === itemId).query[RItem].option
|
||||
|
||||
def findDeleted(collective: Ident, chunkSize: Int): Stream[ConnectionIO, RItem] =
|
||||
run(select(T.all), from(T), T.cid === collective && T.state === ItemState.deleted)
|
||||
.query[RItem]
|
||||
.streamWithChunkSize(chunkSize)
|
||||
|
||||
def checkByIdAndCollective(itemId: Ident, coll: Ident): ConnectionIO[Option[Ident]] =
|
||||
Select(T.id.s, from(T), T.id === itemId && T.cid === coll).build.query[Ident].option
|
||||
|
||||
|
@ -83,10 +83,10 @@ trait UserTaskStore[F[_]] {
|
||||
*
|
||||
* Unlike `updateTask`, this ensures that there is at most one task
|
||||
* of some name in the db. Multiple same tasks (task with same
|
||||
* name) may not be allowed to run, dependening on what they do.
|
||||
* name) may not be allowed to run, depending on what they do.
|
||||
* This is not ensured by the database, though.
|
||||
*
|
||||
* If there are currently mutliple tasks with same name as `ut` for
|
||||
* If there are currently multiple tasks with same name as `ut` for
|
||||
* the user `account`, they will all be removed and the given task
|
||||
* inserted!
|
||||
*/
|
||||
|
Reference in New Issue
Block a user