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

Extract allowed apps to SwapOrderHelper #1479

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Conversation

fmrsabino
Copy link
Collaborator

Summary

Moves the "allowed apps" logic from the SwapOrderMapper to the SwapOrderHelper. The mapper is specific to the transaction history/queue logic while the helper is a class that can be used across the different route.

With this new functionality in SwapOrderHelper, we can now check if a specific application is allowed in other parts of the service.

Changes

  • Moves the allowed apps' logic from the SwapOrderMapper to the SwapOrderHelper

@fmrsabino fmrsabino self-assigned this Apr 29, 2024
@fmrsabino fmrsabino requested a review from a team as a code owner April 29, 2024 14:47
@coveralls
Copy link

coveralls commented Apr 29, 2024

Pull Request Test Coverage Report for Build 8886059347

Details

  • 8 of 10 (80.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 91.83%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/routes/transactions/mappers/common/swap-order.mapper.ts 1 3 33.33%
Totals Coverage Status
Change from base Build 8877536966: -0.02%
Covered Lines: 6885
Relevant Lines: 7229

💛 - Coveralls

/**
* Checks if the app associated with an order is allowed.
*
* @param order
Copy link
Member

Choose a reason for hiding this comment

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

Nit: this is missing a description.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 4f1ee88

@@ -16,6 +16,9 @@ import { SwapsRepositoryModule } from '@/domain/swaps/swaps-repository.module';

@Injectable()
export class SwapOrderHelper {
private readonly restrictApps =
this.configurationService.getOrThrow('swaps.restrictApps');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: restrictApps is of type unknown, I'd declare it as boolean:

private readonly restrictApps: boolean = ...

Or parametrise the function call:

this.configurationService.getOrThrow<boolean>('swaps.restrictApps')

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 4f1ee88

@fmrsabino fmrsabino merged commit 81c1329 into main Apr 30, 2024
16 checks passed
@fmrsabino fmrsabino deleted the move-allowed-app-to-helper branch April 30, 2024 09:32
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

4 participants