From eb9ca2e86f3be3f4ff8ee2e7c4aecdf337d8976d Mon Sep 17 00:00:00 2001 From: Danshil Kokil Mungur Date: Thu, 20 Jan 2022 14:42:43 +0400 Subject: [PATCH] fix(requests): check for existing media of same type when requesting (#2445) Co-authored-by: Ryan Cohen --- server/routes/request.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/routes/request.ts b/server/routes/request.ts index 38af4057c..cd269f4ef 100644 --- a/server/routes/request.ts +++ b/server/routes/request.ts @@ -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, })