Skip to content

Conversation

@dxsmith244
Copy link
Contributor

No description provided.

Set<MediaItem> item = library.search(SearchCriteria.builder().id(id.toString()).build());
if (item.isEmpty()) {
return ResponseEntity.notFound().build();
} else if (!test1.contains(item.iterator().next()) || item.iterator().next() == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you doing this? Doesn't seem necessary at all. My guess is removing this code (and test1) above won't change your results at all.

public ResponseEntity<?> postItems(@RequestBody CreateMediaItemRequest requestBody) {
List<String> errorsList = new ArrayList<>();
MediaItemRequest request = requestBody.getItem();
if (requestBody.getItem() == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't need any of this validation code if you just use the @Valid attribute on the requestBody argument.

Set<MediaItem> items = library.search(SearchCriteria.builder().id(id.toString()).build());
Optional<MediaItem> matchedItem =
items.stream().filter(item -> item.getId().equals(id)).findFirst();
System.out.println("items");
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove debugging statements.

public ResponseEntity<GetMediaItemsResponse> getItemById() {
Set<MediaItem> items = library.search(SearchCriteria.builder().build());
if (items.isEmpty()) {
ResponseEntity.noContent();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, should return GetMediaItmesResponse with an empty list of items. Anything else would be unexpected and unusual.

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