Allow to search in deleted items

This commit is contained in:
eikek
2021-08-14 15:35:17 +02:00
parent edb344314f
commit 3f1ff5c1ac
5 changed files with 98 additions and 8 deletions

View File

@ -21,6 +21,7 @@ module Data.ItemQuery exposing
import Api.Model.CustomFieldValue exposing (CustomFieldValue)
import Api.Model.ItemQuery as RQ
import Data.Direction exposing (Direction)
import Data.SearchMode exposing (SearchMode)
type TagMatch
@ -73,13 +74,13 @@ and list =
Just (And es)
request : Maybe ItemQuery -> RQ.ItemQuery
request mq =
request : SearchMode -> Maybe ItemQuery -> RQ.ItemQuery
request smode mq =
{ offset = Nothing
, limit = Nothing
, withDetails = Just True
, query = renderMaybe mq
, searchMode = Nothing
, searchMode = Data.SearchMode.asString smode |> Just
}

View File

@ -0,0 +1,40 @@
{-
Copyright 2020 Docspell Contributors
SPDX-License-Identifier: GPL-3.0-or-later
-}
module Data.SearchMode exposing
( SearchMode(..)
, asString
, fromString
)
type SearchMode
= Normal
| Trashed
fromString : String -> Maybe SearchMode
fromString str =
case String.toLower str of
"normal" ->
Just Normal
"trashed" ->
Just Trashed
_ ->
Nothing
asString : SearchMode -> String
asString smode =
case smode of
Normal ->
"normal"
Trashed ->
"trashed"