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

Move business logic from User Controller to User Service #1453

Closed
pbn4 opened this issue Jul 2, 2021 · 0 comments
Closed

Move business logic from User Controller to User Service #1453

pbn4 opened this issue Jul 2, 2021 · 0 comments
Assignees
Labels
tech debt Long-term required changes that has been push down the road

Comments

@pbn4
Copy link
Contributor

pbn4 commented Jul 2, 2021

Currently business logic for User module is spread across controller and service, which by convention should not be the case. Example:

  async create(
    @Body() dto: UserCreateDto,
    @Query() queryParams: UserCreateQueryParams
  ): Promise<UserBasicDto> {
    const user = await this.userService.createUser(dto)
    if (!queryParams.noWelcomeEmail) {
      await this.emailService.welcome(user, dto.appUrl)
    }
    return mapTo(UserBasicDto, user)
  }

sending welcome emails should be encapsulated within User service.

@pbn4 pbn4 added the tech debt Long-term required changes that has been push down the road label Jul 2, 2021
@pbn4 pbn4 self-assigned this Jul 2, 2021
This was referenced Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Long-term required changes that has been push down the road
Projects
None yet
Development

No branches or pull requests

2 participants