Allow to search by source name

This commit is contained in:
Eike Kettner 2020-11-30 14:07:45 +01:00
parent 3ea2d20823
commit 0ee8ff66d5
3 changed files with 10 additions and 3 deletions

View File

@ -5065,6 +5065,8 @@ components:
type: array
items:
$ref: "#/components/schemas/CustomFieldValue"
source:
type: string
ItemLight:
description: |
An item with only a few important properties.

View File

@ -144,6 +144,7 @@ trait Conversions {
.map(_.ids.flatMap(i => Ident.fromString(i).toOption).toSet)
.filter(_.nonEmpty),
m.customValues.map(mkCustomValue),
m.source,
None
)

View File

@ -216,6 +216,7 @@ object QItem {
allNames: Option[String],
itemIds: Option[Set[Ident]],
customValues: Seq[CustomValue],
source: Option[String],
orderAsc: Option[RItem.Columns.type => Column]
)
@ -242,6 +243,7 @@ object QItem {
None,
None,
Seq.empty,
None,
None
)
}
@ -413,9 +415,10 @@ object QItem {
val tagSelectsExcl =
TagItemName.itemsWithTagOrCategory(q.tagsExclude, q.tagCategoryExcl)
val iFolder = IC.folder.prefix("i")
val name = q.name.map(_.toLowerCase).map(QueryWildcard.apply)
val allNames = q.allNames.map(_.toLowerCase).map(QueryWildcard.apply)
val iFolder = IC.folder.prefix("i")
val name = q.name.map(_.toLowerCase).map(QueryWildcard.apply)
val allNames = q.allNames.map(_.toLowerCase).map(QueryWildcard.apply)
val sourceName = q.source.map(_.toLowerCase).map(QueryWildcard.apply)
val cond = and(
IC.cid.prefix("i").is(q.account.collective),
IC.state.prefix("i").isOneOf(q.states),
@ -458,6 +461,7 @@ object QItem {
.getOrElse(Fragment.empty),
q.dueDateFrom.map(d => IC.dueDate.prefix("i").isGt(d)).getOrElse(Fragment.empty),
q.dueDateTo.map(d => IC.dueDate.prefix("i").isLt(d)).getOrElse(Fragment.empty),
sourceName.map(s => IC.source.prefix("i").lowerLike(s)).getOrElse(Fragment.empty),
q.itemIds
.map(ids =>
NonEmptyList