-
Notifications
You must be signed in to change notification settings - Fork 29
Jonee23 feat: Implement MediaItemsController REST API endpoints #737
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
base: main
Are you sure you want to change the base?
Conversation
- Add GET /items endpoint to retrieve all media items
- Add GET /items/{id} endpoint to retrieve single item by ID
- Add POST /items endpoint to create new media items with validation
- Add DELETE /items/{id} endpoint to remove items by ID
- Handle proper HTTP status codes (200, 201, 400, 404, 204)
- Implement error handling with structured error responses
- All endpoints tested and working correctly
anthonydmays
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎓 Automated Grading Report
Student: Jonee Mckellar
Date: 10/7/2025
Feedback
The submission meets all functional requirements as specified in the grading criteria. The student successfully modified the MediaItemsController.java file to pass all unit tests, demonstrating a solid understanding of APIs, HTTP protocol, and Java development. The implementation includes all necessary endpoints for handling media items, such as retrieving, adding, and deleting items, and handles exceptions appropriately.
Technically, the code is syntactically correct and well-formatted. The use of Java annotations and Spring framework features is appropriate and follows best practices. All unit tests and GitHub checks pass, indicating that the code is robust and reliable.
The submission does not include any stretch criteria, so the stretch score is not applicable. Overall, the student has demonstrated a comprehensive understanding of the task and executed it effectively.
This is an automated preliminary review. Please review and adjust before finalizing.
anthonydmays
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please fix failing checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must not have lesson_19 work here.
| var response = CreateMediaItemResponse.builder().item(responseItem).build(); | ||
| return ResponseEntity.ok(response); | ||
| } catch (Exception e) { | ||
| var errorResponse = java.util.Map.of("errors", java.util.List.of("Invalid item data")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look into @ValidRequest and you'll see that you don't need this particular catch block code at all.
| public ResponseEntity<?> addItem(@RequestBody CreateMediaItemRequest request) { | ||
| try { | ||
| if (request.getItem() == null) { | ||
| var errorResponse = java.util.Map.of("errors", java.util.List.of("Item is required")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ValidRequest will validate this for you.
This PR implements the complete MediaItemsController to provide REST API functionality for the library management system.
Changes:
Testing:
The implementation uses the existing Library and Librarian services and integrates with the current MediaItem model structure. All endpoints are fully functional and ready for front-end integration.