mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Upload zip files contents as independent files
This commit is contained in:
@ -6,6 +6,8 @@
|
||||
|
||||
package docspell.scheduler
|
||||
|
||||
import docspell.common.Ident
|
||||
|
||||
trait JobStore[F[_]] {
|
||||
|
||||
/** Inserts the job into the queue to get picked up as soon as possible. The job must
|
||||
@ -24,4 +26,5 @@ trait JobStore[F[_]] {
|
||||
|
||||
def insertAllIfNew(jobs: Seq[Job[String]]): F[List[Boolean]]
|
||||
|
||||
def findById(jobId: Ident): F[Option[Job[String]]]
|
||||
}
|
||||
|
@ -6,10 +6,11 @@
|
||||
|
||||
package docspell.scheduler.impl
|
||||
|
||||
import cats.data.OptionT
|
||||
import cats.effect.Sync
|
||||
import cats.syntax.all._
|
||||
|
||||
import docspell.common.Timestamp
|
||||
import docspell.common.{Ident, Timestamp}
|
||||
import docspell.scheduler._
|
||||
import docspell.store.Store
|
||||
import docspell.store.records.RJob
|
||||
@ -72,6 +73,14 @@ final class JobStoreImpl[F[_]: Sync](store: Store[F]) extends JobStore[F] {
|
||||
})
|
||||
}
|
||||
|
||||
def findById(jobId: Ident) =
|
||||
OptionT(store.transact(RJob.findById(jobId)))
|
||||
.map(toJob)
|
||||
.value
|
||||
|
||||
def toJob(r: RJob): Job[String] =
|
||||
Job(r.id, r.task, r.group, r.args, r.subject, r.submitter, r.priority, r.tracker)
|
||||
|
||||
def toRecord(job: Job[String], timestamp: Timestamp): RJob =
|
||||
RJob.newJob(
|
||||
job.id,
|
||||
|
@ -9,7 +9,7 @@ package docspell.scheduler.impl
|
||||
import cats.effect._
|
||||
import cats.implicits._
|
||||
|
||||
import docspell.common.JobState
|
||||
import docspell.common.{Ident, JobState}
|
||||
import docspell.notification.api.{Event, EventSink}
|
||||
import docspell.pubsub.api.PubSubT
|
||||
import docspell.scheduler._
|
||||
@ -64,6 +64,9 @@ final class JobStorePublish[F[_]: Sync](
|
||||
else ().pure[F]
|
||||
}
|
||||
}
|
||||
|
||||
def findById(jobId: Ident) =
|
||||
delegate.findById(jobId)
|
||||
}
|
||||
|
||||
object JobStorePublish {
|
||||
|
Reference in New Issue
Block a user