-
Notifications
You must be signed in to change notification settings - Fork 29
Feat: Lesson 23 adds HTTP methods using REST API #744
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
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: Jared Edge
Date: 10/7/2025
Feedback
The submission demonstrates a good understanding of the task requirements, with most of the necessary functionality implemented correctly. The student has modified the MediaItemsController.java file to include methods for handling GET, POST, and DELETE HTTP requests. However, there are some discrepancies compared to the sample solution. For instance, the getItemById method returns a CreateMediaItemResponse instead of a MediaItemResponse, which deviates from the expected behavior. This affects the functional score as it may not align with the intended API design. Additionally, the error handling in the addItem method is somewhat generic, returning a bad request for any exception, which could be improved by handling specific exceptions more precisely.
On the technical side, the code is mostly well-formatted and syntactically correct. The imports are organized, although there are some unnecessary changes such as reordering imports without functional impact. The lack of a newline at the end of the file is a minor formatting issue. Overall, the submission is close to meeting all technical requirements but falls short due to these minor issues. All unit tests and GitHub checks should be verified to ensure they pass, as this is a critical part of the technical evaluation.
This is an automated preliminary review. Please review and adjust before finalizing.
| package com.codedifferently.lesson23.web; | ||
|
|
||
| import java.util.List; | ||
|
|
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
|
|
||
| @PostMapping("/items") | ||
| public ResponseEntity<CreateMediaItemResponse> addItem(@Valid @RequestBody CreateMediaItemRequest request) { | ||
| try { |
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.
Don't actually need try/catch here. The controller will just do the right thing and return an appropriate error response.
| .build(); | ||
| return ResponseEntity.ok(response); | ||
| } catch (Exception e) { | ||
| return ResponseEntity.badRequest().build(); |
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.
Not always true, so this is not the right condition under which to return a bad request response.
| } catch (IllegalArgumentException e) { | ||
| return ResponseEntity.notFound().build(); | ||
| } catch (Exception e) { | ||
| return ResponseEntity.notFound().build(); |
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.
Not necessarily true that an exception was caught here because the item was not found. Use a more specific exception or change the error you return here to 500.
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.
what I learned:
What I struggled with: