Include links to items into mail template

This commit is contained in:
Eike Kettner
2020-04-22 21:53:25 +02:00
parent 52800a51d8
commit e1f9ae2629
9 changed files with 46 additions and 46 deletions

View File

@ -1,11 +1,8 @@
package docspell.restserver
import docspell.backend.auth.Login
import docspell.backend.signup.{Config => SignupConfig}
import docspell.store.JdbcConfig
import docspell.backend.{Config => BackendConfig}
import docspell.common._
import scodec.bits.ByteVector
case class Config(
appName: String,
@ -17,33 +14,6 @@ case class Config(
)
object Config {
val postgres =
JdbcConfig(
LenientUri.unsafe("jdbc:postgresql://localhost:5432/docspelldev"),
"dev",
"dev"
)
val h2 = JdbcConfig(
LenientUri.unsafe(
"jdbc:h2:./target/docspelldev.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE"
),
"sa",
""
)
val default: Config =
Config(
"Docspell",
Ident.unsafe("restserver1"),
LenientUri.unsafe("http://localhost:7880"),
Config.Bind("localhost", 7880),
BackendConfig(
postgres,
SignupConfig(SignupConfig.invite, Password("testpass"), Duration.hours(5 * 24)),
BackendConfig.Files(512 * 1024, List(MimeType.pdf))
),
Login.Config(ByteVector.fromValidHex("caffee"), Duration.minutes(2))
)
case class Bind(address: String, port: Int)
}

View File

@ -76,7 +76,7 @@ object RestServer {
"email/send" -> MailSendRoutes(restApp.backend, token),
"email/settings" -> MailSettingsRoutes(restApp.backend, token),
"email/sent" -> SentMailRoutes(restApp.backend, token),
"usertask/notifydueitems" -> NotifyDueItemsRoutes(restApp.backend, token),
"usertask/notifydueitems" -> NotifyDueItemsRoutes(cfg, restApp.backend, token),
"calevent/check" -> CalEventCheckRoutes()
)

View File

@ -13,10 +13,15 @@ import docspell.common._
import docspell.restapi.model._
import docspell.store.usertask._
import docspell.restserver.conv.Conversions
import docspell.restserver.Config
object NotifyDueItemsRoutes {
def apply[F[_]: Effect](backend: BackendApp[F], user: AuthToken): HttpRoutes[F] = {
def apply[F[_]: Effect](
cfg: Config,
backend: BackendApp[F],
user: AuthToken
): HttpRoutes[F] = {
val dsl = new Http4sDsl[F] {}
val ut = backend.userTask
import dsl._
@ -25,7 +30,7 @@ object NotifyDueItemsRoutes {
case req @ POST -> Root / "startonce" =>
for {
data <- req.as[NotificationSettings]
task = makeTask(user.account, data)
task = makeTask(cfg, user.account, data)
res <- ut
.executeNow(user.account, task)
.attempt
@ -43,7 +48,7 @@ object NotifyDueItemsRoutes {
case req @ POST -> Root =>
for {
data <- req.as[NotificationSettings]
task = makeTask(user.account, data)
task = makeTask(cfg, user.account, data)
res <- ut
.submitNotifyDueItems(user.account, task)
.attempt
@ -54,6 +59,7 @@ object NotifyDueItemsRoutes {
}
def makeTask(
cfg: Config,
user: AccountId,
settings: NotificationSettings
): UserTask[NotifyDueItemsArgs] =
@ -66,6 +72,7 @@ object NotifyDueItemsRoutes {
user,
settings.smtpConnection,
settings.recipients,
Some(cfg.baseUrl / "app" / "item"),
settings.remindDays,
settings.tagsInclude.map(_.id),
settings.tagsExclude.map(_.id)