mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Enhance search mode to search in all items
This commit is contained in:
@ -52,6 +52,9 @@ object ItemState {
|
||||
val invalidStates: NonEmptyList[ItemState] =
|
||||
NonEmptyList.of(Premature, Processing)
|
||||
|
||||
val validStatesAndDeleted: NonEmptyList[ItemState] =
|
||||
validStates.append(deleted)
|
||||
|
||||
def unsafe(str: String): ItemState =
|
||||
fromString(str).fold(sys.error, identity)
|
||||
|
||||
|
@ -22,11 +22,13 @@ object SearchMode {
|
||||
|
||||
final case object Normal extends SearchMode
|
||||
final case object Trashed extends SearchMode
|
||||
final case object All extends SearchMode
|
||||
|
||||
def fromString(str: String): Either[String, SearchMode] =
|
||||
str.toLowerCase match {
|
||||
case "normal" => Right(Normal)
|
||||
case "trashed" => Right(Trashed)
|
||||
case "all" => Right(All)
|
||||
case _ => Left(s"Invalid search mode: $str")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user