Skip to content

Conversation

@builderpepc
Copy link

ℹ️ Issue

Closes #12
Closes #14

📝 Description

Implements a GET endpoint on the Library controller which returns all Anthology instances contained within the specified Library instance, and a POST endpoint on the Library controller which creates a new Anthology instance within the specified Library instance.

Briefly list the changes made to the code:

  1. Defined the actual endpoint in LibraryController as getLibraryAnthologies.
  2. Defined a getter method getAnthologies in LibraryService which will throw a NotFoundException if the specified Library ID does not exist.
  3. In conjunction with Cursor (AI copilot), wrote comprehensive tests for the Library controller and service, including the new endpoints.
  4. Created a DTO for the Anthology object for robust input validation.

✔️ Verification

Comprehensively reviewed any AI-generated code. Produced 26 tests related to the Library controller and service, which all pass.

Verify by running yarn test:
image
*See the Notes section for info about the failing test.

🏕️ Future Work / Notes

  • Identified that the original endpoint URL specified in the ticket did not align with the expected behavior. Richa updated the ticket accordingly.
  • Chose to make the return type Anthology[] for clarity and ease of pagination. Can easily be refactored to an object like { anthologies: Anthology[] } in the future if needed.
  • Future work related to the Anthology controller's fields may require the DTO in create-anthology.dto.ts to be updated accordingly.
  • There is a test unrelated to my own code which is failing. The same test also fails on main. All tests in library.service.spec.ts and library.controller.spec.ts pass.

@alaatamam alaatamam merged commit eeef949 into main Oct 19, 2025
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.

POST endpoint for creating a new anthology in a library GET endpoint for retrieving all anthologies in a library

3 participants