mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Make convert-all-pdfs an admin endpoint
This commit is contained in:
@ -68,14 +68,14 @@ object JobFactory {
|
||||
args,
|
||||
"Create preview images",
|
||||
now,
|
||||
submitter.getOrElse(DocspellSystem.taskGroup),
|
||||
submitter.getOrElse(DocspellSystem.user),
|
||||
Priority.Low,
|
||||
Some(DocspellSystem.allPreviewTaskTracker)
|
||||
)
|
||||
|
||||
def convertAllPdfs[F[_]: Sync](
|
||||
collective: Option[Ident],
|
||||
account: AccountId,
|
||||
submitter: Option[Ident],
|
||||
prio: Priority
|
||||
): F[RJob] =
|
||||
for {
|
||||
@ -84,11 +84,11 @@ object JobFactory {
|
||||
job = RJob.newJob(
|
||||
id,
|
||||
ConvertAllPdfArgs.taskName,
|
||||
account.collective,
|
||||
collective.getOrElse(DocspellSystem.taskGroup),
|
||||
ConvertAllPdfArgs(collective),
|
||||
s"Convert all pdfs not yet converted",
|
||||
now,
|
||||
account.user,
|
||||
submitter.getOrElse(DocspellSystem.user),
|
||||
prio,
|
||||
collective
|
||||
.map(c => c / ConvertAllPdfArgs.taskName)
|
||||
|
@ -181,7 +181,7 @@ trait OItem[F[_]] {
|
||||
*/
|
||||
def convertAllPdf(
|
||||
collective: Option[Ident],
|
||||
account: AccountId,
|
||||
submitter: Option[Ident],
|
||||
notifyJoex: Boolean
|
||||
): F[UpdateResult]
|
||||
|
||||
@ -687,11 +687,11 @@ object OItem {
|
||||
|
||||
def convertAllPdf(
|
||||
collective: Option[Ident],
|
||||
account: AccountId,
|
||||
submitter: Option[Ident],
|
||||
notifyJoex: Boolean
|
||||
): F[UpdateResult] =
|
||||
for {
|
||||
job <- JobFactory.convertAllPdfs[F](collective, account, Priority.Low)
|
||||
job <- JobFactory.convertAllPdfs[F](collective, submitter, Priority.Low)
|
||||
_ <- queue.insertIfNew(job)
|
||||
_ <- if (notifyJoex) joex.notifyAllNodes else ().pure[F]
|
||||
} yield UpdateResult.success
|
||||
|
Reference in New Issue
Block a user