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

[PB-1428]: feat/limit-upload-file-size #427

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

apsantiso
Copy link
Collaborator

@apsantiso apsantiso commented Feb 27, 2024

This is currently being tested on the test environment along with payments.

The current flow for the frontend is:

  1. it uploads the file to the network
  2. it asks the backend to store the file location, data, name, etc in the database.

If we enforce the limits with this flow, then users are going to upload files that they do not know if it is between their current tier o not. Therefore, it is essential to enable a new endpoints along with the limit enforcement.

What it is included in this PR?

  1. Middleware to enforce file upload size limit when a user tries to create a file.
  2. A new endpoint for the frontend to consume so they can know beforehand if a file size is valid or not.
  3. Gateway update tier should apply free tier if for some reason, payments fail to send a correct planId.

Note: Middleware enforcement is bypassed if user.tierId is empty, regarding the new endpoint, it throws a 404, so the frontend is going to be able to know that this user does not have a limit set yet.

@apsantiso apsantiso marked this pull request as ready for review February 28, 2024 19:47
@apsantiso apsantiso requested a review from sg-gs March 4, 2024 09:33
@apsantiso apsantiso changed the title feat/limit-upload-file-size [PB-1428]: feat/limit-upload-file-size Mar 4, 2024
@apsantiso apsantiso self-assigned this Mar 5, 2024
@apsantiso apsantiso added the enhancement New feature or request label Mar 5, 2024
src/app/services/featureLimit.js Outdated Show resolved Hide resolved
Copy link

sonarqubecloud bot commented Mar 6, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@apsantiso apsantiso force-pushed the feat/limit-files-upload branch from 15285d3 to c1e6912 Compare April 15, 2024 12:09
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

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

Successfully merging this pull request may close these issues.

3 participants