Skip to content

Conversation

@Dasiame
Copy link
Contributor

@Dasiame Dasiame commented Dec 2, 2024

…I to lesson_26

Copy link
Contributor

@anthonydmays anthonydmays left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, let me know if my comments don't make sense.

@DeleteMapping("/items/{id}")
public ResponseEntity<Void> deletebById(@PathVariable UUID id) {
Set<MediaItem> items = library.search(SearchCriteria.builder().id(id.toString()).build());
MediaItem item = items.iterator().next();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will explode if items.isEmpty() is true (meaning the collection is empty), so this should go after the if statement.

}

@DeleteMapping("/items/{id}")
public ResponseEntity<Void> deletebById(@PathVariable UUID id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing the id paramter as a UUID causes this method to blow up, so try String instead as you have it for getItemsById.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants