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

refactor(): remove duplicate function getClassScope #8800

Merged

Conversation

zanminkian
Copy link
Contributor

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
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@coveralls
Copy link

coveralls commented Dec 17, 2021

Pull Request Test Coverage Report for Build 9229029f-6efc-4ed1-9dc4-37cf04265af3

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 94.128%

Totals Coverage Status
Change from base Build 6c6442b4-a131-4d7f-a0f8-d2eb1814def7: -0.002%
Covered Lines: 5691
Relevant Lines: 6046

💛 - Coveralls

@zanminkian
Copy link
Contributor Author

zanminkian commented Dec 17, 2021

I want to move get-class-scope.ts from @nestjs/core to @nestjs/common and add a function:

export function setClassScope(provider: Type<unknown>, scope: Scope): void {
  Reflect.defineMetadata(SCOPE_OPTIONS_METADATA, scope, provider);
}

I think get and set should be a pair. And alse easy to write unit tests.
Is it will be better? -: )

Copy link
Member

@micalevisk micalevisk left a comment

Choose a reason for hiding this comment

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

nice catch! DRY them all

image

@kamilmysliwiec
Copy link
Member

Sounds good @zanminkian!

@zanminkian
Copy link
Contributor Author

I want to move get-class-scope.ts from @nestjs/core to @nestjs/common and add a function:

export function setClassScope(provider: Type<unknown>, scope: Scope): void {
  Reflect.defineMetadata(SCOPE_OPTIONS_METADATA, scope, provider);
}

I think get and set should be a pair. And alse easy to write unit tests. Is it will be better? -: )

@kamilmysliwiec Could you please review this PR? I will create a next PR to optimize class scope management.

@kamilmysliwiec kamilmysliwiec merged commit 50a847e into nestjs:master Feb 14, 2022
@kamilmysliwiec
Copy link
Member

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants