Compare commits

..

3 Commits

Author SHA1 Message Date
root
2dc143faf7 Fix cache IDs and discover route for music/book types
Some checks failed
Rebuild Issue Index / build-index (push) Has been cancelled
Close Stale Issues and PRs / Close stale issues and PRs (push) Has been cancelled
Trivy Container Vulnerability Scan / Scan latest container image (push) Has been cancelled
Check Docs Links / Verify external links in Markdown and MDX (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
2026-04-04 12:31:10 -05:00
root
206f586a11 Add MUSIC/BOOK cases to request route switch statements 2026-04-04 12:13:45 -05:00
root
e4874f5792 Widen remaining type unions: StatusBadge, IssueModal, PersonDetails, ExternalLink, discover 2026-04-04 11:59:44 -05:00
8 changed files with 29 additions and 7 deletions

View File

@@ -4,6 +4,8 @@ export type AvailableCacheIds =
| 'tmdb'
| 'radarr'
| 'sonarr'
| 'lidarr'
| 'readarr'
| 'rt'
| 'imdb'
| 'github'
@@ -50,6 +52,8 @@ class CacheManager {
}),
radarr: new Cache('radarr', 'Radarr API'),
sonarr: new Cache('sonarr', 'Sonarr API'),
lidarr: new Cache('lidarr', 'Lidarr API'),
readarr: new Cache('readarr', 'Readarr API'),
rt: new Cache('rt', 'Rotten Tomatoes API', {
stdTtl: 43200,
checkPeriod: 60 * 30,

View File

@@ -703,7 +703,7 @@ discoverRoutes.get('/trending', async (req, res, next) => {
const tmdb = createTmdbWithRegionLanguage(req.user);
try {
const mediaType = (req.query.mediaType as 'all' | 'movie' | 'tv') ?? 'all';
const mediaType = (req.query.mediaType as 'all' | 'movie' | 'tv' | 'music' | 'book') ?? 'all';
const timeWindow =
(req.query.timeWindow as 'day' | 'week') === 'week' ? 'week' : 'day';
const language = (req.query.language as string) ?? req.locale;
@@ -737,7 +737,9 @@ discoverRoutes.get('/trending', async (req, res, next) => {
}),
} as const;
const { data, mapper, type } = await trendingFetchers[mediaType]();
// Music/book don't have TMDB trending - fall back to 'all'
const fetcherKey = (mediaType === 'music' || mediaType === 'book') ? 'all' : mediaType;
const { data, mapper, type } = await trendingFetchers[fetcherKey]();
const media = await Media.getRelatedMedia(
req.user,

View File

@@ -244,6 +244,14 @@ requestRoutes.get<Record<string, unknown>, RequestResultsResponse>(
?.profiles?.find((profile) => profile.id === r.profileId)?.name,
};
}
case MediaType.MUSIC:
case MediaType.BOOK:
default: {
return {
...r,
profileName: undefined,
};
}
}
});
@@ -273,6 +281,14 @@ requestRoutes.get<Record<string, unknown>, RequestResultsResponse>(
),
};
}
case MediaType.MUSIC:
case MediaType.BOOK:
default: {
return {
...r,
canRemove: true,
};
}
}
});
}

View File

@@ -20,7 +20,7 @@ const messages = defineMessages('components.Discover', {
timeWindowWeek: 'Weekly',
});
type MediaType = 'all' | 'movie' | 'tv';
type MediaType = 'all' | 'movie' | 'tv' | 'music' | 'book';
type TimeWindow = 'day' | 'week';

View File

@@ -12,7 +12,7 @@ import useSettings from '@app/hooks/useSettings';
import { MediaType } from '@server/constants/media';
import { MediaServerType } from '@server/constants/server';
type ExternalLinkType = 'movie' | 'tv' | 'person';
type ExternalLinkType = 'movie' | 'tv' | 'person' | 'music' | 'book';
interface ExternalLinkBlockProps {
mediaType: ExternalLinkType;

View File

@@ -12,7 +12,7 @@ const messages = defineMessages('components.IssueModal', {
interface IssueOption {
name: MessageDescriptor;
issueType: IssueType;
mediaType?: 'movie' | 'tv';
mediaType?: 'movie' | 'tv' | 'music' | 'book';
}
export const issueOptions: IssueOption[] = [

View File

@@ -27,7 +27,7 @@ const messages = defineMessages('components.PersonDetails', {
ascharacter: 'as {character}',
});
type MediaType = 'all' | 'movie' | 'tv';
type MediaType = 'all' | 'movie' | 'tv' | 'music' | 'book';
const PersonDetails = () => {
const intl = useIntl();

View File

@@ -29,7 +29,7 @@ interface StatusBadgeProps {
plexUrl?: string;
serviceUrl?: string;
tmdbId?: number;
mediaType?: 'movie' | 'tv';
mediaType?: 'movie' | 'tv' | 'music' | 'book';
title?: string | string[];
statusLabelOverride?: string;
}