Skip to content

Conversation

@tobyev
Copy link
Contributor

@tobyev tobyev commented Oct 13, 2025

I made changes to my Lesson 23 homework by aligning MediaItems Controller with the sample solution. I restored use of a single, consistent Librarian (provided as a Spring @bean), changed GET /items/{id} to return MediaItemResponse, and updated POST /items to use CreateMediaItemRequest →→ CreateMediaItemResponse with a 201 Created response. I also removed ad-hoc new Librarian(...) calls and applied Spotless formatting. All changes were staged, committed, pushed (branch: fix/lesson-23-controller-toby-evans), and are ready for review.

Problem area (s):
• Creating a new Librarian per request instead of using a single injected instance
• Returning a Map instead of the provided response DTOs, causing response shape mismatches
• Test failures due to missing Spring bean for Librarian (unsatisfied dependency)
• Running Gradle tasks from the wrong directory/module at first

Lessons learned:
• Prefer dependency injection-provide shared collaborators (like Librarian) as Spring beans
• Follow the sample solution's request/response DTOs to keep APIs consistent and tests passing
• Run ./gradlew :api_app:spotlessApply and :api_app:check to catch formatting and compile issues early
• Use the module's Gradle wrapper and targeted tasks (e.g., lesson_23/api/java ./gradlew :api_app:check)

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