drive-server icon indicating copy to clipboard operation
drive-server copied to clipboard

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

Open apsantiso opened this issue 11 months ago • 2 comments

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 avatar Feb 27 '24 14:02 apsantiso

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Mar 06 '24 23:03 sonarqubecloud[bot]

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

sonarqubecloud[bot] avatar Apr 15 '24 12:04 sonarqubecloud[bot]