Skip to content

Commit

Permalink
fix(quota): block multi-season requests that would exceed a user's qu…
Browse files Browse the repository at this point in the history
…ota (sct#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>
  • Loading branch information
2 people authored and nicospz committed Aug 9, 2021
1 parent 9f78c96 commit f0ec553
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions overseerr-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4204,6 +4204,9 @@ paths:
type: string
languageProfileId:
type: number
userId:
type: number
nullable: true
required:
- mediaType
- mediaId
Expand Down
8 changes: 8 additions & 0 deletions server/routes/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f0ec553

Please sign in to comment.