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

Create decorator for validation #198

Open
wovalle opened this issue Oct 17, 2020 · 0 comments
Open

Create decorator for validation #198

wovalle opened this issue Oct 17, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@wovalle
Copy link
Owner

wovalle commented Oct 17, 2020

Fireorm supports validation by leveraging the responsibility to class-validator. To perform the validation we have to declare a function on each abstract repositories like (this one or this one) and checking on each function if validation should be performed with something close to:

    if (this.config.validateModels) {
      const errors = await this.validate(item);

      if (errors.length) {
        throw errors;
      }
    }

Acceptance Criteria:

  • Create a Validate decorator that checks if validation should be performed and returns a ValidationError
  • Create unit tests
  • Replace the existing validation code with the decorator
  • Each function that needs to be validated should only use the validation decorator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant