Skip to content
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

[feat]get stores by userId #12

Merged
merged 1 commit into from
Apr 27, 2024
Merged

[feat]get stores by userId #12

merged 1 commit into from
Apr 27, 2024

Conversation

nathsouzadev
Copy link
Owner

This pull request primarily introduces a new feature to the application, allowing users to find a store by a user's ID. This change affects several files across the codebase, including repository, service, and controller classes, as well as their corresponding test files. The changes are mainly concentrated around the addition of the getByUserId method and its usage.

New Feature Implementation:

  • src/store/repository/prisma/prismaStore.repository.spec.ts, src/store/repository/prisma/prismaStore.repository.ts, src/store/repository/store.repository.ts: A new method getByUserId was added to the PrismaStoreRepository class and the StoreRepository abstract class, which allows finding a store by a user's ID. The corresponding test was also added.

  • src/store/service/store.service.spec.ts, src/store/service/store.service.ts: The getByUserId method was also added to the StoreService class, with the addition of error handling for cases when a store is not found. The corresponding test was also added.

  • src/user/service/user.service.spec.ts, src/user/service/user.service.ts: The getStoreByUserId method was added to the UserService class, which uses the getByUserId method from StoreService. The corresponding test was also added.

  • src/user/user.controller.ts: Two new endpoints were added to the UsersController class. The first one retrieves a store by a user's ID, and the second one retrieves a store by a store's ID and a user's ID. Both endpoints handle the case when a store is not found.

  • test/store.e2e-spec.ts: Two new end-to-end tests were added. The first one tests the retrieval of a store by a user's ID, and the second one tests the error handling when a store is not found by a user's ID.

@nathsouzadev nathsouzadev merged commit 3498527 into main Apr 27, 2024
3 checks passed
@nathsouzadev nathsouzadev deleted the add-get-store branch April 27, 2024 11:39
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.

1 participant