|
|
@ -251,20 +251,19 @@ requestRoutes.post('/', async (req, res, next) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (req.body.mediaType === MediaType.MOVIE) {
|
|
|
|
if (req.body.mediaType === MediaType.MOVIE) {
|
|
|
|
const existing = await requestRepository.findOne({
|
|
|
|
const existing = await requestRepository
|
|
|
|
where: {
|
|
|
|
.createQueryBuilder('request')
|
|
|
|
media: {
|
|
|
|
.leftJoin('request.media', 'media')
|
|
|
|
tmdbId: tmdbMedia.id,
|
|
|
|
.where('request.is4k = :is4k', { is4k: req.body.is4k })
|
|
|
|
},
|
|
|
|
.andWhere('media.tmdbId = :tmdbId', { tmdbId: tmdbMedia.id })
|
|
|
|
is4k: req.body.is4k,
|
|
|
|
.getOne();
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (existing) {
|
|
|
|
if (existing) {
|
|
|
|
logger.warn('Duplicate request for media blocked', {
|
|
|
|
logger.warn('Duplicate request for media blocked', {
|
|
|
|
tmdbId: tmdbMedia.id,
|
|
|
|
tmdbId: tmdbMedia.id,
|
|
|
|
mediaType: req.body.mediaType,
|
|
|
|
mediaType: req.body.mediaType,
|
|
|
|
is4k: req.body.is4k,
|
|
|
|
is4k: req.body.is4k,
|
|
|
|
|
|
|
|
label: 'Media Request',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return next({
|
|
|
|
return next({
|
|
|
|
status: 409,
|
|
|
|
status: 409,
|
|
|
|