From 8a55f85d3ef14ccb83b139acb35d0746431637be Mon Sep 17 00:00:00 2001 From: TheCatLady <52870424+TheCatLady@users.noreply.github.com> Date: Tue, 13 Jul 2021 05:58:54 -0400 Subject: [PATCH] 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 --- overseerr-api.yml | 3 +++ server/routes/request.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/overseerr-api.yml b/overseerr-api.yml index a9211e16..36248eac 100644 --- a/overseerr-api.yml +++ b/overseerr-api.yml @@ -4204,6 +4204,9 @@ paths: type: string languageProfileId: type: number + userId: + type: number + nullable: true required: - mediaType - mediaId diff --git a/server/routes/request.ts b/server/routes/request.ts index 0819bdfa..8fed7410 100644 --- a/server/routes/request.ts +++ b/server/routes/request.ts @@ -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);