mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Add a route to update the name of an attachment
This commit is contained in:
@ -9,6 +9,7 @@ import org.http4s.dsl.Http4sDsl
|
||||
import org.http4s.headers._
|
||||
import org.http4s.headers.ETag.EntityTag
|
||||
import org.http4s.circe.CirceEntityEncoder._
|
||||
import org.http4s.circe.CirceEntityDecoder._
|
||||
import docspell.backend.BackendApp
|
||||
import docspell.backend.auth.AuthToken
|
||||
import docspell.backend.ops.OItem
|
||||
@ -126,6 +127,13 @@ object AttachmentRoutes {
|
||||
resp <- md.map(Ok(_)).getOrElse(NotFound(BasicResult(false, "Not found.")))
|
||||
} yield resp
|
||||
|
||||
case req @ POST -> Root / Ident(id) / "name" =>
|
||||
for {
|
||||
nn <- req.as[OptionalText]
|
||||
res <- backend.item.setAttachmentName(id, nn.text, user.account.collective)
|
||||
resp <- Ok(Conversions.basicResult(res, "Name updated."))
|
||||
} yield resp
|
||||
|
||||
case DELETE -> Root / Ident(id) =>
|
||||
for {
|
||||
n <- backend.item.deleteAttachment(id, user.account.collective)
|
||||
|
Reference in New Issue
Block a user