Skip to content

Commit

Permalink
fix(requests): check for existing media of same type when requesting (#…
Browse files Browse the repository at this point in the history
…2445)

Co-authored-by: Ryan Cohen <ryan@sct.dev>
  • Loading branch information
danshilm and sct committed Jan 20, 2022
1 parent 0842c23 commit eb9ca2e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/routes/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ requestRoutes.post('/', async (req, res, next) => {
.leftJoin('request.media', 'media')
.where('request.is4k = :is4k', { is4k: req.body.is4k })
.andWhere('media.tmdbId = :tmdbId', { tmdbId: tmdbMedia.id })
.andWhere('media.mediaType = :mediaType', {
mediaType: MediaType.MOVIE,
})
.andWhere('request.status != :requestStatus', {
requestStatus: MediaRequestStatus.DECLINED,
})
Expand Down

0 comments on commit eb9ca2e

Please sign in to comment.