mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Allow to change position of attachments
This commit is contained in:
@ -75,6 +75,8 @@ trait OItem[F[_]] {
|
||||
def findByFileSource(checksum: String, sourceId: Ident): F[Vector[RItem]]
|
||||
|
||||
def deleteAttachment(id: Ident, collective: Ident): F[Int]
|
||||
|
||||
def moveAttachmentBefore(itemId: Ident, source: Ident, target: Ident): F[AddResult]
|
||||
}
|
||||
|
||||
object OItem {
|
||||
@ -121,6 +123,16 @@ object OItem {
|
||||
def apply[F[_]: Effect](store: Store[F]): Resource[F, OItem[F]] =
|
||||
Resource.pure[F, OItem[F]](new OItem[F] {
|
||||
|
||||
def moveAttachmentBefore(
|
||||
itemId: Ident,
|
||||
source: Ident,
|
||||
target: Ident
|
||||
): F[AddResult] =
|
||||
store
|
||||
.transact(QItem.moveAttachmentBefore(itemId, source, target))
|
||||
.attempt
|
||||
.map(AddResult.fromUpdate)
|
||||
|
||||
def findItem(id: Ident, collective: Ident): F[Option[ItemData]] =
|
||||
store
|
||||
.transact(QItem.findItem(id))
|
||||
|
Reference in New Issue
Block a user