Skip to content

Commit

Permalink
SHIBUI-1788
Browse files Browse the repository at this point in the history
correcting check for create
  • Loading branch information
chasegawa committed Jun 23, 2021
1 parent 2c292a6 commit 43d2b18
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public class CustomEntityAttributesDefinitionsController {
@Transactional
public ResponseEntity<?> create(@RequestBody CustomEntityAttributeDefinition definition) {
// If already defined, we can't create a new one, nor will this call update the definition
CustomEntityAttributeDefinition cad = caService.find(definition.getName());
CustomEntityAttributeDefinition cad = caService.find(definition.getResourceId());

if (cad != null) {
HttpHeaders headers = new HttpHeaders();
headers.setLocation(ServletUriComponentsBuilder.fromCurrentServletMapping().path("/api/custom/entity/attribute").build().toUri());

return ResponseEntity.status(HttpStatus.CONFLICT).headers(headers)
.body(new ErrorResponse(String.valueOf(HttpStatus.CONFLICT.value()),
String.format("The custom attribute definition with name: [%s] already exists.", definition.getName())));
String.format("The custom attribute definition already exists - unable to create a new definition")));
}

CustomEntityAttributeDefinition result = caService.createOrUpdateDefinition(definition);
Expand Down

0 comments on commit 43d2b18

Please sign in to comment.