drive-server
drive-server copied to clipboard
[PB-1428]: feat/limit-upload-file-size
This is currently being tested on the test environment along with payments.
The current flow for the frontend is:
- it uploads the file to the network
- 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?
- Middleware to enforce file upload size limit when a user tries to create a file.
- A new endpoint for the frontend to consume so they can know beforehand if a file size is valid or not.
- 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.
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