Skip to content

Conversation

@Edge-J
Copy link
Contributor

@Edge-J Edge-J commented Oct 6, 2025

what I learned:

  • implement RESTful API endpoints in a Spring Boot controller
  • use of DTOs

What I struggled with:

  • using the existing DTOs instead of creating new ones

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.

🎓 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.

@anthonydmays anthonydmays reopened this Oct 8, 2025
package com.codedifferently.lesson23.web;

import java.util.List;

Copy link
Contributor

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 {
Copy link
Contributor

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();
Copy link
Contributor

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();
Copy link
Contributor

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.

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.

Also, please fix failing checks.

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