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

docs: add explicit provider registration of new services in prisma recipe #2912

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pablopaul
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Docs
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

@@ -391,6 +391,21 @@ export class PostService {

Your `UserService` and `PostService` currently wrap the CRUD queries that are available in Prisma Client. In a real world application, the service would also be the place to add business logic to your application. For example, you could have a method called `updatePassword` inside the `UserService` that would be responsible for updating the password of a user.

We need to register the new services with Nest so that it can perform the injection. We do this by editing our module file (`app.module.ts`) and adding the new services to the `providers` array of the `@Module()` decorator.

```typescript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need to show any code for this here as registering providers is pretty standard in nestjs apps

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@micalevisk I followed along the recipe, tried to run the app and ran into the error. What do you think about just mentioning it and leaving out the code?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we can have that mention to recall the dev, but the code itself is redundant here

Copy link
Author

@pablopaul pablopaul Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adapted the change accordingly. Does it work like this for you?

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.

None yet

2 participants