Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs and patch endpoint #72

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public ResponseEntity<JsonApiWrapperWrite> searchByPrimarySpecimenObjectId(
}

@Operation(summary = "Create single PID Record")
@PostMapping(value = "")
@PostMapping(value = "/")
public ResponseEntity<JsonApiWrapperWrite> createRecord(@RequestBody JsonNode request,
Authentication authentication)
throws PidResolutionException, InvalidRequestException, PidCreationException {
Expand Down Expand Up @@ -147,7 +147,7 @@ public ResponseEntity<JsonApiWrapperWrite> updateRecord(@PathVariable("prefix")
}

@Operation(summary = "Update multiple PID Records")
@PatchMapping(value = "")
@PatchMapping(value = "/")
public ResponseEntity<JsonApiWrapperWrite> updateRecords(@RequestBody List<JsonNode> requests,
Authentication authentication)
throws InvalidRequestException, PidResolutionException, UnprocessableEntityException {
Expand Down Expand Up @@ -229,7 +229,7 @@ public ResponseEntity<Void> rollbackHandlePhysId(


@Operation(summary = "Archive multiple PID records")
@PutMapping(value = "")
@PutMapping(value = "/")
public ResponseEntity<JsonApiWrapperWrite> archiveRecords(@RequestBody List<JsonNode> requests,
Authentication authentication)
throws InvalidRequestException, PidResolutionException, UnprocessableEntityException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public JsonApiWrapperWrite createRecords(List<JsonNode> requests)
default -> throw new UnsupportedOperationException("Unrecognized type");
}
} catch (JsonProcessingException | PidResolutionException e) {
log.error("An error has occurred in processing request", e);
throw new InvalidRequestException(
"An error has occurred parsing a record in request. More information: " + e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ protected void verifyNoRegisteredSpecimens(List<byte[]> physicalIds)
if (!registeredRows.isEmpty()) {
var registeredHandles = registeredRows.stream()
.map(row -> new String(row.getHandle(), StandardCharsets.UTF_8)).toList();
log.error("Attempting to register identifiers for existing records");
log.debug("Handles already registered: {}", registeredHandles);
throw new PidResolutionException(
"Unable to create PID records. Some requested records are already registered. Verify the following digital specimens:"
+ registeredHandles);
Expand Down
Loading