mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Fix compile warnings after scala update
This commit is contained in:
@ -142,7 +142,7 @@ class AddonExecutorTest extends CatsEffectSuite with Fixtures with TestLoggingCo
|
|||||||
AddonExecutionResult.executionResultMonoid
|
AddonExecutionResult.executionResultMonoid
|
||||||
.combine(
|
.combine(
|
||||||
AddonExecutionResult.empty,
|
AddonExecutionResult.empty,
|
||||||
AddonExecutionResult(Nil, true)
|
AddonExecutionResult(Nil, pure = true)
|
||||||
)
|
)
|
||||||
.pure
|
.pure
|
||||||
)
|
)
|
||||||
|
@ -27,9 +27,9 @@ object AddonGenerator {
|
|||||||
): Resource[IO, AddonArchive] =
|
): Resource[IO, AddonArchive] =
|
||||||
output match {
|
output match {
|
||||||
case None =>
|
case None =>
|
||||||
generate(name, version, false)("exit 0")
|
generate(name, version, collectOutput = false)("exit 0")
|
||||||
case Some(out) =>
|
case Some(out) =>
|
||||||
generate(name, version, true)(
|
generate(name, version, collectOutput = true)(
|
||||||
s"""
|
s"""
|
||||||
|cat <<-EOF
|
|cat <<-EOF
|
||||||
|${out.asJson.noSpaces}
|
|${out.asJson.noSpaces}
|
||||||
@ -77,8 +77,9 @@ object AddonGenerator {
|
|||||||
meta = AddonMeta.Meta(name, version, None),
|
meta = AddonMeta.Meta(name, version, None),
|
||||||
triggers = Set(AddonTriggerType.ExistingItem: AddonTriggerType).some,
|
triggers = Set(AddonTriggerType.ExistingItem: AddonTriggerType).some,
|
||||||
args = None,
|
args = None,
|
||||||
runner =
|
runner = AddonMeta
|
||||||
AddonMeta.Runner(None, None, AddonMeta.TrivialRunner(true, "addon.sh").some).some,
|
.Runner(None, None, AddonMeta.TrivialRunner(enable = true, "addon.sh").some)
|
||||||
|
.some,
|
||||||
options =
|
options =
|
||||||
AddonMeta.Options(networking = !collectOutput, collectOutput = collectOutput).some
|
AddonMeta.Options(networking = !collectOutput, collectOutput = collectOutput).some
|
||||||
)
|
)
|
||||||
|
@ -40,13 +40,13 @@ trait Fixtures extends TestLoggingConfig { self: CatsEffectSuite =>
|
|||||||
),
|
),
|
||||||
None,
|
None,
|
||||||
runner = Runner(
|
runner = Runner(
|
||||||
nix = NixRunner(true).some,
|
nix = NixRunner(enable = true).some,
|
||||||
docker = DockerRunner(
|
docker = DockerRunner(
|
||||||
enable = true,
|
enable = true,
|
||||||
image = None,
|
image = None,
|
||||||
build = "Dockerfile".some
|
build = "Dockerfile".some
|
||||||
).some,
|
).some,
|
||||||
trivial = TrivialRunner(true, "src/addon.sh").some
|
trivial = TrivialRunner(enable = true, "src/addon.sh").some
|
||||||
).some,
|
).some,
|
||||||
options = Options(networking = true, collectOutput = true).some
|
options = Options(networking = true, collectOutput = true).some
|
||||||
)
|
)
|
||||||
@ -65,7 +65,7 @@ trait Fixtures extends TestLoggingConfig { self: CatsEffectSuite =>
|
|||||||
runner: RunnerType,
|
runner: RunnerType,
|
||||||
runners: RunnerType*
|
runners: RunnerType*
|
||||||
): AddonExecutorConfig = {
|
): AddonExecutorConfig = {
|
||||||
val nspawn = NSpawn(false, "sudo", "systemd-nspawn", Duration.millis(100))
|
val nspawn = NSpawn(enabled = false, "sudo", "systemd-nspawn", Duration.millis(100))
|
||||||
AddonExecutorConfig(
|
AddonExecutorConfig(
|
||||||
runner = runner :: runners.toList,
|
runner = runner :: runners.toList,
|
||||||
runTimeout = Duration.minutes(2),
|
runTimeout = Duration.minutes(2),
|
||||||
|
@ -22,7 +22,7 @@ import munit._
|
|||||||
|
|
||||||
class StanfordNerAnnotatorSuite extends FunSuite with TestLoggingConfig {
|
class StanfordNerAnnotatorSuite extends FunSuite with TestLoggingConfig {
|
||||||
lazy val germanClassifier =
|
lazy val germanClassifier =
|
||||||
new StanfordCoreNLP(Properties.nerGerman(None, false))
|
new StanfordCoreNLP(Properties.nerGerman(None, highRecall = false))
|
||||||
lazy val englishClassifier =
|
lazy val englishClassifier =
|
||||||
new StanfordCoreNLP(Properties.nerEnglish(None))
|
new StanfordCoreNLP(Properties.nerEnglish(None))
|
||||||
|
|
||||||
|
@ -90,6 +90,6 @@ object Config {
|
|||||||
}
|
}
|
||||||
object Addons {
|
object Addons {
|
||||||
val disabled: Addons =
|
val disabled: Addons =
|
||||||
Addons(false, false, UrlMatcher.False, UrlMatcher.True)
|
Addons(enabled = false, allowImpure = false, UrlMatcher.False, UrlMatcher.True)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ object Login {
|
|||||||
_ <- logF.trace(s"Account lookup: $data")
|
_ <- logF.trace(s"Account lookup: $data")
|
||||||
res <- data match {
|
res <- data match {
|
||||||
case Some(d) if checkNoPassword(d, Set(AccountSource.OpenId)) =>
|
case Some(d) if checkNoPassword(d, Set(AccountSource.OpenId)) =>
|
||||||
doLogin(config, d.account, false)
|
doLogin(config, d.account, rememberMe = false)
|
||||||
case Some(d) if checkNoPassword(d, Set(AccountSource.Local)) =>
|
case Some(d) if checkNoPassword(d, Set(AccountSource.Local)) =>
|
||||||
config.onAccountSourceConflict match {
|
config.onAccountSourceConflict match {
|
||||||
case OnAccountSourceConflict.Fail =>
|
case OnAccountSourceConflict.Fail =>
|
||||||
@ -145,7 +145,7 @@ object Login {
|
|||||||
AccountSource.OpenId
|
AccountSource.OpenId
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
res <- doLogin(config, d.account, false)
|
res <- doLogin(config, d.account, rememberMe = false)
|
||||||
} yield res
|
} yield res
|
||||||
}
|
}
|
||||||
case _ =>
|
case _ =>
|
||||||
@ -212,7 +212,12 @@ object Login {
|
|||||||
val okResult: F[Result] =
|
val okResult: F[Result] =
|
||||||
for {
|
for {
|
||||||
_ <- store.transact(RUser.updateLogin(sf.token.account))
|
_ <- store.transact(RUser.updateLogin(sf.token.account))
|
||||||
newToken <- AuthToken.user(sf.token.account, false, config.serverSecret, None)
|
newToken <- AuthToken.user(
|
||||||
|
sf.token.account,
|
||||||
|
requireSecondFactor = false,
|
||||||
|
config.serverSecret,
|
||||||
|
None
|
||||||
|
)
|
||||||
rem <- OptionT
|
rem <- OptionT
|
||||||
.whenF(sf.rememberMe && config.rememberMe.enabled)(
|
.whenF(sf.rememberMe && config.rememberMe.enabled)(
|
||||||
insertRememberToken(store, sf.token.account, config)
|
insertRememberToken(store, sf.token.account, config)
|
||||||
@ -239,7 +244,9 @@ object Login {
|
|||||||
(for {
|
(for {
|
||||||
_ <- validateToken
|
_ <- validateToken
|
||||||
key <- EitherT.fromOptionF(
|
key <- EitherT.fromOptionF(
|
||||||
store.transact(RTotp.findEnabledByUserId(sf.token.account.userId, true)),
|
store.transact(
|
||||||
|
RTotp.findEnabledByUserId(sf.token.account.userId, enabled = true)
|
||||||
|
),
|
||||||
Result.invalidAuth
|
Result.invalidAuth
|
||||||
)
|
)
|
||||||
now <- EitherT.right[Result](Timestamp.current[F])
|
now <- EitherT.right[Result](Timestamp.current[F])
|
||||||
@ -255,7 +262,12 @@ object Login {
|
|||||||
def okResult(acc: AccountInfo) =
|
def okResult(acc: AccountInfo) =
|
||||||
for {
|
for {
|
||||||
_ <- store.transact(RUser.updateLogin(acc))
|
_ <- store.transact(RUser.updateLogin(acc))
|
||||||
token <- AuthToken.user(acc, false, config.serverSecret, None)
|
token <- AuthToken.user(
|
||||||
|
acc,
|
||||||
|
requireSecondFactor = false,
|
||||||
|
config.serverSecret,
|
||||||
|
None
|
||||||
|
)
|
||||||
} yield Result.ok(token, None)
|
} yield Result.ok(token, None)
|
||||||
|
|
||||||
def rememberedLogin(rid: Ident) =
|
def rememberedLogin(rid: Ident) =
|
||||||
|
@ -93,7 +93,7 @@ object AddonOps {
|
|||||||
AddonResult.executionFailed(
|
AddonResult.executionFailed(
|
||||||
new Exception(s"Addon run config ${id.id} not found.")
|
new Exception(s"Addon run config ${id.id} not found.")
|
||||||
) :: Nil,
|
) :: Nil,
|
||||||
false
|
pure = false
|
||||||
) :: Nil,
|
) :: Nil,
|
||||||
Nil
|
Nil
|
||||||
)
|
)
|
||||||
|
@ -72,7 +72,7 @@ private[joex] class AddonPrepare[F[_]: Sync](store: Store[F]) extends LoggerExte
|
|||||||
|
|
||||||
token <- AuthToken.user(
|
token <- AuthToken.user(
|
||||||
account,
|
account,
|
||||||
false,
|
requireSecondFactor = false,
|
||||||
secret.getOrElse(ByteVector.empty),
|
secret.getOrElse(ByteVector.empty),
|
||||||
tokenValidity.some
|
tokenValidity.some
|
||||||
)
|
)
|
||||||
|
@ -194,7 +194,14 @@ object OCollective {
|
|||||||
id <- Ident.randomId[F]
|
id <- Ident.randomId[F]
|
||||||
settings = sett.emptyTrash.getOrElse(EmptyTrash.default)
|
settings = sett.emptyTrash.getOrElse(EmptyTrash.default)
|
||||||
args = EmptyTrashArgs(cid, settings.minAge)
|
args = EmptyTrashArgs(cid, settings.minAge)
|
||||||
ut = UserTask(id, EmptyTrashArgs.taskName, true, settings.schedule, None, args)
|
ut = UserTask(
|
||||||
|
id,
|
||||||
|
EmptyTrashArgs.taskName,
|
||||||
|
enabled = true,
|
||||||
|
settings.schedule,
|
||||||
|
None,
|
||||||
|
args
|
||||||
|
)
|
||||||
_ <- uts.updateOneTask(UserTaskScope.collective(cid), args.makeSubject.some, ut)
|
_ <- uts.updateOneTask(UserTaskScope.collective(cid), args.makeSubject.some, ut)
|
||||||
_ <- joex.notifyAllNodes
|
_ <- joex.notifyAllNodes
|
||||||
} yield ()
|
} yield ()
|
||||||
@ -220,7 +227,7 @@ object OCollective {
|
|||||||
ut = UserTask(
|
ut = UserTask(
|
||||||
id,
|
id,
|
||||||
LearnClassifierArgs.taskName,
|
LearnClassifierArgs.taskName,
|
||||||
true,
|
enabled = true,
|
||||||
CalEvent(WeekdayComponent.All, DateEvent.All, TimeEvent.All),
|
CalEvent(WeekdayComponent.All, DateEvent.All, TimeEvent.All),
|
||||||
None,
|
None,
|
||||||
args
|
args
|
||||||
@ -239,7 +246,7 @@ object OCollective {
|
|||||||
ut = UserTask(
|
ut = UserTask(
|
||||||
id,
|
id,
|
||||||
EmptyTrashArgs.taskName,
|
EmptyTrashArgs.taskName,
|
||||||
true,
|
enabled = true,
|
||||||
CalEvent(WeekdayComponent.All, DateEvent.All, TimeEvent.All),
|
CalEvent(WeekdayComponent.All, DateEvent.All, TimeEvent.All),
|
||||||
None,
|
None,
|
||||||
args
|
args
|
||||||
|
@ -114,14 +114,14 @@ object ONotification {
|
|||||||
)
|
)
|
||||||
_ <- notMod.send(logbuf._2.andThen(log), ev, ch)
|
_ <- notMod.send(logbuf._2.andThen(log), ev, ch)
|
||||||
logs <- logbuf._1.get
|
logs <- logbuf._1.get
|
||||||
res = SendTestResult(true, logs)
|
res = SendTestResult(success = true, logs)
|
||||||
} yield res).attempt
|
} yield res).attempt
|
||||||
.map {
|
.map {
|
||||||
case Right(res) => res
|
case Right(res) => res
|
||||||
case Left(ex) =>
|
case Left(ex) =>
|
||||||
val ev =
|
val ev =
|
||||||
LogEvent.of(Level.Error, "Failed sending sample event").addError(ex)
|
LogEvent.of(Level.Error, "Failed sending sample event").addError(ex)
|
||||||
SendTestResult(false, Vector(ev))
|
SendTestResult(success = false, Vector(ev))
|
||||||
}
|
}
|
||||||
|
|
||||||
def listChannels(userId: Ident): F[Vector[Channel]] =
|
def listChannels(userId: Ident): F[Vector[Channel]] =
|
||||||
|
@ -120,7 +120,9 @@ object OTotp {
|
|||||||
def confirmInit(accountId: AccountInfo, otp: OnetimePassword): F[ConfirmResult] =
|
def confirmInit(accountId: AccountInfo, otp: OnetimePassword): F[ConfirmResult] =
|
||||||
for {
|
for {
|
||||||
_ <- log.info(s"Confirm TOTP setup for account ${accountId.asString}")
|
_ <- log.info(s"Confirm TOTP setup for account ${accountId.asString}")
|
||||||
key <- store.transact(RTotp.findEnabledByUserId(accountId.userId, false))
|
key <- store.transact(
|
||||||
|
RTotp.findEnabledByUserId(accountId.userId, enabled = false)
|
||||||
|
)
|
||||||
now <- Timestamp.current[F]
|
now <- Timestamp.current[F]
|
||||||
res <- key match {
|
res <- key match {
|
||||||
case None =>
|
case None =>
|
||||||
@ -129,7 +131,7 @@ object OTotp {
|
|||||||
val check = totp.checkPassword(r.secret, otp, now.value)
|
val check = totp.checkPassword(r.secret, otp, now.value)
|
||||||
if (check)
|
if (check)
|
||||||
store
|
store
|
||||||
.transact(RTotp.setEnabled(accountId.userId, true))
|
.transact(RTotp.setEnabled(accountId.userId, enabled = true))
|
||||||
.map(_ => ConfirmResult.Success)
|
.map(_ => ConfirmResult.Success)
|
||||||
else ConfirmResult.Failed.pure[F]
|
else ConfirmResult.Failed.pure[F]
|
||||||
}
|
}
|
||||||
@ -140,7 +142,7 @@ object OTotp {
|
|||||||
case Some(pw) =>
|
case Some(pw) =>
|
||||||
for {
|
for {
|
||||||
_ <- log.info(s"Validating TOTP, because it is requested to disable it.")
|
_ <- log.info(s"Validating TOTP, because it is requested to disable it.")
|
||||||
key <- store.transact(RTotp.findEnabledByLogin(accountId, true))
|
key <- store.transact(RTotp.findEnabledByLogin(accountId, enabled = true))
|
||||||
now <- Timestamp.current[F]
|
now <- Timestamp.current[F]
|
||||||
res <- key match {
|
res <- key match {
|
||||||
case None =>
|
case None =>
|
||||||
@ -149,7 +151,7 @@ object OTotp {
|
|||||||
val check = totp.checkPassword(r.secret, pw, now.value)
|
val check = totp.checkPassword(r.secret, pw, now.value)
|
||||||
if (check)
|
if (check)
|
||||||
UpdateResult.fromUpdate(
|
UpdateResult.fromUpdate(
|
||||||
store.transact(RTotp.setEnabled(r.userId, false))
|
store.transact(RTotp.setEnabled(r.userId, enabled = false))
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
log.info(s"TOTP code was invalid. Not disabling it.") *> UpdateResult
|
log.info(s"TOTP code was invalid. Not disabling it.") *> UpdateResult
|
||||||
@ -160,15 +162,15 @@ object OTotp {
|
|||||||
case None =>
|
case None =>
|
||||||
UpdateResult.fromUpdate {
|
UpdateResult.fromUpdate {
|
||||||
(for {
|
(for {
|
||||||
key <- OptionT(RTotp.findEnabledByLogin(accountId, true))
|
key <- OptionT(RTotp.findEnabledByLogin(accountId, enabled = true))
|
||||||
n <- OptionT.liftF(RTotp.setEnabled(key.userId, false))
|
n <- OptionT.liftF(RTotp.setEnabled(key.userId, enabled = false))
|
||||||
} yield n).mapK(store.transform).getOrElse(0)
|
} yield n).mapK(store.transform).getOrElse(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def state(acc: AccountInfo): F[OtpState] =
|
def state(acc: AccountInfo): F[OtpState] =
|
||||||
for {
|
for {
|
||||||
record <- store.transact(RTotp.findEnabledByUserId(acc.userId, true))
|
record <- store.transact(RTotp.findEnabledByUserId(acc.userId, enabled = true))
|
||||||
result = record match {
|
result = record match {
|
||||||
case Some(r) =>
|
case Some(r) =>
|
||||||
OtpState.Enabled(r.created)
|
OtpState.Enabled(r.created)
|
||||||
|
@ -159,7 +159,7 @@ object OUpload {
|
|||||||
data.meta.skipDuplicates,
|
data.meta.skipDuplicates,
|
||||||
data.meta.fileFilter.some,
|
data.meta.fileFilter.some,
|
||||||
data.meta.tags.some,
|
data.meta.tags.some,
|
||||||
false,
|
reprocess = false,
|
||||||
data.meta.attachmentsOnly,
|
data.meta.attachmentsOnly,
|
||||||
data.meta.customData
|
data.meta.customData
|
||||||
)
|
)
|
||||||
|
@ -32,9 +32,12 @@ class AuthTokenTest extends CatsEffectSuite {
|
|||||||
val otherSecret = ByteVector.fromValidHex("16bad")
|
val otherSecret = ByteVector.fromValidHex("16bad")
|
||||||
|
|
||||||
test("validate") {
|
test("validate") {
|
||||||
val token1 = AuthToken.user[IO](user, false, secret, None).unsafeRunSync()
|
val token1 =
|
||||||
|
AuthToken.user[IO](user, requireSecondFactor = false, secret, None).unsafeRunSync()
|
||||||
val token2 =
|
val token2 =
|
||||||
AuthToken.user[IO](user, false, secret, Duration.seconds(10).some).unsafeRunSync()
|
AuthToken
|
||||||
|
.user[IO](user, requireSecondFactor = false, secret, Duration.seconds(10).some)
|
||||||
|
.unsafeRunSync()
|
||||||
assert(token1.validate(secret, Duration.seconds(5)))
|
assert(token1.validate(secret, Duration.seconds(5)))
|
||||||
assert(!token1.validate(otherSecret, Duration.seconds(5)))
|
assert(!token1.validate(otherSecret, Duration.seconds(5)))
|
||||||
assert(!token1.copy(account = john).validate(secret, Duration.seconds(5)))
|
assert(!token1.copy(account = john).validate(secret, Duration.seconds(5)))
|
||||||
@ -46,9 +49,12 @@ class AuthTokenTest extends CatsEffectSuite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("signature") {
|
test("signature") {
|
||||||
val token1 = AuthToken.user[IO](user, false, secret, None).unsafeRunSync()
|
val token1 =
|
||||||
|
AuthToken.user[IO](user, requireSecondFactor = false, secret, None).unsafeRunSync()
|
||||||
val token2 =
|
val token2 =
|
||||||
AuthToken.user[IO](user, false, secret, Duration.seconds(10).some).unsafeRunSync()
|
AuthToken
|
||||||
|
.user[IO](user, requireSecondFactor = false, secret, Duration.seconds(10).some)
|
||||||
|
.unsafeRunSync()
|
||||||
|
|
||||||
assert(token1.sigValid(secret))
|
assert(token1.sigValid(secret))
|
||||||
assert(token1.sigInvalid(otherSecret))
|
assert(token1.sigInvalid(otherSecret))
|
||||||
|
@ -78,7 +78,11 @@ case class LenientUri(
|
|||||||
.covary[F]
|
.covary[F]
|
||||||
.rethrow
|
.rethrow
|
||||||
.flatMap(url =>
|
.flatMap(url =>
|
||||||
fs2.io.readInputStream(Sync[F].delay(url.openStream()), chunkSize, true)
|
fs2.io.readInputStream(
|
||||||
|
Sync[F].delay(url.openStream()),
|
||||||
|
chunkSize,
|
||||||
|
closeAfterUse = true
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def readText[F[_]: Sync](chunkSize: Int): F[String] =
|
def readText[F[_]: Sync](chunkSize: Int): F[String] =
|
||||||
@ -121,7 +125,7 @@ object LenientUri {
|
|||||||
val isRoot = true
|
val isRoot = true
|
||||||
val isEmpty = false
|
val isEmpty = false
|
||||||
def /(seg: String): Path =
|
def /(seg: String): Path =
|
||||||
NonEmptyPath(NonEmptyList.of(seg), false)
|
NonEmptyPath(NonEmptyList.of(seg), trailingSlash = false)
|
||||||
def asString = "/"
|
def asString = "/"
|
||||||
}
|
}
|
||||||
case object EmptyPath extends Path {
|
case object EmptyPath extends Path {
|
||||||
@ -129,7 +133,7 @@ object LenientUri {
|
|||||||
val isRoot = false
|
val isRoot = false
|
||||||
val isEmpty = true
|
val isEmpty = true
|
||||||
def /(seg: String): Path =
|
def /(seg: String): Path =
|
||||||
NonEmptyPath(NonEmptyList.of(seg), false)
|
NonEmptyPath(NonEmptyList.of(seg), trailingSlash = false)
|
||||||
def asString = ""
|
def asString = ""
|
||||||
}
|
}
|
||||||
case class NonEmptyPath(segs: NonEmptyList[String], trailingSlash: Boolean)
|
case class NonEmptyPath(segs: NonEmptyList[String], trailingSlash: Boolean)
|
||||||
|
@ -194,7 +194,7 @@ object MimeType {
|
|||||||
val csValueStart = in.substring(n + "charset=".length).trim
|
val csValueStart = in.substring(n + "charset=".length).trim
|
||||||
val csName = csValueStart.indexOf(';') match {
|
val csName = csValueStart.indexOf(';') match {
|
||||||
case -1 => unquote(csValueStart).trim
|
case -1 => unquote(csValueStart).trim
|
||||||
case n => unquote(csValueStart.substring(0, n)).trim
|
case n2 => unquote(csValueStart.substring(0, n2)).trim
|
||||||
}
|
}
|
||||||
if (Charset.isSupported(csName)) Right((Some(Charset.forName(csName)), ""))
|
if (Charset.isSupported(csName)) Right((Some(Charset.forName(csName)), ""))
|
||||||
else Right((None, ""))
|
else Right((None, ""))
|
||||||
|
@ -62,7 +62,7 @@ object UrlMatcher {
|
|||||||
// strip path to only match prefixes
|
// strip path to only match prefixes
|
||||||
val mPath: LenientUri.Path =
|
val mPath: LenientUri.Path =
|
||||||
NonEmptyList.fromList(url.path.segments.take(pathSegmentCount)) match {
|
NonEmptyList.fromList(url.path.segments.take(pathSegmentCount)) match {
|
||||||
case Some(nel) => LenientUri.NonEmptyPath(nel, false)
|
case Some(nel) => LenientUri.NonEmptyPath(nel, trailingSlash = false)
|
||||||
case None => LenientUri.RootPath
|
case None => LenientUri.RootPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ object OcrMyPdf {
|
|||||||
"ocrmypdf",
|
"ocrmypdf",
|
||||||
cfg.command.replace(Map("{{lang}}" -> lang.iso3)),
|
cfg.command.replace(Map("{{lang}}" -> lang.iso3)),
|
||||||
cfg.workingDir,
|
cfg.workingDir,
|
||||||
false,
|
useStdin = false,
|
||||||
logger,
|
logger,
|
||||||
reader
|
reader
|
||||||
)(in, handler)
|
)(in, handler)
|
||||||
|
@ -31,7 +31,7 @@ object Tesseract {
|
|||||||
"tesseract",
|
"tesseract",
|
||||||
cfg.command.replace(Map("{{lang}}" -> lang.iso3)),
|
cfg.command.replace(Map("{{lang}}" -> lang.iso3)),
|
||||||
cfg.workingDir,
|
cfg.workingDir,
|
||||||
false,
|
useStdin = false,
|
||||||
logger,
|
logger,
|
||||||
reader
|
reader
|
||||||
)(in, handler)
|
)(in, handler)
|
||||||
|
@ -29,7 +29,7 @@ object Unoconv {
|
|||||||
"unoconv",
|
"unoconv",
|
||||||
cfg.command,
|
cfg.command,
|
||||||
cfg.workingDir,
|
cfg.workingDir,
|
||||||
false,
|
useStdin = false,
|
||||||
logger,
|
logger,
|
||||||
reader
|
reader
|
||||||
)(
|
)(
|
||||||
|
@ -69,7 +69,7 @@ class ConversionTest extends FunSuite with FileChecks with TestLoggingConfig {
|
|||||||
target
|
target
|
||||||
),
|
),
|
||||||
OcrMyPdfConfig(
|
OcrMyPdfConfig(
|
||||||
true,
|
enabled = true,
|
||||||
SystemCommand.Config(
|
SystemCommand.Config(
|
||||||
"ocrmypdf",
|
"ocrmypdf",
|
||||||
Seq(
|
Seq(
|
||||||
@ -86,7 +86,7 @@ class ConversionTest extends FunSuite with FileChecks with TestLoggingConfig {
|
|||||||
),
|
),
|
||||||
target
|
target
|
||||||
),
|
),
|
||||||
ConvertConfig.DecryptPdf(true, Nil)
|
ConvertConfig.DecryptPdf(enabled = true, Nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
val conversion =
|
val conversion =
|
||||||
|
@ -45,7 +45,7 @@ object SolrMigration {
|
|||||||
description,
|
description,
|
||||||
FtsMigration.Result.reIndexAll.pure[F]
|
FtsMigration.Result.reIndexAll.pure[F]
|
||||||
),
|
),
|
||||||
true
|
dataChangeOnly = true
|
||||||
)
|
)
|
||||||
|
|
||||||
def indexAll[F[_]: Applicative](
|
def indexAll[F[_]: Applicative](
|
||||||
@ -59,7 +59,7 @@ object SolrMigration {
|
|||||||
description,
|
description,
|
||||||
FtsMigration.Result.indexAll.pure[F]
|
FtsMigration.Result.indexAll.pure[F]
|
||||||
),
|
),
|
||||||
true
|
dataChangeOnly = true
|
||||||
)
|
)
|
||||||
|
|
||||||
def apply[F[_]: Functor](
|
def apply[F[_]: Functor](
|
||||||
@ -74,6 +74,6 @@ object SolrMigration {
|
|||||||
description,
|
description,
|
||||||
task.map(_ => FtsMigration.Result.workDone)
|
task.map(_ => FtsMigration.Result.workDone)
|
||||||
),
|
),
|
||||||
false
|
dataChangeOnly = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -299,14 +299,22 @@ object SolrSetup {
|
|||||||
Map("add-field" -> body.asJson).asJson
|
Map("add-field" -> body.asJson).asJson
|
||||||
|
|
||||||
def string(field: Field): AddField =
|
def string(field: Field): AddField =
|
||||||
AddField(field, "string", true, true, false)
|
AddField(field, "string", stored = true, indexed = true, multiValued = false)
|
||||||
|
|
||||||
def textGeneral(field: Field): AddField =
|
def textGeneral(field: Field): AddField =
|
||||||
AddField(field, "text_general", true, true, false)
|
AddField(field, "text_general", stored = true, indexed = true, multiValued = false)
|
||||||
|
|
||||||
def textLang(field: Field, lang: Language): AddField =
|
def textLang(field: Field, lang: Language): AddField =
|
||||||
if (lang == Language.Czech) AddField(field, s"text_cz", true, true, false)
|
if (lang == Language.Czech)
|
||||||
else AddField(field, s"text_${lang.iso2}", true, true, false)
|
AddField(field, s"text_cz", stored = true, indexed = true, multiValued = false)
|
||||||
|
else
|
||||||
|
AddField(
|
||||||
|
field,
|
||||||
|
s"text_${lang.iso2}",
|
||||||
|
stored = true,
|
||||||
|
indexed = true,
|
||||||
|
multiValued = false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
case class DeleteField(name: Field)
|
case class DeleteField(name: Field)
|
||||||
|
@ -30,7 +30,7 @@ object EmptyTrashTask {
|
|||||||
UserTask(
|
UserTask(
|
||||||
args.periodicTaskId,
|
args.periodicTaskId,
|
||||||
EmptyTrashArgs.taskName,
|
EmptyTrashArgs.taskName,
|
||||||
true,
|
enabled = true,
|
||||||
ce,
|
ce,
|
||||||
None,
|
None,
|
||||||
args
|
args
|
||||||
|
@ -29,23 +29,23 @@ object FileCopyTask {
|
|||||||
case class CopyResult(success: Boolean, message: String, counter: List[Counter])
|
case class CopyResult(success: Boolean, message: String, counter: List[Counter])
|
||||||
object CopyResult {
|
object CopyResult {
|
||||||
def noSourceImpl: CopyResult =
|
def noSourceImpl: CopyResult =
|
||||||
CopyResult(false, "No source BinaryStore implementation found!", Nil)
|
CopyResult(success = false, "No source BinaryStore implementation found!", Nil)
|
||||||
|
|
||||||
def noTargetImpl: CopyResult =
|
def noTargetImpl: CopyResult =
|
||||||
CopyResult(false, "No target BinaryStore implementation found!", Nil)
|
CopyResult(success = false, "No target BinaryStore implementation found!", Nil)
|
||||||
|
|
||||||
def noSourceStore(id: Ident): CopyResult =
|
def noSourceStore(id: Ident): CopyResult =
|
||||||
CopyResult(
|
CopyResult(
|
||||||
false,
|
success = false,
|
||||||
s"No source file repo found with id: ${id.id}. Make sure it is present in the config.",
|
s"No source file repo found with id: ${id.id}. Make sure it is present in the config.",
|
||||||
Nil
|
Nil
|
||||||
)
|
)
|
||||||
|
|
||||||
def noTargetStore: CopyResult =
|
def noTargetStore: CopyResult =
|
||||||
CopyResult(false, "No target file repositories defined", Nil)
|
CopyResult(success = false, "No target file repositories defined", Nil)
|
||||||
|
|
||||||
def success(counter: NonEmptyList[Counter]): CopyResult =
|
def success(counter: NonEmptyList[Counter]): CopyResult =
|
||||||
CopyResult(true, "Done", counter.toList)
|
CopyResult(success = true, "Done", counter.toList)
|
||||||
|
|
||||||
implicit val binaryIdCodec: Codec[BinaryId] =
|
implicit val binaryIdCodec: Codec[BinaryId] =
|
||||||
Codec.from(
|
Codec.from(
|
||||||
@ -96,8 +96,10 @@ object FileCopyTask {
|
|||||||
.fromList(targets.filter(_ != srcConfig))
|
.fromList(targets.filter(_ != srcConfig))
|
||||||
.toRight(CopyResult.noTargetStore)
|
.toRight(CopyResult.noTargetStore)
|
||||||
|
|
||||||
srcRepo = store.createFileRepository(srcConfig, true)
|
srcRepo = store.createFileRepository(srcConfig, withAttributeStore = true)
|
||||||
targetRepos = trgConfig.map(store.createFileRepository(_, false))
|
targetRepos = trgConfig.map(
|
||||||
|
store.createFileRepository(_, withAttributeStore = false)
|
||||||
|
)
|
||||||
} yield (srcRepo, targetRepos)
|
} yield (srcRepo, targetRepos)
|
||||||
|
|
||||||
data match {
|
data match {
|
||||||
|
@ -13,8 +13,8 @@ case class CleanupResult(removed: Int, disabled: Boolean) {
|
|||||||
def asString = if (disabled) "disabled" else s"$removed"
|
def asString = if (disabled) "disabled" else s"$removed"
|
||||||
}
|
}
|
||||||
object CleanupResult {
|
object CleanupResult {
|
||||||
def of(n: Int): CleanupResult = CleanupResult(n, false)
|
def of(n: Int): CleanupResult = CleanupResult(n, disabled = false)
|
||||||
def disabled: CleanupResult = CleanupResult(0, true)
|
def disabled: CleanupResult = CleanupResult(0, disabled = true)
|
||||||
|
|
||||||
implicit val jsonEncoder: Encoder[CleanupResult] =
|
implicit val jsonEncoder: Encoder[CleanupResult] =
|
||||||
deriveEncoder
|
deriveEncoder
|
||||||
|
@ -55,7 +55,7 @@ object HouseKeepingTask {
|
|||||||
UserTask(
|
UserTask(
|
||||||
periodicId,
|
periodicId,
|
||||||
taskName,
|
taskName,
|
||||||
true,
|
enabled = true,
|
||||||
ce,
|
ce,
|
||||||
"Docspell house-keeping".some,
|
"Docspell house-keeping".some,
|
||||||
()
|
()
|
||||||
|
@ -222,13 +222,13 @@ object FindProposal {
|
|||||||
def searchExact[F[_]: Sync](ctx: Context[F, Args], store: Store[F]): Finder[F] =
|
def searchExact[F[_]: Sync](ctx: Context[F, Args], store: Store[F]): Finder[F] =
|
||||||
labels =>
|
labels =>
|
||||||
labels.toList
|
labels.toList
|
||||||
.traverse(nl => search(nl, true, ctx, store))
|
.traverse(nl => search(nl, exact = true, ctx, store))
|
||||||
.map(MetaProposalList.flatten)
|
.map(MetaProposalList.flatten)
|
||||||
|
|
||||||
def searchFuzzy[F[_]: Sync](ctx: Context[F, Args], store: Store[F]): Finder[F] =
|
def searchFuzzy[F[_]: Sync](ctx: Context[F, Args], store: Store[F]): Finder[F] =
|
||||||
labels =>
|
labels =>
|
||||||
labels.toList
|
labels.toList
|
||||||
.traverse(nl => search(nl, false, ctx, store))
|
.traverse(nl => search(nl, exact = false, ctx, store))
|
||||||
.map(MetaProposalList.flatten)
|
.map(MetaProposalList.flatten)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,10 +131,10 @@ object ReProcessItem {
|
|||||||
data.item.source, // source-id
|
data.item.source, // source-id
|
||||||
None, // folder
|
None, // folder
|
||||||
Seq.empty,
|
Seq.empty,
|
||||||
false,
|
skipDuplicate = false,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
true,
|
reprocess = true,
|
||||||
None, // attachOnly (not used when reprocessing attachments)
|
None, // attachOnly (not used when reprocessing attachments)
|
||||||
None // cannot retain customData from an already existing item
|
None // cannot retain customData from an already existing item
|
||||||
),
|
),
|
||||||
|
@ -75,7 +75,7 @@ object TextAnalysis {
|
|||||||
analyser: TextAnalyser[F],
|
analyser: TextAnalyser[F],
|
||||||
nerFile: RegexNerFile[F]
|
nerFile: RegexNerFile[F]
|
||||||
)(rm: RAttachmentMeta): F[(RAttachmentMeta, AttachmentDates)] = {
|
)(rm: RAttachmentMeta): F[(RAttachmentMeta, AttachmentDates)] = {
|
||||||
val settings = NlpSettings(ctx.args.meta.language, false, None)
|
val settings = NlpSettings(ctx.args.meta.language, highRecall = false, None)
|
||||||
for {
|
for {
|
||||||
customNer <- nerFile.makeFile(ctx.args.meta.collective)
|
customNer <- nerFile.makeFile(ctx.args.meta.collective)
|
||||||
sett = settings.copy(regexNer = customNer)
|
sett = settings.copy(regexNer = customNer)
|
||||||
|
@ -28,7 +28,7 @@ object JoexRoutes {
|
|||||||
for {
|
for {
|
||||||
_ <- app.scheduler.notifyChange
|
_ <- app.scheduler.notifyChange
|
||||||
_ <- app.periodicScheduler.notifyChange
|
_ <- app.periodicScheduler.notifyChange
|
||||||
resp <- Ok(BasicResult(true, "Schedulers notified."))
|
resp <- Ok(BasicResult(success = true, "Schedulers notified."))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case GET -> Root / "running" =>
|
case GET -> Root / "running" =>
|
||||||
@ -43,7 +43,7 @@ object JoexRoutes {
|
|||||||
_ <- Async[F].start(
|
_ <- Async[F].start(
|
||||||
Temporal[F].sleep(Duration.seconds(1).toScala) *> app.initShutdown
|
Temporal[F].sleep(Duration.seconds(1).toScala) *> app.initShutdown
|
||||||
)
|
)
|
||||||
resp <- Ok(BasicResult(true, "Shutdown initiated."))
|
resp <- Ok(BasicResult(success = true, "Shutdown initiated."))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case GET -> Root / "job" / Ident(id) =>
|
case GET -> Root / "job" / Ident(id) =>
|
||||||
@ -54,7 +54,9 @@ object JoexRoutes {
|
|||||||
job <- optJob
|
job <- optJob
|
||||||
log <- optLog
|
log <- optLog
|
||||||
} yield mkJobLog(job, log)
|
} yield mkJobLog(job, log)
|
||||||
resp <- jAndL.map(Ok(_)).getOrElse(NotFound(BasicResult(false, "Not found")))
|
resp <- jAndL
|
||||||
|
.map(Ok(_))
|
||||||
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case POST -> Root / "job" / Ident(id) / "cancel" =>
|
case POST -> Root / "job" / Ident(id) / "cancel" =>
|
||||||
|
@ -323,7 +323,7 @@ object ScanMailboxTask {
|
|||||||
s"mailbox-${ctx.args.account.login.id}",
|
s"mailbox-${ctx.args.account.login.id}",
|
||||||
args.itemFolder,
|
args.itemFolder,
|
||||||
Seq.empty,
|
Seq.empty,
|
||||||
true,
|
skipDuplicates = true,
|
||||||
args.fileFilter.getOrElse(Glob.all),
|
args.fileFilter.getOrElse(Glob.all),
|
||||||
args.tags.getOrElse(Nil),
|
args.tags.getOrElse(Nil),
|
||||||
args.language,
|
args.language,
|
||||||
|
@ -164,7 +164,7 @@ object Event {
|
|||||||
for {
|
for {
|
||||||
id1 <- Ident.randomId[F]
|
id1 <- Ident.randomId[F]
|
||||||
id2 <- Ident.randomId[F]
|
id2 <- Ident.randomId[F]
|
||||||
} yield ItemSelection(account, Nel.of(id1, id2), true, baseUrl, None)
|
} yield ItemSelection(account, Nel.of(id1, id2), more = true, baseUrl, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Event when a new job is added to the queue */
|
/** Event when a new job is added to the queue */
|
||||||
|
@ -87,10 +87,10 @@ object ParseFailure {
|
|||||||
SimpleMessage(offset, message)
|
SimpleMessage(offset, message)
|
||||||
|
|
||||||
case InRange(offset, lower, upper) =>
|
case InRange(offset, lower, upper) =>
|
||||||
if (lower == upper) ExpectMessage(offset, List(lower.toString), true)
|
if (lower == upper) ExpectMessage(offset, List(lower.toString), exhaustive = true)
|
||||||
else {
|
else {
|
||||||
val expect = s"$lower-$upper"
|
val expect = s"$lower-$upper"
|
||||||
ExpectMessage(offset, List(expect), true)
|
ExpectMessage(offset, List(expect), exhaustive = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
case Length(offset, expected, actual) =>
|
case Length(offset, expected, actual) =>
|
||||||
@ -110,6 +110,10 @@ object ParseFailure {
|
|||||||
ExpectMessage(offset, options.take(7), options.size < 8)
|
ExpectMessage(offset, options.take(7), options.size < 8)
|
||||||
|
|
||||||
case WithContext(ctx, expect) =>
|
case WithContext(ctx, expect) =>
|
||||||
ExpectMessage(expect.offset, s"Failed to parse near: $ctx" :: Nil, true)
|
ExpectMessage(
|
||||||
|
expect.offset,
|
||||||
|
s"Failed to parse near: $ctx" :: Nil,
|
||||||
|
exhaustive = true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ trait Conversions {
|
|||||||
sourceName,
|
sourceName,
|
||||||
None,
|
None,
|
||||||
validFileTypes,
|
validFileTypes,
|
||||||
false,
|
skipDuplicates = false,
|
||||||
Glob.all,
|
Glob.all,
|
||||||
Nil,
|
Nil,
|
||||||
None,
|
None,
|
||||||
@ -641,82 +641,86 @@ trait Conversions {
|
|||||||
def basicResult(r: SetValueResult): BasicResult =
|
def basicResult(r: SetValueResult): BasicResult =
|
||||||
r match {
|
r match {
|
||||||
case SetValueResult.FieldNotFound =>
|
case SetValueResult.FieldNotFound =>
|
||||||
BasicResult(false, "The given field is unknown")
|
BasicResult(success = false, "The given field is unknown")
|
||||||
case SetValueResult.ItemNotFound =>
|
case SetValueResult.ItemNotFound =>
|
||||||
BasicResult(false, "The given item is unknown")
|
BasicResult(success = false, "The given item is unknown")
|
||||||
case SetValueResult.ValueInvalid(msg) =>
|
case SetValueResult.ValueInvalid(msg) =>
|
||||||
BasicResult(false, s"The value is invalid: $msg")
|
BasicResult(success = false, s"The value is invalid: $msg")
|
||||||
case SetValueResult.Success =>
|
case SetValueResult.Success =>
|
||||||
BasicResult(true, "Custom field value set successfully.")
|
BasicResult(success = true, "Custom field value set successfully.")
|
||||||
}
|
}
|
||||||
|
|
||||||
def basicResult(cr: JobCancelResult): BasicResult =
|
def basicResult(cr: JobCancelResult): BasicResult =
|
||||||
cr match {
|
cr match {
|
||||||
case JobCancelResult.JobNotFound => BasicResult(false, "Job not found")
|
case JobCancelResult.JobNotFound => BasicResult(success = false, "Job not found")
|
||||||
case JobCancelResult.CancelRequested =>
|
case JobCancelResult.CancelRequested =>
|
||||||
BasicResult(true, "Cancel was requested at the job executor")
|
BasicResult(success = true, "Cancel was requested at the job executor")
|
||||||
case JobCancelResult.Removed =>
|
case JobCancelResult.Removed =>
|
||||||
BasicResult(true, "The job has been removed from the queue.")
|
BasicResult(success = true, "The job has been removed from the queue.")
|
||||||
}
|
}
|
||||||
|
|
||||||
def idResult(ar: AddResult, id: Ident, successMsg: String): IdResult =
|
def idResult(ar: AddResult, id: Ident, successMsg: String): IdResult =
|
||||||
ar match {
|
ar match {
|
||||||
case AddResult.Success => IdResult(true, successMsg, id)
|
case AddResult.Success => IdResult(success = true, successMsg, id)
|
||||||
case AddResult.EntityExists(msg) => IdResult(false, msg, Ident.unsafe(""))
|
case AddResult.EntityExists(msg) => IdResult(success = false, msg, Ident.unsafe(""))
|
||||||
case AddResult.Failure(ex) =>
|
case AddResult.Failure(ex) =>
|
||||||
IdResult(false, s"Internal error: ${ex.getMessage}", Ident.unsafe(""))
|
IdResult(success = false, s"Internal error: ${ex.getMessage}", Ident.unsafe(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
def basicResult(ar: AddResult, successMsg: String): BasicResult =
|
def basicResult(ar: AddResult, successMsg: String): BasicResult =
|
||||||
ar match {
|
ar match {
|
||||||
case AddResult.Success => BasicResult(true, successMsg)
|
case AddResult.Success => BasicResult(success = true, successMsg)
|
||||||
case AddResult.EntityExists(msg) => BasicResult(false, msg)
|
case AddResult.EntityExists(msg) => BasicResult(success = false, msg)
|
||||||
case AddResult.Failure(ex) =>
|
case AddResult.Failure(ex) =>
|
||||||
BasicResult(false, s"Internal error: ${ex.getMessage}")
|
BasicResult(success = false, s"Internal error: ${ex.getMessage}")
|
||||||
}
|
}
|
||||||
|
|
||||||
def basicResult(ar: UpdateResult, successMsg: String): BasicResult =
|
def basicResult(ar: UpdateResult, successMsg: String): BasicResult =
|
||||||
ar match {
|
ar match {
|
||||||
case UpdateResult.Success => BasicResult(true, successMsg)
|
case UpdateResult.Success => BasicResult(success = true, successMsg)
|
||||||
case UpdateResult.NotFound => BasicResult(false, "Not found")
|
case UpdateResult.NotFound => BasicResult(success = false, "Not found")
|
||||||
case UpdateResult.Failure(ex) =>
|
case UpdateResult.Failure(ex) =>
|
||||||
BasicResult(false, s"Error: ${ex.getMessage}")
|
BasicResult(success = false, s"Error: ${ex.getMessage}")
|
||||||
}
|
}
|
||||||
|
|
||||||
def basicResult(ur: OUpload.UploadResult): BasicResult =
|
def basicResult(ur: OUpload.UploadResult): BasicResult =
|
||||||
ur match {
|
ur match {
|
||||||
case UploadResult.Success => BasicResult(true, "Files submitted.")
|
case UploadResult.Success => BasicResult(success = true, "Files submitted.")
|
||||||
case UploadResult.NoFiles => BasicResult(false, "There were no files to submit.")
|
case UploadResult.NoFiles =>
|
||||||
case UploadResult.NoSource => BasicResult(false, "The source id is not valid.")
|
BasicResult(success = false, "There were no files to submit.")
|
||||||
case UploadResult.NoItem => BasicResult(false, "The item could not be found.")
|
case UploadResult.NoSource =>
|
||||||
|
BasicResult(success = false, "The source id is not valid.")
|
||||||
|
case UploadResult.NoItem =>
|
||||||
|
BasicResult(success = false, "The item could not be found.")
|
||||||
case UploadResult.NoCollective =>
|
case UploadResult.NoCollective =>
|
||||||
BasicResult(false, "The collective could not be found.")
|
BasicResult(success = false, "The collective could not be found.")
|
||||||
case UploadResult.StoreFailure(_) =>
|
case UploadResult.StoreFailure(_) =>
|
||||||
BasicResult(
|
BasicResult(
|
||||||
false,
|
success = false,
|
||||||
"There were errors storing a file! See the server logs for details."
|
"There were errors storing a file! See the server logs for details."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
def basicResult(cr: PassChangeResult): BasicResult =
|
def basicResult(cr: PassChangeResult): BasicResult =
|
||||||
cr match {
|
cr match {
|
||||||
case PassChangeResult.Success => BasicResult(true, "Password changed.")
|
case PassChangeResult.Success => BasicResult(success = true, "Password changed.")
|
||||||
case PassChangeResult.UpdateFailed =>
|
case PassChangeResult.UpdateFailed =>
|
||||||
BasicResult(false, "The database update failed.")
|
BasicResult(success = false, "The database update failed.")
|
||||||
case PassChangeResult.PasswordMismatch =>
|
case PassChangeResult.PasswordMismatch =>
|
||||||
BasicResult(false, "The current password is incorrect.")
|
BasicResult(success = false, "The current password is incorrect.")
|
||||||
case PassChangeResult.UserNotFound => BasicResult(false, "User not found.")
|
case PassChangeResult.UserNotFound =>
|
||||||
|
BasicResult(success = false, "User not found.")
|
||||||
case PassChangeResult.InvalidSource(source) =>
|
case PassChangeResult.InvalidSource(source) =>
|
||||||
BasicResult(
|
BasicResult(
|
||||||
false,
|
success = false,
|
||||||
s"User has invalid soure: $source. Passwords are managed elsewhere."
|
s"User has invalid soure: $source. Passwords are managed elsewhere."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
def basicResult(e: Either[Throwable, _], successMsg: String): BasicResult =
|
def basicResult(e: Either[Throwable, _], successMsg: String): BasicResult =
|
||||||
e match {
|
e match {
|
||||||
case Right(_) => BasicResult(true, successMsg)
|
case Right(_) => BasicResult(success = true, successMsg)
|
||||||
case Left(ex) => BasicResult(false, ex.getMessage)
|
case Left(ex) => BasicResult(success = false, ex.getMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MIME Type
|
// MIME Type
|
||||||
|
@ -38,7 +38,7 @@ object BinaryUtil {
|
|||||||
if (matches) withResponseHeaders(dsl, NotModified())(data)
|
if (matches) withResponseHeaders(dsl, NotModified())(data)
|
||||||
else makeByteResp(dsl)(data)
|
else makeByteResp(dsl)(data)
|
||||||
}
|
}
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
}
|
}
|
||||||
|
|
||||||
def respondHead[F[_]: Async](dsl: Http4sDsl[F])(
|
def respondHead[F[_]: Async](dsl: Http4sDsl[F])(
|
||||||
@ -48,7 +48,7 @@ object BinaryUtil {
|
|||||||
|
|
||||||
fileData
|
fileData
|
||||||
.map(data => withResponseHeaders(dsl, Ok())(data))
|
.map(data => withResponseHeaders(dsl, Ok())(data))
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
}
|
}
|
||||||
|
|
||||||
def respondPreview[F[_]: Async](dsl: Http4sDsl[F], req: Request[F])(
|
def respondPreview[F[_]: Async](dsl: Http4sDsl[F], req: Request[F])(
|
||||||
@ -56,7 +56,7 @@ object BinaryUtil {
|
|||||||
): F[Response[F]] = {
|
): F[Response[F]] = {
|
||||||
import dsl._
|
import dsl._
|
||||||
def notFound =
|
def notFound =
|
||||||
NotFound(BasicResult(false, "Not found"))
|
NotFound(BasicResult(success = false, "Not found"))
|
||||||
|
|
||||||
QP.WithFallback.unapply(req.multiParams) match {
|
QP.WithFallback.unapply(req.multiParams) match {
|
||||||
case Some(bool) =>
|
case Some(bool) =>
|
||||||
@ -75,7 +75,7 @@ object BinaryUtil {
|
|||||||
)
|
)
|
||||||
|
|
||||||
case None =>
|
case None =>
|
||||||
BadRequest(BasicResult(false, "Invalid query parameter 'withFallback'"))
|
BadRequest(BasicResult(success = false, "Invalid query parameter 'withFallback'"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ object BinaryUtil {
|
|||||||
import dsl._
|
import dsl._
|
||||||
fileData
|
fileData
|
||||||
.map(data => withResponseHeaders(dsl, Ok())(data))
|
.map(data => withResponseHeaders(dsl, Ok())(data))
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
}
|
}
|
||||||
|
|
||||||
def withResponseHeaders[F[_]: Sync](dsl: Http4sDsl[F], resp: F[Response[F]])(
|
def withResponseHeaders[F[_]: Sync](dsl: Http4sDsl[F], resp: F[Response[F]])(
|
||||||
|
@ -33,10 +33,10 @@ object ThrowableResponseMapper {
|
|||||||
def toResponse(ex: Throwable): F[Response[F]] =
|
def toResponse(ex: Throwable): F[Response[F]] =
|
||||||
ex match {
|
ex match {
|
||||||
case _: IllegalArgumentException =>
|
case _: IllegalArgumentException =>
|
||||||
BadRequest(BasicResult(false, ex.getMessage))
|
BadRequest(BasicResult(success = false, ex.getMessage))
|
||||||
|
|
||||||
case _ =>
|
case _ =>
|
||||||
InternalServerError(BasicResult(false, ex.getMessage))
|
InternalServerError(BasicResult(success = false, ex.getMessage))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ object AddonArchiveRoutes extends AddonValidationSupport {
|
|||||||
case req @ POST -> Root :? Sync(sync) =>
|
case req @ POST -> Root :? Sync(sync) =>
|
||||||
def create(r: Option[RAddonArchive]) =
|
def create(r: Option[RAddonArchive]) =
|
||||||
IdResult(
|
IdResult(
|
||||||
true,
|
success = true,
|
||||||
r.fold("Addon submitted for installation")(r =>
|
r.fold("Addon submitted for installation")(r =>
|
||||||
s"Addon installed: ${r.id.id}"
|
s"Addon installed: ${r.id.id}"
|
||||||
),
|
),
|
||||||
@ -77,7 +77,7 @@ object AddonArchiveRoutes extends AddonValidationSupport {
|
|||||||
case PUT -> Root / Ident(id) :? Sync(sync) =>
|
case PUT -> Root / Ident(id) :? Sync(sync) =>
|
||||||
def create(r: Option[AddonMeta]) =
|
def create(r: Option[AddonMeta]) =
|
||||||
BasicResult(
|
BasicResult(
|
||||||
true,
|
success = true,
|
||||||
r.fold("Addon updated in background")(m =>
|
r.fold("Addon updated in background")(m =>
|
||||||
s"Addon updated: ${m.nameAndVersion}"
|
s"Addon updated: ${m.nameAndVersion}"
|
||||||
)
|
)
|
||||||
@ -99,8 +99,8 @@ object AddonArchiveRoutes extends AddonValidationSupport {
|
|||||||
for {
|
for {
|
||||||
flag <- backend.addons.deleteAddon(token.account.collectiveId, id)
|
flag <- backend.addons.deleteAddon(token.account.collectiveId, id)
|
||||||
resp <-
|
resp <-
|
||||||
if (flag) Ok(BasicResult(true, "Addon deleted"))
|
if (flag) Ok(BasicResult(success = true, "Addon deleted"))
|
||||||
else NotFound(BasicResult(false, "Addon not found"))
|
else NotFound(BasicResult(success = false, "Addon not found"))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,11 +112,11 @@ object AddonArchiveRoutes extends AddonValidationSupport {
|
|||||||
import dsl._
|
import dsl._
|
||||||
|
|
||||||
def failWith(msg: String): F[Response[F]] =
|
def failWith(msg: String): F[Response[F]] =
|
||||||
Ok(IdResult(false, msg, Ident.unsafe("")))
|
Ok(IdResult(success = false, msg, Ident.unsafe("")))
|
||||||
|
|
||||||
e match {
|
e match {
|
||||||
case AddonValidationError.AddonNotFound =>
|
case AddonValidationError.AddonNotFound =>
|
||||||
NotFound(BasicResult(false, "Addon not found."))
|
NotFound(BasicResult(success = false, "Addon not found."))
|
||||||
|
|
||||||
case _ =>
|
case _ =>
|
||||||
failWith(validationErrorToMessage(e))
|
failWith(validationErrorToMessage(e))
|
||||||
|
@ -35,5 +35,5 @@ object AddonRoutes {
|
|||||||
"run" -> AddonRunRoutes(backend, token)
|
"run" -> AddonRunRoutes(backend, token)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Responses.notFoundRoute(BasicResult(false, "Addons disabled"))
|
Responses.notFoundRoute(BasicResult(success = false, "Addons disabled"))
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ object AddonRunConfigRoutes {
|
|||||||
.map(_.leftMap(_.message))
|
.map(_.leftMap(_.message))
|
||||||
)
|
)
|
||||||
resp <- res.fold(
|
resp <- res.fold(
|
||||||
msg => Ok(BasicResult(false, msg)),
|
msg => Ok(BasicResult(success = false, msg)),
|
||||||
id => Ok(IdResult(true, s"Addon run config added", id))
|
id => Ok(IdResult(success = true, s"Addon run config added", id))
|
||||||
)
|
)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
@ -58,8 +58,8 @@ object AddonRunConfigRoutes {
|
|||||||
.map(_.leftMap(_.message))
|
.map(_.leftMap(_.message))
|
||||||
)
|
)
|
||||||
resp <- res.fold(
|
resp <- res.fold(
|
||||||
msg => Ok(BasicResult(false, msg)),
|
msg => Ok(BasicResult(success = false, msg)),
|
||||||
id => Ok(IdResult(true, s"Addon run config updated", id))
|
id => Ok(IdResult(success = true, s"Addon run config updated", id))
|
||||||
)
|
)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
@ -67,8 +67,8 @@ object AddonRunConfigRoutes {
|
|||||||
for {
|
for {
|
||||||
flag <- backend.addons.deleteAddonRunConfig(token.account.collectiveId, id)
|
flag <- backend.addons.deleteAddonRunConfig(token.account.collectiveId, id)
|
||||||
resp <-
|
resp <-
|
||||||
if (flag) Ok(BasicResult(true, "Addon task deleted"))
|
if (flag) Ok(BasicResult(success = true, "Addon task deleted"))
|
||||||
else NotFound(BasicResult(false, "Addon task not found"))
|
else NotFound(BasicResult(success = false, "Addon task not found"))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ object AddonRunRoutes {
|
|||||||
input.addonRunConfigIds.toSet,
|
input.addonRunConfigIds.toSet,
|
||||||
UserTaskScope(token.account)
|
UserTaskScope(token.account)
|
||||||
)
|
)
|
||||||
resp <- Ok(BasicResult(true, "Job for running addons submitted."))
|
resp <- Ok(BasicResult(success = true, "Job for running addons submitted."))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ object AttachmentRoutes {
|
|||||||
resp <-
|
resp <-
|
||||||
fileData
|
fileData
|
||||||
.map(data => withResponseHeaders(Ok())(data))
|
.map(data => withResponseHeaders(Ok())(data))
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ GET -> Root / Ident(id) / "original" =>
|
case req @ GET -> Root / Ident(id) / "original" =>
|
||||||
@ -83,7 +83,7 @@ object AttachmentRoutes {
|
|||||||
if (matches) withResponseHeaders(NotModified())(data)
|
if (matches) withResponseHeaders(NotModified())(data)
|
||||||
else makeByteResp(data)
|
else makeByteResp(data)
|
||||||
}
|
}
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case HEAD -> Root / Ident(id) / "archive" =>
|
case HEAD -> Root / Ident(id) / "archive" =>
|
||||||
@ -93,7 +93,7 @@ object AttachmentRoutes {
|
|||||||
resp <-
|
resp <-
|
||||||
fileData
|
fileData
|
||||||
.map(data => withResponseHeaders(Ok())(data))
|
.map(data => withResponseHeaders(Ok())(data))
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ GET -> Root / Ident(id) / "archive" =>
|
case req @ GET -> Root / Ident(id) / "archive" =>
|
||||||
@ -108,7 +108,7 @@ object AttachmentRoutes {
|
|||||||
if (matches) withResponseHeaders(NotModified())(data)
|
if (matches) withResponseHeaders(NotModified())(data)
|
||||||
else makeByteResp(data)
|
else makeByteResp(data)
|
||||||
}
|
}
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ GET -> Root / Ident(id) / "preview" =>
|
case req @ GET -> Root / Ident(id) / "preview" =>
|
||||||
@ -148,7 +148,9 @@ object AttachmentRoutes {
|
|||||||
for {
|
for {
|
||||||
rm <- backend.itemSearch.findAttachmentMeta(id, user.account.collectiveId)
|
rm <- backend.itemSearch.findAttachmentMeta(id, user.account.collectiveId)
|
||||||
md = rm.map(Conversions.mkAttachmentMeta)
|
md = rm.map(Conversions.mkAttachmentMeta)
|
||||||
resp <- md.map(Ok(_)).getOrElse(NotFound(BasicResult(false, "Not found.")))
|
resp <- md
|
||||||
|
.map(Ok(_))
|
||||||
|
.getOrElse(NotFound(BasicResult(success = false, "Not found.")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ POST -> Root / Ident(id) / "name" =>
|
case req @ POST -> Root / Ident(id) / "name" =>
|
||||||
@ -169,8 +171,11 @@ object AttachmentRoutes {
|
|||||||
backend.attachment
|
backend.attachment
|
||||||
.setExtractedText(user.account.collectiveId, itemId, id, newText)
|
.setExtractedText(user.account.collectiveId, itemId, id, newText)
|
||||||
)
|
)
|
||||||
resp <- OptionT.liftF(Ok(BasicResult(true, "Extracted text updated.")))
|
resp <- OptionT.liftF(
|
||||||
} yield resp).getOrElseF(NotFound(BasicResult(false, "Attachment not found")))
|
Ok(BasicResult(success = true, "Extracted text updated."))
|
||||||
|
)
|
||||||
|
} yield resp)
|
||||||
|
.getOrElseF(NotFound(BasicResult(success = false, "Attachment not found")))
|
||||||
|
|
||||||
case DELETE -> Root / Ident(id) / "extracted-text" =>
|
case DELETE -> Root / Ident(id) / "extracted-text" =>
|
||||||
(for {
|
(for {
|
||||||
@ -181,7 +186,9 @@ object AttachmentRoutes {
|
|||||||
backend.attachment
|
backend.attachment
|
||||||
.setExtractedText(user.account.collectiveId, itemId, id, "".pure[F])
|
.setExtractedText(user.account.collectiveId, itemId, id, "".pure[F])
|
||||||
)
|
)
|
||||||
resp <- OptionT.liftF(Ok(BasicResult(true, "Extracted text cleared.")))
|
resp <- OptionT.liftF(
|
||||||
|
Ok(BasicResult(success = true, "Extracted text cleared."))
|
||||||
|
)
|
||||||
} yield resp).getOrElseF(NotFound())
|
} yield resp).getOrElseF(NotFound())
|
||||||
|
|
||||||
case GET -> Root / Ident(id) / "extracted-text" =>
|
case GET -> Root / Ident(id) / "extracted-text" =>
|
||||||
@ -190,14 +197,15 @@ object AttachmentRoutes {
|
|||||||
backend.itemSearch.findAttachmentMeta(id, user.account.collectiveId)
|
backend.itemSearch.findAttachmentMeta(id, user.account.collectiveId)
|
||||||
)
|
)
|
||||||
resp <- OptionT.liftF(Ok(OptionalText(meta.content)))
|
resp <- OptionT.liftF(Ok(OptionalText(meta.content)))
|
||||||
} yield resp).getOrElseF(NotFound(BasicResult(false, "Attachment not found")))
|
} yield resp)
|
||||||
|
.getOrElseF(NotFound(BasicResult(success = false, "Attachment not found")))
|
||||||
|
|
||||||
case DELETE -> Root / Ident(id) =>
|
case DELETE -> Root / Ident(id) =>
|
||||||
for {
|
for {
|
||||||
n <- backend.item.deleteAttachment(id, user.account.collectiveId)
|
n <- backend.item.deleteAttachment(id, user.account.collectiveId)
|
||||||
res =
|
res =
|
||||||
if (n == 0) BasicResult(false, "Attachment not found")
|
if (n == 0) BasicResult(success = false, "Attachment not found")
|
||||||
else BasicResult(true, "Attachment deleted.")
|
else BasicResult(success = true, "Attachment deleted.")
|
||||||
resp <- Ok(res)
|
resp <- Ok(res)
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,9 @@ object CalEventCheckRoutes {
|
|||||||
val next = ev
|
val next = ev
|
||||||
.nextElapses(now.toUtcDateTime, 2)
|
.nextElapses(now.toUtcDateTime, 2)
|
||||||
.map(Timestamp.atUtc)
|
.map(Timestamp.atUtc)
|
||||||
CalEventCheckResult(true, "Valid.", ev.some, next)
|
CalEventCheckResult(success = true, "Valid.", ev.some, next)
|
||||||
case Left(err) =>
|
case Left(err) =>
|
||||||
CalEventCheckResult(false, err, None, Nil)
|
CalEventCheckResult(success = false, err, None, Nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ object ClientSettingsRoutes {
|
|||||||
for {
|
for {
|
||||||
data <- req.as[Json]
|
data <- req.as[Json]
|
||||||
_ <- backend.clientSettings.saveUser(clientId, user.account.userId, data)
|
_ <- backend.clientSettings.saveUser(clientId, user.account.userId, data)
|
||||||
res <- Ok(BasicResult(true, "Settings stored"))
|
res <- Ok(BasicResult(success = true, "Settings stored"))
|
||||||
} yield res
|
} yield res
|
||||||
|
|
||||||
case GET -> Root / "user" / Ident(clientId) =>
|
case GET -> Root / "user" / Ident(clientId) =>
|
||||||
@ -97,7 +97,7 @@ object ClientSettingsRoutes {
|
|||||||
user.account.collectiveId,
|
user.account.collectiveId,
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
res <- Ok(BasicResult(true, "Settings stored"))
|
res <- Ok(BasicResult(success = true, "Settings stored"))
|
||||||
} yield res
|
} yield res
|
||||||
|
|
||||||
case GET -> Root / "collective" / Ident(clientId) =>
|
case GET -> Root / "collective" / Ident(clientId) =>
|
||||||
|
@ -118,7 +118,7 @@ object CollectiveRoutes {
|
|||||||
case POST -> Root / "classifier" / "startonce" =>
|
case POST -> Root / "classifier" / "startonce" =>
|
||||||
for {
|
for {
|
||||||
_ <- backend.collective.startLearnClassifier(user.account.collectiveId)
|
_ <- backend.collective.startLearnClassifier(user.account.collectiveId)
|
||||||
resp <- Ok(BasicResult(true, "Task submitted"))
|
resp <- Ok(BasicResult(success = true, "Task submitted"))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ POST -> Root / "emptytrash" / "startonce" =>
|
case req @ POST -> Root / "emptytrash" / "startonce" =>
|
||||||
@ -127,7 +127,7 @@ object CollectiveRoutes {
|
|||||||
_ <- backend.collective.startEmptyTrash(
|
_ <- backend.collective.startEmptyTrash(
|
||||||
EmptyTrashArgs(user.account.collectiveId, data.minAge)
|
EmptyTrashArgs(user.account.collectiveId, data.minAge)
|
||||||
)
|
)
|
||||||
resp <- Ok(BasicResult(true, "Task submitted"))
|
resp <- Ok(BasicResult(success = true, "Task submitted"))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ object CustomFieldRoutes {
|
|||||||
(for {
|
(for {
|
||||||
field <- OptionT(backend.customFields.findById(user.account.collectiveId, id))
|
field <- OptionT(backend.customFields.findById(user.account.collectiveId, id))
|
||||||
res <- OptionT.liftF(Ok(convertField(field)))
|
res <- OptionT.liftF(Ok(convertField(field)))
|
||||||
} yield res).getOrElseF(NotFound(BasicResult(false, "Not found")))
|
} yield res).getOrElseF(NotFound(BasicResult(success = false, "Not found")))
|
||||||
|
|
||||||
case req @ PUT -> Root / Ident(id) =>
|
case req @ PUT -> Root / Ident(id) =>
|
||||||
for {
|
for {
|
||||||
|
@ -126,7 +126,7 @@ object DownloadAllRoutes {
|
|||||||
case DELETE -> Root / "file" / Ident(id) =>
|
case DELETE -> Root / "file" / Ident(id) =>
|
||||||
for {
|
for {
|
||||||
_ <- backend.downloadAll.deleteFile(id)
|
_ <- backend.downloadAll.deleteFile(id)
|
||||||
resp <- Ok(BasicResult(true, "File deleted."))
|
resp <- Ok(BasicResult(success = true, "File deleted."))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case PUT -> Root / "cancel" / Ident(id) =>
|
case PUT -> Root / "cancel" / Ident(id) =>
|
||||||
|
@ -118,12 +118,12 @@ object FolderRoutes {
|
|||||||
private def mkFolderChangeResult(r: OFolder.FolderChangeResult): BasicResult =
|
private def mkFolderChangeResult(r: OFolder.FolderChangeResult): BasicResult =
|
||||||
r match {
|
r match {
|
||||||
case OFolder.FolderChangeResult.Success =>
|
case OFolder.FolderChangeResult.Success =>
|
||||||
BasicResult(true, "Successfully changed folder.")
|
BasicResult(success = true, "Successfully changed folder.")
|
||||||
case OFolder.FolderChangeResult.NotFound =>
|
case OFolder.FolderChangeResult.NotFound =>
|
||||||
BasicResult(false, "Folder or user not found.")
|
BasicResult(success = false, "Folder or user not found.")
|
||||||
case OFolder.FolderChangeResult.Forbidden =>
|
case OFolder.FolderChangeResult.Forbidden =>
|
||||||
BasicResult(false, "Not allowed to edit folder.")
|
BasicResult(success = false, "Not allowed to edit folder.")
|
||||||
case OFolder.FolderChangeResult.Exists =>
|
case OFolder.FolderChangeResult.Exists =>
|
||||||
BasicResult(false, "The member already exists.")
|
BasicResult(success = false, "The member already exists.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class ItemLinkRoutes[F[_]: Async](account: AccountInfo, backend: OItemLink[F])
|
|||||||
case DELETE -> Root / Ident(target) / Ident(id) =>
|
case DELETE -> Root / Ident(target) / Ident(id) =>
|
||||||
for {
|
for {
|
||||||
_ <- backend.removeAll(account.collectiveId, target, NonEmptyList.of(id))
|
_ <- backend.removeAll(account.collectiveId, target, NonEmptyList.of(id))
|
||||||
resp <- Ok(BasicResult(true, "Related items removed"))
|
resp <- Ok(BasicResult(success = true, "Related items removed"))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ POST -> Root / "addAll" =>
|
case req @ POST -> Root / "addAll" =>
|
||||||
@ -58,19 +58,21 @@ class ItemLinkRoutes[F[_]: Async](account: AccountInfo, backend: OItemLink[F])
|
|||||||
_ <- related
|
_ <- related
|
||||||
.map(backend.removeAll(account.collectiveId, input.item, _))
|
.map(backend.removeAll(account.collectiveId, input.item, _))
|
||||||
.getOrElse(
|
.getOrElse(
|
||||||
BadRequest(BasicResult(false, "List of related items must not be empty"))
|
BadRequest(
|
||||||
|
BasicResult(success = false, "List of related items must not be empty")
|
||||||
)
|
)
|
||||||
resp <- Ok(BasicResult(true, "Related items removed"))
|
)
|
||||||
|
resp <- Ok(BasicResult(success = true, "Related items removed"))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
|
|
||||||
private def convertResult(r: Option[LinkResult]): BasicResult =
|
private def convertResult(r: Option[LinkResult]): BasicResult =
|
||||||
r match {
|
r match {
|
||||||
case Some(LinkResult.Success) => BasicResult(true, "Related items added")
|
case Some(LinkResult.Success) => BasicResult(success = true, "Related items added")
|
||||||
case Some(LinkResult.LinkTargetItemError) =>
|
case Some(LinkResult.LinkTargetItemError) =>
|
||||||
BasicResult(false, "Items cannot be related to itself.")
|
BasicResult(success = false, "Items cannot be related to itself.")
|
||||||
case None =>
|
case None =>
|
||||||
BasicResult(false, "List of related items must not be empty")
|
BasicResult(success = false, "List of related items must not be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ object ItemRoutes {
|
|||||||
resp <-
|
resp <-
|
||||||
result
|
result
|
||||||
.map(r => Ok(r))
|
.map(r => Ok(r))
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found.")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found.")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case POST -> Root / Ident(id) / "confirm" =>
|
case POST -> Root / Ident(id) / "confirm" =>
|
||||||
@ -285,7 +285,7 @@ object ItemRoutes {
|
|||||||
|
|
||||||
case req @ GET -> Root / Ident(id) / "preview" :? QP.WithFallback(flag) =>
|
case req @ GET -> Root / Ident(id) / "preview" :? QP.WithFallback(flag) =>
|
||||||
def notFound =
|
def notFound =
|
||||||
NotFound(BasicResult(false, "Not found"))
|
NotFound(BasicResult(success = false, "Not found"))
|
||||||
for {
|
for {
|
||||||
preview <- backend.itemSearch.findItemPreview(id, user.account.collectiveId)
|
preview <- backend.itemSearch.findItemPreview(id, user.account.collectiveId)
|
||||||
inm = req.headers.get[`If-None-Match`].flatMap(_.tags)
|
inm = req.headers.get[`If-None-Match`].flatMap(_.tags)
|
||||||
@ -309,7 +309,7 @@ object ItemRoutes {
|
|||||||
resp <-
|
resp <-
|
||||||
preview
|
preview
|
||||||
.map(data => BinaryUtil.withResponseHeaders(dsl, Ok())(data))
|
.map(data => BinaryUtil.withResponseHeaders(dsl, Ok())(data))
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found")))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ POST -> Root / Ident(id) / "reprocess" =>
|
case req @ POST -> Root / Ident(id) / "reprocess" =>
|
||||||
|
@ -196,17 +196,17 @@ final class ItemSearchPart[F[_]: Async](
|
|||||||
Right(s)
|
Right(s)
|
||||||
|
|
||||||
case QueryParseResult.ParseFailed(err) =>
|
case QueryParseResult.ParseFailed(err) =>
|
||||||
BadRequest(BasicResult(false, s"Invalid query: $err")).asLeft
|
BadRequest(BasicResult(success = false, s"Invalid query: $err")).asLeft
|
||||||
|
|
||||||
case QueryParseResult.FulltextMismatch(Result.TooMany) =>
|
case QueryParseResult.FulltextMismatch(Result.TooMany) =>
|
||||||
BadRequest(
|
BadRequest(
|
||||||
BasicResult(false, "Only one fulltext search expression is allowed.")
|
BasicResult(success = false, "Only one fulltext search expression is allowed.")
|
||||||
).asLeft
|
).asLeft
|
||||||
|
|
||||||
case QueryParseResult.FulltextMismatch(Result.UnsupportedPosition) =>
|
case QueryParseResult.FulltextMismatch(Result.UnsupportedPosition) =>
|
||||||
BadRequest(
|
BadRequest(
|
||||||
BasicResult(
|
BasicResult(
|
||||||
false,
|
success = false,
|
||||||
"A fulltext search may only appear in the root and expression."
|
"A fulltext search may only appear in the root and expression."
|
||||||
)
|
)
|
||||||
).asLeft
|
).asLeft
|
||||||
|
@ -41,7 +41,9 @@ object LoginRoutes {
|
|||||||
makeResponse(dsl, cfg, req, result, token.account.asString)
|
makeResponse(dsl, cfg, req, result, token.account.asString)
|
||||||
)
|
)
|
||||||
case Left(err) =>
|
case Left(err) =>
|
||||||
BadRequest(BasicResult(false, s"Invalid authentication token: $err"))
|
BadRequest(
|
||||||
|
BasicResult(success = false, s"Invalid authentication token: $err")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
@ -97,7 +99,7 @@ object LoginRoutes {
|
|||||||
AuthResult(
|
AuthResult(
|
||||||
token.account.collective.id,
|
token.account.collective.id,
|
||||||
token.account.login.id,
|
token.account.login.id,
|
||||||
true,
|
success = true,
|
||||||
"Login successful",
|
"Login successful",
|
||||||
Some(cd.asString),
|
Some(cd.asString),
|
||||||
cfg.auth.sessionValid.millis,
|
cfg.auth.sessionValid.millis,
|
||||||
@ -112,7 +114,17 @@ object LoginRoutes {
|
|||||||
|
|
||||||
} yield resp
|
} yield resp
|
||||||
case _ =>
|
case _ =>
|
||||||
Ok(AuthResult("", account, false, "Login failed.", None, 0L, false))
|
Ok(
|
||||||
|
AuthResult(
|
||||||
|
"",
|
||||||
|
account,
|
||||||
|
success = false,
|
||||||
|
"Login failed.",
|
||||||
|
None,
|
||||||
|
0L,
|
||||||
|
requireSecondFactor = false
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ object MailSendRoutes {
|
|||||||
backend.mail.sendMail(user.account.userId, user.account.collectiveId, name, m)
|
backend.mail.sendMail(user.account.userId, user.account.collectiveId, name, m)
|
||||||
)
|
)
|
||||||
resp <- res.fold(
|
resp <- res.fold(
|
||||||
err => Ok(BasicResult(false, s"Invalid mail data: $err")),
|
err => Ok(BasicResult(success = false, s"Invalid mail data: $err")),
|
||||||
res => Ok(convertOut(res))
|
res => Ok(convertOut(res))
|
||||||
)
|
)
|
||||||
} yield resp
|
} yield resp
|
||||||
@ -56,15 +56,15 @@ object MailSendRoutes {
|
|||||||
def convertOut(res: SendResult): BasicResult =
|
def convertOut(res: SendResult): BasicResult =
|
||||||
res match {
|
res match {
|
||||||
case SendResult.Success(_) =>
|
case SendResult.Success(_) =>
|
||||||
BasicResult(true, "Mail sent.")
|
BasicResult(success = true, "Mail sent.")
|
||||||
case SendResult.SendFailure(ex) =>
|
case SendResult.SendFailure(ex) =>
|
||||||
BasicResult(false, s"Mail sending failed: ${ex.getMessage}")
|
BasicResult(success = false, s"Mail sending failed: ${ex.getMessage}")
|
||||||
case SendResult.StoreFailure(ex) =>
|
case SendResult.StoreFailure(ex) =>
|
||||||
BasicResult(
|
BasicResult(
|
||||||
false,
|
success = false,
|
||||||
s"Mail was sent, but could not be store to database: ${ex.getMessage}"
|
s"Mail was sent, but could not be store to database: ${ex.getMessage}"
|
||||||
)
|
)
|
||||||
case SendResult.NotFound =>
|
case SendResult.NotFound =>
|
||||||
BasicResult(false, s"There was no mail-connection or item found.")
|
BasicResult(success = false, s"There was no mail-connection or item found.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ object MailSettingsRoutes {
|
|||||||
resp <- OptionT.liftF(
|
resp <- OptionT.liftF(
|
||||||
Ok(
|
Ok(
|
||||||
up.fold(
|
up.fold(
|
||||||
err => BasicResult(false, err),
|
err => BasicResult(success = false, err),
|
||||||
ar => Conversions.basicResult(ar, "Mail settings stored.")
|
ar => Conversions.basicResult(ar, "Mail settings stored.")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -86,7 +86,7 @@ object MailSettingsRoutes {
|
|||||||
resp <- OptionT.liftF(
|
resp <- OptionT.liftF(
|
||||||
Ok(
|
Ok(
|
||||||
up.fold(
|
up.fold(
|
||||||
err => BasicResult(false, err),
|
err => BasicResult(success = false, err),
|
||||||
ar => Conversions.basicResult(ar, "Mail settings stored.")
|
ar => Conversions.basicResult(ar, "Mail settings stored.")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -105,10 +105,10 @@ object MailSettingsRoutes {
|
|||||||
resp <- OptionT.liftF(
|
resp <- OptionT.liftF(
|
||||||
Ok(
|
Ok(
|
||||||
up.fold(
|
up.fold(
|
||||||
err => BasicResult(false, err),
|
err => BasicResult(success = false, err),
|
||||||
n =>
|
n =>
|
||||||
if (n > 0) BasicResult(true, "Mail settings stored.")
|
if (n > 0) BasicResult(success = true, "Mail settings stored.")
|
||||||
else BasicResult(false, "Mail settings could not be saved")
|
else BasicResult(success = false, "Mail settings could not be saved")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -126,10 +126,10 @@ object MailSettingsRoutes {
|
|||||||
resp <- OptionT.liftF(
|
resp <- OptionT.liftF(
|
||||||
Ok(
|
Ok(
|
||||||
up.fold(
|
up.fold(
|
||||||
err => BasicResult(false, err),
|
err => BasicResult(success = false, err),
|
||||||
n =>
|
n =>
|
||||||
if (n > 0) BasicResult(true, "Mail settings stored.")
|
if (n > 0) BasicResult(success = true, "Mail settings stored.")
|
||||||
else BasicResult(false, "Mail settings could not be saved")
|
else BasicResult(success = false, "Mail settings could not be saved")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -139,8 +139,8 @@ object MailSettingsRoutes {
|
|||||||
for {
|
for {
|
||||||
n <- backend.mail.deleteSmtpSettings(user.account.userId, name)
|
n <- backend.mail.deleteSmtpSettings(user.account.userId, name)
|
||||||
resp <- Ok(
|
resp <- Ok(
|
||||||
if (n > 0) BasicResult(true, "Mail settings removed")
|
if (n > 0) BasicResult(success = true, "Mail settings removed")
|
||||||
else BasicResult(false, "Mail settings could not be removed")
|
else BasicResult(success = false, "Mail settings could not be removed")
|
||||||
)
|
)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
@ -148,8 +148,8 @@ object MailSettingsRoutes {
|
|||||||
for {
|
for {
|
||||||
n <- backend.mail.deleteImapSettings(user.account.userId, name)
|
n <- backend.mail.deleteImapSettings(user.account.userId, name)
|
||||||
resp <- Ok(
|
resp <- Ok(
|
||||||
if (n > 0) BasicResult(true, "Mail settings removed")
|
if (n > 0) BasicResult(success = true, "Mail settings removed")
|
||||||
else BasicResult(false, "Mail settings could not be removed")
|
else BasicResult(success = false, "Mail settings could not be removed")
|
||||||
)
|
)
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ object NotificationRoutes extends NonEmptyListSupport {
|
|||||||
.createChannel(c, user.account.userId)
|
.createChannel(c, user.account.userId)
|
||||||
.map(res => Conversions.basicResult(res, "Channel created"))
|
.map(res => Conversions.basicResult(res, "Channel created"))
|
||||||
}
|
}
|
||||||
.foldF(ex => BadRequest(BasicResult(false, ex.getMessage)), Ok(_))
|
.foldF(ex => BadRequest(BasicResult(success = false, ex.getMessage)), Ok(_))
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ PUT -> Root =>
|
case req @ PUT -> Root =>
|
||||||
@ -86,7 +86,7 @@ object NotificationRoutes extends NonEmptyListSupport {
|
|||||||
.updateChannel(c, user.account.userId)
|
.updateChannel(c, user.account.userId)
|
||||||
.map(res => Conversions.basicResult(res, "Channel created"))
|
.map(res => Conversions.basicResult(res, "Channel created"))
|
||||||
}
|
}
|
||||||
.foldF(ex => BadRequest(BasicResult(false, ex.getMessage)), Ok(_))
|
.foldF(ex => BadRequest(BasicResult(success = false, ex.getMessage)), Ok(_))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ object NotificationRoutes extends NonEmptyListSupport {
|
|||||||
resp <- data.asJsonWithMessage match {
|
resp <- data.asJsonWithMessage match {
|
||||||
case Right(m) => Ok(m)
|
case Right(m) => Ok(m)
|
||||||
case Left(err) =>
|
case Left(err) =>
|
||||||
BadRequest(BasicResult(false, s"Unable to render message: $err"))
|
BadRequest(BasicResult(success = false, s"Unable to render message: $err"))
|
||||||
}
|
}
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,8 @@ object NotifyDueItemsRoutes extends MailAddressCodec with NonEmptyListSupport {
|
|||||||
for {
|
for {
|
||||||
data <- req.as[PeriodicDueItemsSettings]
|
data <- req.as[PeriodicDueItemsSettings]
|
||||||
resp <-
|
resp <-
|
||||||
if (data.id.isEmpty) Ok(BasicResult(false, "Empty id is not allowed"))
|
if (data.id.isEmpty)
|
||||||
|
Ok(BasicResult(success = false, "Empty id is not allowed"))
|
||||||
else run(data)
|
else run(data)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ object PeriodicQueryRoutes extends MailAddressCodec with NonEmptyListSupport {
|
|||||||
for {
|
for {
|
||||||
data <- req.as[PeriodicQuerySettings]
|
data <- req.as[PeriodicQuerySettings]
|
||||||
resp <-
|
resp <-
|
||||||
if (data.id.isEmpty) Ok(BasicResult(false, "Empty id is not allowed"))
|
if (data.id.isEmpty)
|
||||||
|
Ok(BasicResult(success = false, "Empty id is not allowed"))
|
||||||
else run(data)
|
else run(data)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
|
@ -48,26 +48,26 @@ object RegisterRoutes {
|
|||||||
def convert(r: NewInviteResult): InviteResult =
|
def convert(r: NewInviteResult): InviteResult =
|
||||||
r match {
|
r match {
|
||||||
case NewInviteResult.Success(id) =>
|
case NewInviteResult.Success(id) =>
|
||||||
InviteResult(true, "New invitation created.", Some(id))
|
InviteResult(success = true, "New invitation created.", Some(id))
|
||||||
case NewInviteResult.InvitationDisabled =>
|
case NewInviteResult.InvitationDisabled =>
|
||||||
InviteResult(false, "Signing up is not enabled for invitations.", None)
|
InviteResult(success = false, "Signing up is not enabled for invitations.", None)
|
||||||
case NewInviteResult.PasswordMismatch =>
|
case NewInviteResult.PasswordMismatch =>
|
||||||
InviteResult(false, "Password is invalid.", None)
|
InviteResult(success = false, "Password is invalid.", None)
|
||||||
}
|
}
|
||||||
|
|
||||||
def convert(r: SignupResult): BasicResult =
|
def convert(r: SignupResult): BasicResult =
|
||||||
r match {
|
r match {
|
||||||
case SignupResult.CollectiveExists =>
|
case SignupResult.CollectiveExists =>
|
||||||
BasicResult(false, "A collective with this name already exists.")
|
BasicResult(success = false, "A collective with this name already exists.")
|
||||||
case SignupResult.InvalidInvitationKey =>
|
case SignupResult.InvalidInvitationKey =>
|
||||||
BasicResult(false, "Invalid invitation key.")
|
BasicResult(success = false, "Invalid invitation key.")
|
||||||
case SignupResult.SignupClosed =>
|
case SignupResult.SignupClosed =>
|
||||||
BasicResult(false, "Sorry, registration is closed.")
|
BasicResult(success = false, "Sorry, registration is closed.")
|
||||||
case SignupResult.Failure(ex) =>
|
case SignupResult.Failure(ex) =>
|
||||||
logger.error(ex)("Error signing up")
|
logger.error(ex)("Error signing up")
|
||||||
BasicResult(false, s"Internal error: ${ex.getMessage}")
|
BasicResult(success = false, s"Internal error: ${ex.getMessage}")
|
||||||
case SignupResult.Success =>
|
case SignupResult.Success =>
|
||||||
BasicResult(true, "Signup successful")
|
BasicResult(success = true, "Signup successful")
|
||||||
}
|
}
|
||||||
|
|
||||||
def convert(r: Registration): RegisterData =
|
def convert(r: Registration): RegisterData =
|
||||||
|
@ -82,7 +82,8 @@ object ScanMailboxRoutes {
|
|||||||
for {
|
for {
|
||||||
data <- req.as[ScanMailboxSettings]
|
data <- req.as[ScanMailboxSettings]
|
||||||
resp <-
|
resp <-
|
||||||
if (data.id.isEmpty) Ok(BasicResult(false, "Empty id is not allowed"))
|
if (data.id.isEmpty)
|
||||||
|
Ok(BasicResult(success = false, "Empty id is not allowed"))
|
||||||
else run(data)
|
else run(data)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ object ShareItemRoutes {
|
|||||||
resp <-
|
resp <-
|
||||||
result
|
result
|
||||||
.map(r => Ok(r))
|
.map(r => Ok(r))
|
||||||
.getOrElse(NotFound(BasicResult(false, "Not found.")))
|
.getOrElse(NotFound(BasicResult(success = false, "Not found.")))
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ object ShareRoutes {
|
|||||||
.sendMail(user.account.collectiveId, user.account.userId, name, m)
|
.sendMail(user.account.collectiveId, user.account.userId, name, m)
|
||||||
)
|
)
|
||||||
resp <- res.fold(
|
resp <- res.fold(
|
||||||
err => Ok(BasicResult(false, s"Invalid mail data: $err")),
|
err => Ok(BasicResult(success = false, s"Invalid mail data: $err")),
|
||||||
res => Ok(convertOut(res))
|
res => Ok(convertOut(res))
|
||||||
)
|
)
|
||||||
} yield resp
|
} yield resp
|
||||||
@ -100,14 +100,46 @@ object ShareRoutes {
|
|||||||
resp <- res match {
|
resp <- res match {
|
||||||
case VerifyResult.Success(token, name) =>
|
case VerifyResult.Success(token, name) =>
|
||||||
val cd = ShareCookieData(token)
|
val cd = ShareCookieData(token)
|
||||||
Ok(ShareVerifyResult(true, token.asString, false, "Success", name))
|
Ok(
|
||||||
|
ShareVerifyResult(
|
||||||
|
success = true,
|
||||||
|
token.asString,
|
||||||
|
passwordRequired = false,
|
||||||
|
"Success",
|
||||||
|
name
|
||||||
|
)
|
||||||
|
)
|
||||||
.map(cd.addCookie(ClientRequestInfo.getBaseUrl(cfg, req)))
|
.map(cd.addCookie(ClientRequestInfo.getBaseUrl(cfg, req)))
|
||||||
case VerifyResult.PasswordMismatch =>
|
case VerifyResult.PasswordMismatch =>
|
||||||
Ok(ShareVerifyResult(false, "", true, "Failed", None))
|
Ok(
|
||||||
|
ShareVerifyResult(
|
||||||
|
success = false,
|
||||||
|
"",
|
||||||
|
passwordRequired = true,
|
||||||
|
"Failed",
|
||||||
|
None
|
||||||
|
)
|
||||||
|
)
|
||||||
case VerifyResult.NotFound =>
|
case VerifyResult.NotFound =>
|
||||||
Ok(ShareVerifyResult(false, "", false, "Failed", None))
|
Ok(
|
||||||
|
ShareVerifyResult(
|
||||||
|
success = false,
|
||||||
|
"",
|
||||||
|
passwordRequired = false,
|
||||||
|
"Failed",
|
||||||
|
None
|
||||||
|
)
|
||||||
|
)
|
||||||
case VerifyResult.InvalidToken =>
|
case VerifyResult.InvalidToken =>
|
||||||
Ok(ShareVerifyResult(false, "", false, "Failed", None))
|
Ok(
|
||||||
|
ShareVerifyResult(
|
||||||
|
success = false,
|
||||||
|
"",
|
||||||
|
passwordRequired = false,
|
||||||
|
"Failed",
|
||||||
|
None
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
@ -125,18 +157,18 @@ object ShareRoutes {
|
|||||||
|
|
||||||
def mkIdResult(r: OShare.ChangeResult, msg: => String): IdResult =
|
def mkIdResult(r: OShare.ChangeResult, msg: => String): IdResult =
|
||||||
r match {
|
r match {
|
||||||
case OShare.ChangeResult.Success(id) => IdResult(true, msg, id)
|
case OShare.ChangeResult.Success(id) => IdResult(success = true, msg, id)
|
||||||
case OShare.ChangeResult.PublishUntilInPast =>
|
case OShare.ChangeResult.PublishUntilInPast =>
|
||||||
IdResult(false, "Until date must not be in the past", Ident.unsafe(""))
|
IdResult(success = false, "Until date must not be in the past", Ident.unsafe(""))
|
||||||
case OShare.ChangeResult.NotFound =>
|
case OShare.ChangeResult.NotFound =>
|
||||||
IdResult(
|
IdResult(
|
||||||
false,
|
success = false,
|
||||||
"Share not found or not owner. Only the owner can update a share.",
|
"Share not found or not owner. Only the owner can update a share.",
|
||||||
Ident.unsafe("")
|
Ident.unsafe("")
|
||||||
)
|
)
|
||||||
case OShare.ChangeResult.QueryWithFulltext =>
|
case OShare.ChangeResult.QueryWithFulltext =>
|
||||||
IdResult(
|
IdResult(
|
||||||
false,
|
success = false,
|
||||||
"Sorry, shares with fulltext queries are currently not supported.",
|
"Sorry, shares with fulltext queries are currently not supported.",
|
||||||
Ident.unsafe("")
|
Ident.unsafe("")
|
||||||
)
|
)
|
||||||
@ -144,17 +176,17 @@ object ShareRoutes {
|
|||||||
|
|
||||||
def mkBasicResult(r: OShare.ChangeResult, msg: => String): BasicResult =
|
def mkBasicResult(r: OShare.ChangeResult, msg: => String): BasicResult =
|
||||||
r match {
|
r match {
|
||||||
case OShare.ChangeResult.Success(_) => BasicResult(true, msg)
|
case OShare.ChangeResult.Success(_) => BasicResult(success = true, msg)
|
||||||
case OShare.ChangeResult.PublishUntilInPast =>
|
case OShare.ChangeResult.PublishUntilInPast =>
|
||||||
BasicResult(false, "Until date must not be in the past")
|
BasicResult(success = false, "Until date must not be in the past")
|
||||||
case OShare.ChangeResult.NotFound =>
|
case OShare.ChangeResult.NotFound =>
|
||||||
BasicResult(
|
BasicResult(
|
||||||
false,
|
success = false,
|
||||||
"Share not found or not owner. Only the owner can update a share."
|
"Share not found or not owner. Only the owner can update a share."
|
||||||
)
|
)
|
||||||
case OShare.ChangeResult.QueryWithFulltext =>
|
case OShare.ChangeResult.QueryWithFulltext =>
|
||||||
BasicResult(
|
BasicResult(
|
||||||
false,
|
success = false,
|
||||||
"Sorry, shares with fulltext queries are currently not supported."
|
"Sorry, shares with fulltext queries are currently not supported."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -184,10 +216,10 @@ object ShareRoutes {
|
|||||||
def convertOut(res: SendResult): BasicResult =
|
def convertOut(res: SendResult): BasicResult =
|
||||||
res match {
|
res match {
|
||||||
case SendResult.Success(_) =>
|
case SendResult.Success(_) =>
|
||||||
BasicResult(true, "Mail sent.")
|
BasicResult(success = true, "Mail sent.")
|
||||||
case SendResult.SendFailure(ex) =>
|
case SendResult.SendFailure(ex) =>
|
||||||
BasicResult(false, s"Mail sending failed: ${ex.getMessage}")
|
BasicResult(success = false, s"Mail sending failed: ${ex.getMessage}")
|
||||||
case SendResult.NotFound =>
|
case SendResult.NotFound =>
|
||||||
BasicResult(false, s"There was no mail-connection or item found.")
|
BasicResult(success = false, s"There was no mail-connection or item found.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,10 @@ object TotpRoutes {
|
|||||||
for {
|
for {
|
||||||
result <- backend.totp.state(user.account)
|
result <- backend.totp.state(user.account)
|
||||||
resp <- Ok(
|
resp <- Ok(
|
||||||
result.fold(en => OtpState(true, en.created.some), _ => OtpState(false, None))
|
result.fold(
|
||||||
|
en => OtpState(enabled = true, en.created.some),
|
||||||
|
_ => OtpState(enabled = false, None)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
} yield resp
|
} yield resp
|
||||||
case POST -> Root / "init" =>
|
case POST -> Root / "init" =>
|
||||||
@ -44,11 +47,13 @@ object TotpRoutes {
|
|||||||
result <- backend.totp.initialize(user.account)
|
result <- backend.totp.initialize(user.account)
|
||||||
resp <- result match {
|
resp <- result match {
|
||||||
case OTotp.InitResult.AlreadyExists =>
|
case OTotp.InitResult.AlreadyExists =>
|
||||||
UnprocessableEntity(BasicResult(false, "A totp setup already exists!"))
|
UnprocessableEntity(
|
||||||
|
BasicResult(success = false, "A totp setup already exists!")
|
||||||
|
)
|
||||||
case OTotp.InitResult.NotFound =>
|
case OTotp.InitResult.NotFound =>
|
||||||
NotFound(BasicResult(false, "User not found"))
|
NotFound(BasicResult(success = false, "User not found"))
|
||||||
case OTotp.InitResult.Failed(ex) =>
|
case OTotp.InitResult.Failed(ex) =>
|
||||||
InternalServerError(BasicResult(false, ex.getMessage))
|
InternalServerError(BasicResult(success = false, ex.getMessage))
|
||||||
case s @ OTotp.InitResult.Success(_, key) =>
|
case s @ OTotp.InitResult.Success(_, key) =>
|
||||||
val issuer = cfg.appName
|
val issuer = cfg.appName
|
||||||
val uri = s.authenticatorUrl(issuer)
|
val uri = s.authenticatorUrl(issuer)
|
||||||
@ -62,9 +67,9 @@ object TotpRoutes {
|
|||||||
result <- backend.totp.confirmInit(user.account, OnetimePassword(data.otp.pass))
|
result <- backend.totp.confirmInit(user.account, OnetimePassword(data.otp.pass))
|
||||||
resp <- result match {
|
resp <- result match {
|
||||||
case OTotp.ConfirmResult.Success =>
|
case OTotp.ConfirmResult.Success =>
|
||||||
Ok(BasicResult(true, "TOTP setup successful."))
|
Ok(BasicResult(success = true, "TOTP setup successful."))
|
||||||
case OTotp.ConfirmResult.Failed =>
|
case OTotp.ConfirmResult.Failed =>
|
||||||
Ok(BasicResult(false, "TOTP setup failed!"))
|
Ok(BasicResult(success = false, "TOTP setup failed!"))
|
||||||
}
|
}
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ object UserRoutes {
|
|||||||
)
|
)
|
||||||
|
|
||||||
case None =>
|
case None =>
|
||||||
NotFound(BasicResult(false, s"User '${username.id}' not found"))
|
NotFound(BasicResult(success = false, s"User '${username.id}' not found"))
|
||||||
}
|
}
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
@ -119,16 +119,16 @@ object UserRoutes {
|
|||||||
)
|
)
|
||||||
resp <- Ok(result match {
|
resp <- Ok(result match {
|
||||||
case OCollective.PassResetResult.Success(np) =>
|
case OCollective.PassResetResult.Success(np) =>
|
||||||
ResetPasswordResult(true, np, "Password updated")
|
ResetPasswordResult(success = true, np, "Password updated")
|
||||||
case OCollective.PassResetResult.NotFound =>
|
case OCollective.PassResetResult.NotFound =>
|
||||||
ResetPasswordResult(
|
ResetPasswordResult(
|
||||||
false,
|
success = false,
|
||||||
Password(""),
|
Password(""),
|
||||||
"Password update failed. User not found."
|
"Password update failed. User not found."
|
||||||
)
|
)
|
||||||
case OCollective.PassResetResult.InvalidSource(source) =>
|
case OCollective.PassResetResult.InvalidSource(source) =>
|
||||||
ResetPasswordResult(
|
ResetPasswordResult(
|
||||||
false,
|
success = false,
|
||||||
Password(""),
|
Password(""),
|
||||||
s"Password update failed. User has unexpected source: $source. Passwords are managed externally."
|
s"Password update failed. User has unexpected source: $source. Passwords are managed externally."
|
||||||
)
|
)
|
||||||
|
@ -169,7 +169,7 @@ final class PeriodicSchedulerImpl[F[_]: Async](
|
|||||||
|
|
||||||
object PeriodicSchedulerImpl {
|
object PeriodicSchedulerImpl {
|
||||||
def emptyState[F[_]]: State[F] =
|
def emptyState[F[_]]: State[F] =
|
||||||
State(false, None)
|
State(shutdownRequest = false, None)
|
||||||
|
|
||||||
case class State[F[_]](
|
case class State[F[_]](
|
||||||
shutdownRequest: Boolean,
|
shutdownRequest: Boolean,
|
||||||
|
@ -348,7 +348,7 @@ object SchedulerImpl {
|
|||||||
type CancelToken[F[_]] = F[Unit]
|
type CancelToken[F[_]] = F[Unit]
|
||||||
|
|
||||||
def emptyState[F[_]]: State[F] =
|
def emptyState[F[_]]: State[F] =
|
||||||
State(Map.empty, Set.empty, Map.empty, false)
|
State(Map.empty, Set.empty, Map.empty, shutdownRequest = false)
|
||||||
|
|
||||||
case class State[F[_]](
|
case class State[F[_]](
|
||||||
counters: Map[Ident, CountingScheme],
|
counters: Map[Ident, CountingScheme],
|
||||||
|
@ -43,8 +43,11 @@ object MigrateDueItemTasks extends TransactorSupport with JsonCodecs {
|
|||||||
)
|
)
|
||||||
_ <- tasks2.traverse(migratePeriodicDueItemsTask)
|
_ <- tasks2.traverse(migratePeriodicDueItemsTask)
|
||||||
_ <- tasks3.traverse(migratePeriodicQueryTask)
|
_ <- tasks3.traverse(migratePeriodicQueryTask)
|
||||||
_ <- RPeriodicTask.setEnabledByTask(PeriodicQueryArgsOld.taskName, false)
|
_ <- RPeriodicTask.setEnabledByTask(PeriodicQueryArgsOld.taskName, enabled = false)
|
||||||
_ <- RPeriodicTask.setEnabledByTask(PeriodicDueItemsArgsOld.taskName, false)
|
_ <- RPeriodicTask.setEnabledByTask(
|
||||||
|
PeriodicDueItemsArgsOld.taskName,
|
||||||
|
enabled = false
|
||||||
|
)
|
||||||
} yield ()
|
} yield ()
|
||||||
|
|
||||||
private def migratePeriodicQueryTask(old: RPeriodicTask): ConnectionIO[Int] =
|
private def migratePeriodicQueryTask(old: RPeriodicTask): ConnectionIO[Int] =
|
||||||
|
@ -38,7 +38,7 @@ object MigrateNotifyTasks extends TransactorSupport {
|
|||||||
logger.info(s"Starting to migrate ${tasks.size} user tasks")
|
logger.info(s"Starting to migrate ${tasks.size} user tasks")
|
||||||
)
|
)
|
||||||
_ <- tasks.traverse(migrateDueItemTask1)
|
_ <- tasks.traverse(migrateDueItemTask1)
|
||||||
_ <- RPeriodicTask.setEnabledByTask(NotifyDueItemsArgs.taskName, false)
|
_ <- RPeriodicTask.setEnabledByTask(NotifyDueItemsArgs.taskName, enabled = false)
|
||||||
} yield ()
|
} yield ()
|
||||||
|
|
||||||
private def migrateDueItemTask1(old: RPeriodicTask): ConnectionIO[Int] = {
|
private def migrateDueItemTask1(old: RPeriodicTask): ConnectionIO[Int] = {
|
||||||
|
@ -13,5 +13,9 @@ case class SchemaMigrateConfig(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object SchemaMigrateConfig {
|
object SchemaMigrateConfig {
|
||||||
val defaults = SchemaMigrateConfig(true, true, false)
|
val defaults = SchemaMigrateConfig(
|
||||||
|
runMainMigrations = true,
|
||||||
|
runFixupMigrations = true,
|
||||||
|
repairSchema = false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ object FileUrlReader {
|
|||||||
authority = Some(""),
|
authority = Some(""),
|
||||||
path = LenientUri.NonEmptyPath(
|
path = LenientUri.NonEmptyPath(
|
||||||
Nel.of(key.collective.valueAsString, key.category.id.id, key.id.id),
|
Nel.of(key.collective.valueAsString, key.category.id.id, key.id.id),
|
||||||
false
|
trailingSlash = false
|
||||||
),
|
),
|
||||||
query = None,
|
query = None,
|
||||||
fragment = None
|
fragment = None
|
||||||
|
@ -15,7 +15,7 @@ object DBFunction {
|
|||||||
val countAll: DBFunction = CountAll
|
val countAll: DBFunction = CountAll
|
||||||
|
|
||||||
def countAs[A](column: Column[A]): DBFunction =
|
def countAs[A](column: Column[A]): DBFunction =
|
||||||
Count(column, false)
|
Count(column, distinct = false)
|
||||||
|
|
||||||
case object CountAll extends DBFunction
|
case object CountAll extends DBFunction
|
||||||
|
|
||||||
|
@ -78,10 +78,10 @@ trait DSL extends DoobieMeta {
|
|||||||
FromExpr.From(sel, alias)
|
FromExpr.From(sel, alias)
|
||||||
|
|
||||||
def count(c: Column[_]): DBFunction =
|
def count(c: Column[_]): DBFunction =
|
||||||
DBFunction.Count(c, false)
|
DBFunction.Count(c, distinct = false)
|
||||||
|
|
||||||
def countDistinct(c: Column[_]): DBFunction =
|
def countDistinct(c: Column[_]): DBFunction =
|
||||||
DBFunction.Count(c, true)
|
DBFunction.Count(c, distinct = true)
|
||||||
|
|
||||||
def countAll: DBFunction =
|
def countAll: DBFunction =
|
||||||
DBFunction.CountAll
|
DBFunction.CountAll
|
||||||
@ -250,22 +250,22 @@ trait DSL extends DoobieMeta {
|
|||||||
in(subsel).negate
|
in(subsel).negate
|
||||||
|
|
||||||
def in(values: Nel[A])(implicit P: Put[A]): Condition =
|
def in(values: Nel[A])(implicit P: Put[A]): Condition =
|
||||||
Condition.InValues(col.s, values, false)
|
Condition.InValues(col.s, values, lower = false)
|
||||||
|
|
||||||
def notIn(values: Nel[A])(implicit P: Put[A]): Condition =
|
def notIn(values: Nel[A])(implicit P: Put[A]): Condition =
|
||||||
in(values).negate
|
in(values).negate
|
||||||
|
|
||||||
def inLower(values: Nel[String]): Condition =
|
def inLower(values: Nel[String]): Condition =
|
||||||
Condition.InValues(col.s, values.map(_.toLowerCase), true)
|
Condition.InValues(col.s, values.map(_.toLowerCase), lower = true)
|
||||||
|
|
||||||
def inLowerA(values: Nel[A])(implicit P: Put[A]): Condition =
|
def inLowerA(values: Nel[A])(implicit P: Put[A]): Condition =
|
||||||
Condition.InValues(col.s, values, true)
|
Condition.InValues(col.s, values, lower = true)
|
||||||
|
|
||||||
def notInLower(values: Nel[String]): Condition =
|
def notInLower(values: Nel[String]): Condition =
|
||||||
Condition.InValues(col.s, values.map(_.toLowerCase), true).negate
|
Condition.InValues(col.s, values.map(_.toLowerCase), lower = true).negate
|
||||||
|
|
||||||
def notInLowerA(values: Nel[A])(implicit P: Put[A]): Condition =
|
def notInLowerA(values: Nel[A])(implicit P: Put[A]): Condition =
|
||||||
Condition.InValues(col.s, values, true).negate
|
Condition.InValues(col.s, values, lower = true).negate
|
||||||
|
|
||||||
def isNull: Condition =
|
def isNull: Condition =
|
||||||
Condition.IsNull(col.s)
|
Condition.IsNull(col.s)
|
||||||
@ -382,7 +382,7 @@ trait DSL extends DoobieMeta {
|
|||||||
Condition.CompareFVal(sel, Operator.Neq, value)
|
Condition.CompareFVal(sel, Operator.Neq, value)
|
||||||
|
|
||||||
def in[A](values: Nel[A])(implicit P: Put[A]): Condition =
|
def in[A](values: Nel[A])(implicit P: Put[A]): Condition =
|
||||||
Condition.InValues(sel, values, false)
|
Condition.InValues(sel, values, lower = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,32 +76,38 @@ sealed trait Select {
|
|||||||
|
|
||||||
object Select {
|
object Select {
|
||||||
def apply(projection: SelectExpr) =
|
def apply(projection: SelectExpr) =
|
||||||
SimpleSelect(false, Nel.of(projection), None, Condition.unit, None)
|
SimpleSelect(distinctFlag = false, Nel.of(projection), None, Condition.unit, None)
|
||||||
|
|
||||||
def apply(projection: Nel[SelectExpr], from: FromExpr) =
|
def apply(projection: Nel[SelectExpr], from: FromExpr) =
|
||||||
SimpleSelect(false, projection, from.some, Condition.unit, None)
|
SimpleSelect(distinctFlag = false, projection, from.some, Condition.unit, None)
|
||||||
|
|
||||||
def apply(projection: SelectExpr, from: FromExpr) =
|
def apply(projection: SelectExpr, from: FromExpr) =
|
||||||
SimpleSelect(false, Nel.of(projection), from.some, Condition.unit, None)
|
SimpleSelect(
|
||||||
|
distinctFlag = false,
|
||||||
|
Nel.of(projection),
|
||||||
|
from.some,
|
||||||
|
Condition.unit,
|
||||||
|
None
|
||||||
|
)
|
||||||
|
|
||||||
def apply(
|
def apply(
|
||||||
projection: Nel[SelectExpr],
|
projection: Nel[SelectExpr],
|
||||||
from: FromExpr,
|
from: FromExpr,
|
||||||
where: Condition
|
where: Condition
|
||||||
) = SimpleSelect(false, projection, from.some, where, None)
|
) = SimpleSelect(distinctFlag = false, projection, from.some, where, None)
|
||||||
|
|
||||||
def apply(
|
def apply(
|
||||||
projection: SelectExpr,
|
projection: SelectExpr,
|
||||||
from: FromExpr,
|
from: FromExpr,
|
||||||
where: Condition
|
where: Condition
|
||||||
) = SimpleSelect(false, Nel.of(projection), from.some, where, None)
|
) = SimpleSelect(distinctFlag = false, Nel.of(projection), from.some, where, None)
|
||||||
|
|
||||||
def apply(
|
def apply(
|
||||||
projection: Nel[SelectExpr],
|
projection: Nel[SelectExpr],
|
||||||
from: FromExpr,
|
from: FromExpr,
|
||||||
where: Condition,
|
where: Condition,
|
||||||
groupBy: GroupBy
|
groupBy: GroupBy
|
||||||
) = SimpleSelect(false, projection, from.some, where, Some(groupBy))
|
) = SimpleSelect(distinctFlag = false, projection, from.some, where, Some(groupBy))
|
||||||
|
|
||||||
case class SimpleSelect(
|
case class SimpleSelect(
|
||||||
distinctFlag: Boolean,
|
distinctFlag: Boolean,
|
||||||
|
@ -46,7 +46,7 @@ object RCollective {
|
|||||||
collName,
|
collName,
|
||||||
CollectiveState.Active,
|
CollectiveState.Active,
|
||||||
Language.German,
|
Language.German,
|
||||||
true,
|
integrationEnabled = true,
|
||||||
created
|
created
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -180,8 +180,8 @@ object RTag {
|
|||||||
.sortBy(_._1)
|
.sortBy(_._1)
|
||||||
|
|
||||||
byCat match {
|
byCat match {
|
||||||
case (None, tags) :: rest =>
|
case (None, tagsByCat) :: rest =>
|
||||||
rest.flatMap(_._2) ++ tags
|
rest.flatMap(_._2) ++ tagsByCat
|
||||||
case _ =>
|
case _ =>
|
||||||
byCat.flatMap(_._2)
|
byCat.flatMap(_._2)
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ object RTotp {
|
|||||||
for {
|
for {
|
||||||
now <- Timestamp.current[F]
|
now <- Timestamp.current[F]
|
||||||
key <- Key.generate[F](mac)
|
key <- Key.generate[F](mac)
|
||||||
} yield RTotp(userId, false, key, now)
|
} yield RTotp(userId, enabled = false, key, now)
|
||||||
|
|
||||||
def insert(r: RTotp): ConnectionIO[Int] =
|
def insert(r: RTotp): ConnectionIO[Int] =
|
||||||
DML.insert(T, T.all, sql"${r.userId},${r.enabled},${r.secret},${r.created}")
|
DML.insert(T, T.all, sql"${r.userId},${r.enabled},${r.secret},${r.created}")
|
||||||
|
@ -199,10 +199,10 @@ object RUserEmail {
|
|||||||
userId: Ident,
|
userId: Ident,
|
||||||
nameQ: Option[String]
|
nameQ: Option[String]
|
||||||
): ConnectionIO[Vector[RUserEmail]] =
|
): ConnectionIO[Vector[RUserEmail]] =
|
||||||
findByAccount0(userId, nameQ, false).to[Vector]
|
findByAccount0(userId, nameQ, exact = false).to[Vector]
|
||||||
|
|
||||||
def getByName(userId: Ident, name: Ident): ConnectionIO[Option[RUserEmail]] =
|
def getByName(userId: Ident, name: Ident): ConnectionIO[Option[RUserEmail]] =
|
||||||
findByAccount0(userId, Some(name.id), true).option
|
findByAccount0(userId, Some(name.id), exact = true).option
|
||||||
|
|
||||||
def getById(id: Ident): ConnectionIO[Option[RUserEmail]] = {
|
def getById(id: Ident): ConnectionIO[Option[RUserEmail]] = {
|
||||||
val t = Table(None)
|
val t = Table(None)
|
||||||
|
@ -195,13 +195,13 @@ object RUserImap {
|
|||||||
userId: Ident,
|
userId: Ident,
|
||||||
nameQ: Option[String]
|
nameQ: Option[String]
|
||||||
): ConnectionIO[Vector[RUserImap]] =
|
): ConnectionIO[Vector[RUserImap]] =
|
||||||
findByAccount0(userId, nameQ, false).to[Vector]
|
findByAccount0(userId, nameQ, exact = false).to[Vector]
|
||||||
|
|
||||||
def getByName(
|
def getByName(
|
||||||
userId: Ident,
|
userId: Ident,
|
||||||
name: Ident
|
name: Ident
|
||||||
): ConnectionIO[Option[RUserImap]] =
|
): ConnectionIO[Option[RUserImap]] =
|
||||||
findByAccount0(userId, Some(name.id), true).option
|
findByAccount0(userId, Some(name.id), exact = true).option
|
||||||
|
|
||||||
def delete(
|
def delete(
|
||||||
userId: Ident,
|
userId: Ident,
|
||||||
|
@ -106,7 +106,7 @@ object StoreFixture {
|
|||||||
for {
|
for {
|
||||||
xa <- makeXA(ds)
|
xa <- makeXA(ds)
|
||||||
cfg = FileRepositoryConfig.Database(64 * 1024)
|
cfg = FileRepositoryConfig.Database(64 * 1024)
|
||||||
fr = FileRepository[IO](xa, ds, cfg, true)
|
fr = FileRepository[IO](xa, ds, cfg, withAttributeStore = true)
|
||||||
store = new StoreImpl[IO](fr, jdbc, schemaMigrateConfig, ds, xa)
|
store = new StoreImpl[IO](fr, jdbc, schemaMigrateConfig, ds, xa)
|
||||||
_ <- Resource.eval(store.migrate)
|
_ <- Resource.eval(store.migrate)
|
||||||
} yield store
|
} yield store
|
||||||
|
@ -193,7 +193,7 @@ class TempFtsOpsTest extends DatabaseTest {
|
|||||||
DocspellSystem.account.collective,
|
DocspellSystem.account.collective,
|
||||||
CollectiveState.Active,
|
CollectiveState.Active,
|
||||||
Language.English,
|
Language.English,
|
||||||
true,
|
integrationEnabled = true,
|
||||||
ts
|
ts
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class QueryBuilderTest extends FunSuite with TestLoggingConfig {
|
|||||||
val q = Select(proj, tables, cond).orderBy(c.name.desc)
|
val q = Select(proj, tables, cond).orderBy(c.name.desc)
|
||||||
q match {
|
q match {
|
||||||
case Select.Ordered(
|
case Select.Ordered(
|
||||||
Select.SimpleSelect(false, proj, from, where, group),
|
Select.SimpleSelect(false, projs, from, where, group),
|
||||||
sb,
|
sb,
|
||||||
vempty
|
vempty
|
||||||
) =>
|
) =>
|
||||||
@ -48,7 +48,7 @@ class QueryBuilderTest extends FunSuite with TestLoggingConfig {
|
|||||||
sb,
|
sb,
|
||||||
OrderBy(SelectExpr.SelectColumn(c.name, None), OrderBy.OrderType.Desc)
|
OrderBy(SelectExpr.SelectColumn(c.name, None), OrderBy.OrderType.Desc)
|
||||||
)
|
)
|
||||||
assertEquals(11, proj.size)
|
assertEquals(11, projs.size)
|
||||||
from match {
|
from match {
|
||||||
case None =>
|
case None =>
|
||||||
fail("Unexpected from value")
|
fail("Unexpected from value")
|
||||||
|
Reference in New Issue
Block a user