Set stricter compile options and fix cookie data

This commit is contained in:
Eike Kettner
2019-09-28 22:17:45 +02:00
parent 46f1476418
commit 2ad1586d00
29 changed files with 94 additions and 93 deletions

View File

@ -27,8 +27,8 @@ object JoexServer {
joexApp <- JoexAppImpl.create[F](cfg, signal, connectEC, blocker)
httpApp = Router(
"/api/info" -> InfoRoutes(cfg),
"/api/v1" -> JoexRoutes(cfg, joexApp)
"/api/info" -> InfoRoutes(),
"/api/v1" -> JoexRoutes(joexApp)
).orNotFound
// With Middlewares in place

View File

@ -25,9 +25,9 @@ object CreateItem {
def fileMetas(itemId: Ident, now: Timestamp) = Stream.emits(ctx.args.files).
flatMap(f => ctx.store.bitpeace.get(f.fileMetaId.id).map(fm => (f, fm))).
collect({ case (f, Some(fm)) if validFiles.contains(fm.mimetype.baseType) => (f, fm) }).
collect({ case (f, Some(fm)) if validFiles.contains(fm.mimetype.baseType) => f }).
zipWithIndex.
evalMap({ case ((f, fm), index) =>
evalMap({ case (f, index) =>
Ident.randomId[F].map(id => RAttachment(id, itemId, f.fileMetaId, index.toInt, now, f.name))
}).
compile.toVector
@ -64,7 +64,11 @@ object CreateItem {
}
private def logDifferences[F[_]: Sync](ctx: Context[F, ProcessItemArgs], saved: Vector[RAttachment], saveCount: Int): F[Unit] =
ctx.logger.info("TODO log diffs")
if (ctx.args.files.size != saved.size) {
ctx.logger.warn(s"Not all given files (${ctx.args.files.size}) have been stored. Files retained: ${saved.size}; saveCount=$saveCount")
} else {
().pure[F]
}
private def storeItemError[F[_]: Sync](ctx: Context[F, ProcessItemArgs]): F[Unit] = {
val msg = "Inserting item failed. DB returned 0 update count!"

View File

@ -1,15 +1,15 @@
package docspell.joex.routes
import cats.effect.Sync
import docspell.joex.{BuildInfo, Config}
import docspell.joex.BuildInfo
import docspell.joexapi.model.VersionInfo
import org.http4s.HttpRoutes
import org.http4s.dsl.Http4sDsl
import org.http4s.circe.CirceEntityEncoder._
import org.http4s.dsl.Http4sDsl
object InfoRoutes {
def apply[F[_]: Sync](cfg: Config): HttpRoutes[F] = {
def apply[F[_]: Sync](): HttpRoutes[F] = {
val dsl = new Http4sDsl[F]{}
import dsl._
HttpRoutes.of[F] {

View File

@ -1,18 +1,18 @@
package docspell.joex.routes
import cats.implicits._
import cats.effect._
import cats.implicits._
import docspell.common.{Duration, Ident, Timestamp}
import docspell.joex.{Config, JoexApp}
import docspell.joex.JoexApp
import docspell.joexapi.model._
import docspell.store.records.{RJob, RJobLog}
import org.http4s.HttpRoutes
import org.http4s.dsl.Http4sDsl
import org.http4s.circe.CirceEntityEncoder._
import org.http4s.dsl.Http4sDsl
object JoexRoutes {
def apply[F[_]: ConcurrentEffect: Timer](cfg: Config, app: JoexApp[F]): HttpRoutes[F] = {
def apply[F[_]: ConcurrentEffect: Timer](app: JoexApp[F]): HttpRoutes[F] = {
val dsl = new Http4sDsl[F]{}
import dsl._
HttpRoutes.of[F] {

View File

@ -43,7 +43,7 @@ object Logger {
for {
q <- Queue.circularBuffer[F, LogEvent](bufferSize)
log = create(jobId, jobInfo, q)
fib <- Concurrent[F].start(q.dequeue.through(sink.receive).compile.drain)
_ <- Concurrent[F].start(q.dequeue.through(sink.receive).compile.drain)
} yield log
}