Skip to content

Commit

Permalink
#255 #259 fix content type + check extra condition in merge
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg committed Dec 15, 2020
1 parent a510366 commit 9706292
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ protected BaseMergeService(
@Transactional
public void merge(UUID entityToReplaceKey, UUID replacementKey, String user) {
checkArgument(user != null, "User is required");
checkArgument(
!entityToReplaceKey.equals(replacementKey),
"The replacement has to be different than the entity to replace");

T entityToReplace = baseMapper.get(entityToReplaceKey);
checkArgument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void deleteOccurrenceMapping(
entityKey, objectClass, OccurrenceMapping.class));
}

@PostMapping(value = "{key}/merge", consumes = MediaType.TEXT_PLAIN_VALUE)
@PostMapping(value = "{key}/merge")
@Secured({GRSCICOLL_ADMIN_ROLE, GRSCICOLL_EDITOR_ROLE})
public void merge(@PathVariable("key") UUID entityKey, @RequestBody MergeParams params) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
Expand Down

0 comments on commit 9706292

Please sign in to comment.