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>
pull/1864/head^2
TheCatLady 3 years ago committed by GitHub
parent 8b960acf73
commit 8a55f85d3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4204,6 +4204,9 @@ paths:
type: string
languageProfileId:
type: number
userId:
type: number
nullable: true
required:
- mediaType
- mediaId

@ -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);

Loading…
Cancel
Save