fix(quota): block multi-season requests that would exceed a user's quota (#1874)

* fix(quota): block multi-season requests that would exceed a user's quota

* fix(docs): add missing request user option to API docs

Co-authored-by: sct <ryan@sct.dev>
This commit is contained in:
TheCatLady
2021-07-13 05:58:54 -04:00
committed by GitHub
parent 8b960acf73
commit 8a55f85d3e
2 changed files with 11 additions and 0 deletions

View File

@@ -350,6 +350,14 @@ requestRoutes.post('/', async (req, res, next) => {
status: 202,
message: 'No seasons available to request',
});
} else if (
quotas.tv.limit &&
finalSeasons.length > (quotas.tv.remaining ?? 0)
) {
return next({
status: 403,
message: 'Series Quota Exceeded',
});
}
await mediaRepository.save(media);