fix(requests): check for existing media of same type when requesting (#2445)

Co-authored-by: Ryan Cohen <ryan@sct.dev>
pull/2447/head
Danshil Kokil Mungur 3 years ago committed by GitHub
parent 0842c233d0
commit eb9ca2e86f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,
})

Loading…
Cancel
Save