Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request primarily introduces a new feature that allows retrieving all stores associated with a specific user ID. This feature has been implemented across various layers of the application, including the repository, service, and controller levels. The changes also include the corresponding unit tests and end-to-end tests to ensure the feature's correctness.
Here are the most important changes:
Repository Layer:
src/store/repository/prisma/prismaStore.repository.spec.ts
: Added a new test case for thegetAllUserStores
method and mocked thefindMany
method of thestore
object.src/store/repository/prisma/prismaStore.repository.ts
: Implemented thegetAllUserStores
method in thePrismaStoreRepository
class.src/store/repository/store.repository.ts
: Added thegetAllUserStores
method to theStoreRepository
abstract class.Service Layer:
src/store/service/store.service.spec.ts
: Added new test cases for thegetAllUserStores
method and mocked the same method in theStoreRepository
instance. Also, corrected the argument order in theget
method call.src/store/service/store.service.ts
: Implemented thegetAllUserStores
method in theStoreService
class. This method fetches all the stores associated with a user and throws aNotFoundException
if no stores are found.src/user/service/user.service.spec.ts
: Added a new test case for thegetAllUserStores
method and mocked the same method in theStoreService
instance.src/user/service/user.service.ts
: Implemented thegetAllUserStores
method in theUserService
class.Controller Layer:
src/user/user.controller.ts
: Added a new route handler forGET /:userId/stores
that retrieves all stores associated with a user ID.End-to-End Tests:
test/store.e2e-spec.ts
: Added new end-to-end tests for theGET /:userId/stores
route. The tests cover the scenarios where the user has stores and where the user does not have any stores.