mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Make sure the empty-trash task is started for all collectives
This commit is contained in:
@ -8,6 +8,7 @@ package docspell.store.records
|
||||
|
||||
import cats.data.NonEmptyList
|
||||
import cats.implicits._
|
||||
import fs2.Stream
|
||||
|
||||
import docspell.common._
|
||||
import docspell.store.qb.DSL._
|
||||
@ -62,6 +63,23 @@ object REmptyTrashSetting {
|
||||
sql.query[REmptyTrashSetting].option
|
||||
}
|
||||
|
||||
def findForAllCollectives(
|
||||
default: CalEvent,
|
||||
chunkSize: Int
|
||||
): Stream[ConnectionIO, REmptyTrashSetting] = {
|
||||
val c = RCollective.as("c")
|
||||
val e = REmptyTrashSetting.as("e")
|
||||
val sql = run(
|
||||
select(
|
||||
c.id.s,
|
||||
coalesce(e.schedule.s, const(default)).s,
|
||||
coalesce(e.created.s, c.created.s).s
|
||||
),
|
||||
from(c).leftJoin(e, e.cid === c.id)
|
||||
)
|
||||
sql.query[REmptyTrashSetting].streamWithChunkSize(chunkSize)
|
||||
}
|
||||
|
||||
def delete(coll: Ident): ConnectionIO[Int] =
|
||||
DML.delete(T, T.cid === coll)
|
||||
|
||||
|
Reference in New Issue
Block a user