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

Feature/4752 file validator pipe new #9707

Closed

Conversation

thiagomini
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?

We don't have validation options out of the box for the @UploadedFile() decorator.

Issue Number: #4752

What is the new behavior?

We can use some default validators using pipes: MaxFileSizeValidator and FileTypeValidator. Also, we can pass our own validators if they follow the FileValidator interface.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This still needs tests to verify if it's actually working with files (e2e tests maybe?)
This is a continuation of a previous, stale PR

@thiagomini thiagomini mentioned this pull request Jun 1, 2022
12 tasks
@coveralls
Copy link

coveralls commented Jun 1, 2022

Pull Request Test Coverage Report for Build 410460da-4fe3-4bbf-9ea1-573f08856c56

  • 49 of 51 (96.08%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 94.123%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/common/pipes/file/file-type.validator.ts 5 6 83.33%
packages/common/pipes/file/max-file-size.validator.ts 5 6 83.33%
Totals Coverage Status
Change from base Build 3a79ae39-22dd-4c90-92e4-77db246e2790: 0.02%
Covered Lines: 5830
Relevant Lines: 6194

💛 - Coveralls

@thiagomini thiagomini marked this pull request as ready for review June 1, 2022 17:54
@kamilmysliwiec
Copy link
Member

@thiagomini could you rebase to use the 9.0.0 branch? 🙌

@thiagomini thiagomini changed the base branch from master to 9.0.0 June 2, 2022 16:57
@thiagomini thiagomini changed the base branch from 9.0.0 to master June 2, 2022 16:57
dependabot bot and others added 13 commits June 2, 2022 14:08
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.36 to 17.0.38.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 12.4.3 to 12.5.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](lint-staged/lint-staged@v12.4.3...v12.5.0)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [point-of-view](https://github.com/fastify/point-of-view) from 5.3.0 to 6.2.1.
- [Release notes](https://github.com/fastify/point-of-view/releases)
- [Commits](fastify/point-of-view@v5.3.0...v6.2.1)

---
updated-dependencies:
- dependency-name: point-of-view
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [kafkajs](https://github.com/tulios/kafkajs) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/tulios/kafkajs/releases)
- [Changelog](https://github.com/tulios/kafkajs/blob/master/CHANGELOG.md)
- [Commits](tulios/kafkajs@v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: kafkajs
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
fix import to relative path, the alias was causing cyclic references
add curly braces to if statement for consistency
add tests for parse file pipe builder and refactor associated classes
@thiagomini thiagomini force-pushed the feature/4752-file-validator-pipe-new branch from b059f50 to 2ad6be0 Compare June 2, 2022 17:19
@thiagomini thiagomini changed the base branch from master to 9.0.0 June 2, 2022 17:19
@thiagomini
Copy link
Contributor Author

thiagomini commented Jun 2, 2022

Closed to create again for 9.0.0 PR

@thiagomini thiagomini closed this Jun 2, 2022
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.

3 participants