Merging items
According to the mockup https://xd.adobe.com/view/974278f9-6aa3-4c0a-417a-3e875d84ff0b-e173/screen/452827a8-f9f0-487f-b9ce-6258165b55f4/ we need two endpoints:
GET /api/{category}/{id}/merge?with={id1},{id2},{id3}
that should return the approved version of {id} combined with approved versions of items with identifiers specified in the query param with
.
- Single fields
id
,category
,persistentId
,status
,informationContributor
,source
,sourceItemId
,thumbnail
anddateCreated
anddateLastUpdated
(if occurs for the category) should be obtained from the approved version of {id}. - Combining single fields like
label
,version
, anddescription
should be concatenated with these fields from the approved version of {id} and {id1}, {id2}, {id3} ... and if any value is repeated it should be omitted. The character/
should be uses as a separator. - The remaining fields:
contributors
,properties
,externalIds
,accessibleAt
,relatedItems
andmedia
should be obtained from these fields from the approved version of {id} and {id1}, {id2}, {id3} but repetitions should be omitted.
This way a moderator/administrator who wants to merge items could can see all the data from the items to be merged on one form. Then he/she can work on these data on the form.
In order to create a new merged item he/she needs to submit a request to the endpoint POST /api/{category}/merge?with={id},{id1},{id2},{id3}
. The body of this endpoint should be the same as for POST /api/{category}/
.
As agreed in sshoc-marketplace#53 (comment 205763) the new item will have the REVIEWED status and its first version APPROVED status. Moreover all merged items will have MERGED status and their last versions DEPRECATED status.
We have to extend the VersionedItem
model with the list of List<VersionedItem> mergedWith
for the list of items from which the given item was created by the merge operation.