mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Add routes to restore deleted items
This commit is contained in:
@ -152,7 +152,21 @@ object RItem {
|
||||
t <- currentTime
|
||||
n <- DML.update(
|
||||
T,
|
||||
T.id.in(itemIds) && T.cid === coll,
|
||||
T.id.in(itemIds) && T.cid === coll && T.state.in(ItemState.validStates),
|
||||
DML.set(T.state.setTo(itemState), T.updated.setTo(t))
|
||||
)
|
||||
} yield n
|
||||
|
||||
def restoreStateForCollective(
|
||||
itemIds: NonEmptyList[Ident],
|
||||
itemState: ItemState,
|
||||
coll: Ident
|
||||
): ConnectionIO[Int] =
|
||||
for {
|
||||
t <- currentTime
|
||||
n <- DML.update(
|
||||
T,
|
||||
T.id.in(itemIds) && T.cid === coll && T.state === ItemState.deleted,
|
||||
DML.set(T.state.setTo(itemState), T.updated.setTo(t))
|
||||
)
|
||||
} yield n
|
||||
|
Reference in New Issue
Block a user