diff --git a/modules/restapi/src/main/resources/docspell-openapi.yml b/modules/restapi/src/main/resources/docspell-openapi.yml index ed0df51b..7319e878 100644 --- a/modules/restapi/src/main/resources/docspell-openapi.yml +++ b/modules/restapi/src/main/resources/docspell-openapi.yml @@ -5090,6 +5090,10 @@ components: type: array items: $ref: "#/components/schemas/Tag" + customfields: + type: array + items: + $ref: "#/components/schemas/ItemFieldValue" notes: description: | Some prefix of the item notes. diff --git a/modules/restserver/src/main/scala/docspell/restserver/conv/Conversions.scala b/modules/restserver/src/main/scala/docspell/restserver/conv/Conversions.scala index e5d49fc2..35a88eaa 100644 --- a/modules/restserver/src/main/scala/docspell/restserver/conv/Conversions.scala +++ b/modules/restserver/src/main/scala/docspell/restserver/conv/Conversions.scala @@ -213,10 +213,11 @@ trait Conversions { i.concEquip.map(mkIdName), i.folder.map(mkIdName), i.fileCount, - Nil, - Nil, + Nil, //attachments + Nil, //tags + Nil, //customfields i.notes, - Nil + Nil // highlight ) def mkItemLight(i: OFulltext.FtsItem): ItemLight = { @@ -227,7 +228,11 @@ trait Conversions { def mkItemLightWithTags(i: OItemSearch.ListItemWithTags): ItemLight = mkItemLight(i.item) - .copy(tags = i.tags.map(mkTag), attachments = i.attachments.map(mkAttachmentLight)) + .copy( + tags = i.tags.map(mkTag), + attachments = i.attachments.map(mkAttachmentLight), + customfields = i.customfields.map(mkItemFieldValue) + ) private def mkAttachmentLight(qa: QItem.AttachmentLight): AttachmentLight = AttachmentLight(qa.id, qa.position, qa.name, qa.pageCount) diff --git a/modules/store/src/main/scala/docspell/store/queries/QItem.scala b/modules/store/src/main/scala/docspell/store/queries/QItem.scala index f587ae9f..a742547a 100644 --- a/modules/store/src/main/scala/docspell/store/queries/QItem.scala +++ b/modules/store/src/main/scala/docspell/store/queries/QItem.scala @@ -524,7 +524,8 @@ object QItem { case class ListItemWithTags( item: ListItem, tags: List[RTag], - attachments: List[AttachmentLight] + attachments: List[AttachmentLight], + customfields: List[ItemFieldValue] ) /** Same as `findItems` but resolves the tags for each item. Note that @@ -560,10 +561,12 @@ object QItem { tags <- Stream.eval(tagItems.traverse(ti => findTag(resolvedTags, ti))) attachs <- Stream.eval(findAttachmentLight(item.id)) ftags = tags.flatten.filter(t => t.collective == collective) + cfields <- Stream.eval(findCustomFieldValuesForItem(item.id)) } yield ListItemWithTags( item, ftags.toList.sortBy(_.name), - attachs.sortBy(_.position) + attachs.sortBy(_.position), + cfields.toList ) }