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

misc: Refact some services to the call pattern #2641

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Conversation

vincent-pochet
Copy link
Collaborator

Context

Some services inherinting from the BaseService are not using the SERVCE_CLASS.call pattern. They are mostly old services that were created before the introduction of the pattern in the project.

Description

To increase consistency in the code base, this PR turns some old services to the pattern.
The impacted services are:

  • AddOns::CreateService
  • BillableMetrics::CreateService
  • Coupons::CreateService
  • AddOns::CreateService

More refactor will follow as other services have still to be converted.

@vincent-pochet vincent-pochet merged commit 4561c00 into main Sep 30, 2024
6 checks passed
@vincent-pochet vincent-pochet deleted the misc-more-call branch September 30, 2024 15:48
vincent-pochet added a commit that referenced this pull request Oct 1, 2024
## Context

This PR follows #2641 and keeps
refactoring some old service to take advantage of the `call` pattern and
to remove the `user` arguments used in `BaseService#initialize`.

## Description

This PR:
- Extract the `Customers::UpdateService#update_currency` method into a
dedicated `Customers::UpdateCurrencyService` and adds specs
- Turn the `Customers::UpdateService#update` method into a proper
`Customers::UpdateService#call` one
vincent-pochet added a commit that referenced this pull request Oct 3, 2024
## Context

This PR follows #2641 and
#2645 and keeps refactoring some
old service to take advantage of the `call` pattern and to remove the
`user` arguments used in `BaseService#initialize`.

## Description

This PR:
- Turn the `Plans::CreateService#create` method into a proper
`Plans::CreateService#call` one
- Remove the need for the `current_user` argument in
`Invites::CreateService` and move the arguments for the `call` method to
the `initializer`
- Refact `Invites::RevokeService` to take the `invite` as an argument
instead if the `id` and `current_organization` and move the argument for
the `call` method to the `initializer`
- Remove the `current_user` argument for the
`Invoices::CustomerUsageService`
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.

2 participants