-
Notifications
You must be signed in to change notification settings - Fork 29
Feat/dev_lesson_23 #751
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?
Feat/dev_lesson_23 #751
Conversation
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: Devyn Benson
Date: 10/7/2025
Feedback
The submission meets all functional requirements as outlined in the grading criteria. The student has successfully implemented the necessary API endpoints in the MediaItemsController.java file, including GET, POST, and DELETE operations. The code handles validation errors effectively in the POST request, providing meaningful error messages when input validation fails. The use of helper methods like findItemById improves code readability and reusability. All unit tests and GitHub checks pass, indicating the code is functionally correct and integrates well with the existing system.
From a technical perspective, the code is syntactically correct and well-formatted. The use of Java annotations and Spring's ResponseEntity is appropriate and follows best practices for RESTful API development. The inclusion of error handling and custom error responses enhances the robustness of the application. The code is organized, with clear separation of concerns, making it easy to maintain and extend. Overall, the implementation demonstrates a strong understanding of Java development, APIs, and HTTP protocols.
This is an automated preliminary review. Please review and adjust before finalizing.
| } | ||
|
|
||
| @PostMapping("/items") | ||
| public ResponseEntity<?> createItem(@Valid @RequestBody CreateMediaItemRequest request, BindingResult bindingResult) { |
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.
Should be ResponseEntity<CreateMediaItemResponse>.
| .build(); | ||
|
|
||
| return ResponseEntity.ok(response); | ||
|
|
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.
Extra line break
PR: Implement Missing Media Item Endpoints (GET by ID, POST, DELETE) – Lesson 23 Java API
Summary
Implemented full REST support in
MediaItemsController:Includes validation handling, error shaping, consistent response models, and item lookup helper.
Endpoints
{ "items": [ ... ] }{ ...item }{ "item": { ... } }{ "errors": [ ... ] }POST /items (valid)
Request:
Response 200:
POST /items (valid):
Pseudocode Used Initially
if POST body.item missing -> 400 {errors:["item is required"]}
else map -> domain item, add, return 200 {item:...}
GET /items/{id} -> search; 404 if none else 200
DELETE /items/{id} -> search; 404 if none; remove; 204
Implementation Notes
Struggles & Learning