|
|
|
@ -167,7 +167,8 @@ export class MediaRequest {
|
|
|
|
|
// If there is an existing movie request that isn't declined, don't allow a new one.
|
|
|
|
|
if (
|
|
|
|
|
requestBody.mediaType === MediaType.MOVIE &&
|
|
|
|
|
existing[0].status !== MediaRequestStatus.DECLINED
|
|
|
|
|
existing[0].status !== MediaRequestStatus.DECLINED &&
|
|
|
|
|
existing[0].status !== MediaRequestStatus.COMPLETED
|
|
|
|
|
) {
|
|
|
|
|
logger.warn('Duplicate request for media blocked', {
|
|
|
|
|
tmdbId: tmdbMedia.id,
|
|
|
|
@ -260,7 +261,8 @@ export class MediaRequest {
|
|
|
|
|
.filter(
|
|
|
|
|
(request) =>
|
|
|
|
|
request.is4k === requestBody.is4k &&
|
|
|
|
|
request.status !== MediaRequestStatus.DECLINED
|
|
|
|
|
request.status !== MediaRequestStatus.DECLINED &&
|
|
|
|
|
request.status !== MediaRequestStatus.COMPLETED
|
|
|
|
|
)
|
|
|
|
|
.reduce((seasons, request) => {
|
|
|
|
|
const combinedSeasons = request.seasons.map(
|
|
|
|
@ -279,7 +281,9 @@ export class MediaRequest {
|
|
|
|
|
.filter(
|
|
|
|
|
(season) =>
|
|
|
|
|
season[requestBody.is4k ? 'status4k' : 'status'] !==
|
|
|
|
|
MediaStatus.UNKNOWN
|
|
|
|
|
MediaStatus.UNKNOWN &&
|
|
|
|
|
season[requestBody.is4k ? 'status4k' : 'status'] !==
|
|
|
|
|
MediaStatus.DELETED
|
|
|
|
|
)
|
|
|
|
|
.map((season) => season.seasonNumber),
|
|
|
|
|
];
|
|
|
|
@ -583,7 +587,8 @@ export class MediaRequest {
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
media.mediaType === MediaType.MOVIE &&
|
|
|
|
|
this.status === MediaRequestStatus.DECLINED
|
|
|
|
|
this.status === MediaRequestStatus.DECLINED &&
|
|
|
|
|
media[this.is4k ? 'status4k' : 'status'] !== MediaStatus.DELETED
|
|
|
|
|
) {
|
|
|
|
|
media[this.is4k ? 'status4k' : 'status'] = MediaStatus.UNKNOWN;
|
|
|
|
|
mediaRepository.save(media);
|
|
|
|
@ -601,7 +606,8 @@ export class MediaRequest {
|
|
|
|
|
media.requests.filter(
|
|
|
|
|
(request) => request.status === MediaRequestStatus.PENDING
|
|
|
|
|
).length === 0 &&
|
|
|
|
|
media[this.is4k ? 'status4k' : 'status'] === MediaStatus.PENDING
|
|
|
|
|
media[this.is4k ? 'status4k' : 'status'] === MediaStatus.PENDING &&
|
|
|
|
|
media[this.is4k ? 'status4k' : 'status'] !== MediaStatus.DELETED
|
|
|
|
|
) {
|
|
|
|
|
media[this.is4k ? 'status4k' : 'status'] = MediaStatus.UNKNOWN;
|
|
|
|
|
mediaRepository.save(media);
|
|
|
|
|