Fix misc types

This commit is contained in:
jeffvli 2023-05-17 21:07:04 -07:00
parent ce72ff5e8d
commit 4cb54bc9da
5 changed files with 42 additions and 31 deletions

View file

@ -524,19 +524,21 @@ const jfSongListSort = {
RELEASE_DATE: 'PremiereDate,AlbumArtist,Album,SortName', RELEASE_DATE: 'PremiereDate,AlbumArtist,Album,SortName',
} as const; } as const;
const songListParameters = baseParameters.extend({ const songListParameters = paginationParameters.merge(
AlbumArtistIds: z.string().optional(), baseParameters.extend({
AlbumIds: z.string().optional(), AlbumArtistIds: z.string().optional(),
ArtistIds: z.string().optional(), AlbumIds: z.string().optional(),
Filters: z.string().optional(), ArtistIds: z.string().optional(),
GenreIds: z.string().optional(), Filters: z.string().optional(),
Genres: z.string().optional(), GenreIds: z.string().optional(),
IsFavorite: z.boolean().optional(), Genres: z.string().optional(),
SearchTerm: z.string().optional(), IsFavorite: z.boolean().optional(),
SortBy: z.nativeEnum(jfSongListSort).optional(), SearchTerm: z.string().optional(),
Tags: z.string().optional(), SortBy: z.nativeEnum(jfSongListSort).optional(),
Years: z.string().optional(), Tags: z.string().optional(),
}); Years: z.string().optional(),
}),
);
const songList = pagination.extend({ const songList = pagination.extend({
Items: z.array(song), Items: z.array(song),

View file

@ -156,6 +156,7 @@ const albumListParameters = paginationParameters.extend({
id: z.string().optional(), id: z.string().optional(),
name: z.string().optional(), name: z.string().optional(),
recently_added: z.boolean().optional(), recently_added: z.boolean().optional(),
recently_played: z.boolean().optional(),
starred: z.boolean().optional(), starred: z.boolean().optional(),
year: z.number().optional(), year: z.number().optional(),
}); });
@ -236,6 +237,8 @@ const songListParameters = paginationParameters.extend({
artist_id: z.array(z.string()).optional(), artist_id: z.array(z.string()).optional(),
genre_id: z.string().optional(), genre_id: z.string().optional(),
starred: z.boolean().optional(), starred: z.boolean().optional(),
title: z.string().optional(),
year: z.number().optional(),
}); });
const playlist = z.object({ const playlist = z.object({

View file

@ -316,7 +316,10 @@ export enum AlbumListSort {
export type AlbumListQuery = { export type AlbumListQuery = {
_custom?: { _custom?: {
jellyfin?: Partial<z.infer<typeof jfType._parameters.albumList>>; jellyfin?: Partial<z.infer<typeof jfType._parameters.albumList>> & {
maxYear?: number;
minYear?: number;
};
navidrome?: Partial<z.infer<typeof ndType._parameters.albumList>>; navidrome?: Partial<z.infer<typeof ndType._parameters.albumList>>;
}; };
artistIds?: string[]; artistIds?: string[];
@ -423,7 +426,10 @@ export enum SongListSort {
export type SongListQuery = { export type SongListQuery = {
_custom?: { _custom?: {
jellyfin?: Partial<z.infer<typeof jfType._parameters.songList>>; jellyfin?: Partial<z.infer<typeof jfType._parameters.songList>> & {
maxYear?: number;
minYear?: number;
};
navidrome?: Partial<z.infer<typeof ndType._parameters.songList>>; navidrome?: Partial<z.infer<typeof ndType._parameters.songList>>;
}; };
albumIds?: string[]; albumIds?: string[];

View file

@ -37,8 +37,8 @@ export const JellyfinAlbumFilters = ({
}, [genreListQuery.data]); }, [genreListQuery.data]);
const selectedGenres = useMemo(() => { const selectedGenres = useMemo(() => {
return filter._custom?.jellyfin?.genreIds?.split(','); return filter._custom?.jellyfin?.GenreIds?.split(',');
}, [filter._custom?.jellyfin?.genreIds]); }, [filter._custom?.jellyfin?.GenreIds]);
const toggleFilters = [ const toggleFilters = [
{ {
@ -50,7 +50,7 @@ export const JellyfinAlbumFilters = ({
...filter._custom, ...filter._custom,
jellyfin: { jellyfin: {
...filter._custom?.jellyfin, ...filter._custom?.jellyfin,
isFavorite: e.currentTarget.checked ? true : undefined, IsFavorite: e.currentTarget.checked ? true : undefined,
}, },
}, },
}, },
@ -58,7 +58,7 @@ export const JellyfinAlbumFilters = ({
}) as AlbumListFilter; }) as AlbumListFilter;
handleFilterChange(updatedFilters); handleFilterChange(updatedFilters);
}, },
value: filter._custom?.jellyfin?.isFavorite, value: filter._custom?.jellyfin?.IsFavorite,
}, },
]; ];
@ -104,7 +104,7 @@ export const JellyfinAlbumFilters = ({
...filter._custom, ...filter._custom,
jellyfin: { jellyfin: {
...filter._custom?.jellyfin, ...filter._custom?.jellyfin,
genreIds: genreFilterString, GenreIds: genreFilterString,
}, },
}, },
}, },
@ -145,7 +145,7 @@ export const JellyfinAlbumFilters = ({
...filter._custom, ...filter._custom,
jellyfin: { jellyfin: {
...filter._custom?.jellyfin, ...filter._custom?.jellyfin,
albumArtistIds: albumArtistFilterString, AlbumArtistIds: albumArtistFilterString,
}, },
}, },
}, },
@ -206,7 +206,7 @@ export const JellyfinAlbumFilters = ({
clearable clearable
searchable searchable
data={selectableAlbumArtists} data={selectableAlbumArtists}
defaultValue={filter._custom?.jellyfin?.albumArtistIds?.split(',')} defaultValue={filter._custom?.jellyfin?.AlbumArtistIds?.split(',')}
disabled={disableArtistFilter} disabled={disableArtistFilter}
label="Artist" label="Artist"
limit={300} limit={300}

View file

@ -33,8 +33,8 @@ export const JellyfinSongFilters = ({
}, [genreListQuery.data]); }, [genreListQuery.data]);
const selectedGenres = useMemo(() => { const selectedGenres = useMemo(() => {
return filter._custom?.jellyfin?.genreIds?.split(','); return filter._custom?.jellyfin?.GenreIds?.split(',');
}, [filter._custom?.jellyfin?.genreIds]); }, [filter._custom?.jellyfin?.GenreIds]);
const toggleFilters = [ const toggleFilters = [
{ {
@ -46,8 +46,8 @@ export const JellyfinSongFilters = ({
...filter._custom, ...filter._custom,
jellyfin: { jellyfin: {
...filter._custom?.jellyfin, ...filter._custom?.jellyfin,
includeItemTypes: 'Audio', IncludeItemTypes: 'Audio',
isFavorite: e.currentTarget.checked ? true : undefined, IsFavorite: e.currentTarget.checked ? true : undefined,
}, },
}, },
}, },
@ -55,7 +55,7 @@ export const JellyfinSongFilters = ({
}) as SongListFilter; }) as SongListFilter;
handleFilterChange(updatedFilters); handleFilterChange(updatedFilters);
}, },
value: filter._custom?.jellyfin?.isFavorite, value: filter._custom?.jellyfin?.IsFavorite,
}, },
]; ];
@ -67,7 +67,7 @@ export const JellyfinSongFilters = ({
...filter._custom, ...filter._custom,
jellyfin: { jellyfin: {
...filter._custom?.jellyfin, ...filter._custom?.jellyfin,
includeItemTypes: 'Audio', IncludeItemTypes: 'Audio',
minYear: e === '' ? undefined : (e as number), minYear: e === '' ? undefined : (e as number),
}, },
}, },
@ -85,7 +85,7 @@ export const JellyfinSongFilters = ({
...filter._custom, ...filter._custom,
jellyfin: { jellyfin: {
...filter._custom?.jellyfin, ...filter._custom?.jellyfin,
includeItemTypes: 'Audio', IncludeItemTypes: 'Audio',
maxYear: e === '' ? undefined : (e as number), maxYear: e === '' ? undefined : (e as number),
}, },
}, },
@ -103,8 +103,8 @@ export const JellyfinSongFilters = ({
...filter._custom, ...filter._custom,
jellyfin: { jellyfin: {
...filter._custom?.jellyfin, ...filter._custom?.jellyfin,
genreIds: genreFilterString, GenreIds: genreFilterString,
includeItemTypes: 'Audio', IncludeItemTypes: 'Audio',
}, },
}, },
}, },