mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 13:40:24 +02:00
remove typed _custom query
This commit is contained in:
@@ -326,7 +326,7 @@ export const JellyfinController: InternalControllerEndpoint = {
|
|||||||
SortBy: albumListSortMap.jellyfin[query.sortBy] || 'SortName',
|
SortBy: albumListSortMap.jellyfin[query.sortBy] || 'SortName',
|
||||||
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
||||||
StartIndex: query.startIndex,
|
StartIndex: query.startIndex,
|
||||||
...query._custom?.jellyfin,
|
...query._custom,
|
||||||
Years: yearsFilter,
|
Years: yearsFilter,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -748,7 +748,7 @@ export const JellyfinController: InternalControllerEndpoint = {
|
|||||||
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
|
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
|
||||||
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
||||||
StartIndex: query.startIndex,
|
StartIndex: query.startIndex,
|
||||||
...query._custom?.jellyfin,
|
...query._custom,
|
||||||
Years: yearsFilter,
|
Years: yearsFilter,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -783,7 +783,7 @@ export const JellyfinController: InternalControllerEndpoint = {
|
|||||||
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
|
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
|
||||||
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
||||||
StartIndex: query.startIndex,
|
StartIndex: query.startIndex,
|
||||||
...query._custom?.jellyfin,
|
...query._custom,
|
||||||
Years: yearsFilter,
|
Years: yearsFilter,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -111,8 +111,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
comment: body.comment,
|
comment: body.comment,
|
||||||
name: body.name,
|
name: body.name,
|
||||||
public: body.public,
|
public: body.public,
|
||||||
rules: body._custom?.navidrome?.rules,
|
...body._custom,
|
||||||
sync: body._custom?.navidrome?.sync,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -191,7 +190,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
_sort: albumArtistListSortMap.navidrome[query.sortBy],
|
_sort: albumArtistListSortMap.navidrome[query.sortBy],
|
||||||
_start: query.startIndex,
|
_start: query.startIndex,
|
||||||
name: query.searchTerm,
|
name: query.searchTerm,
|
||||||
...query._custom?.navidrome,
|
...query._custom,
|
||||||
role: hasFeature(apiClientProps.server, ServerFeature.BFR) ? 'albumartist' : '',
|
role: hasFeature(apiClientProps.server, ServerFeature.BFR) ? 'albumartist' : '',
|
||||||
...excludeMissing(apiClientProps.server),
|
...excludeMissing(apiClientProps.server),
|
||||||
},
|
},
|
||||||
@@ -289,7 +288,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
compilation: query.compilation,
|
compilation: query.compilation,
|
||||||
genre_id: genres,
|
genre_id: genres,
|
||||||
name: query.searchTerm,
|
name: query.searchTerm,
|
||||||
...query._custom?.navidrome,
|
...query._custom,
|
||||||
starred: query.favorite,
|
starred: query.favorite,
|
||||||
...excludeMissing(apiClientProps.server),
|
...excludeMissing(apiClientProps.server),
|
||||||
},
|
},
|
||||||
@@ -320,7 +319,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
_sort: albumArtistListSortMap.navidrome[query.sortBy],
|
_sort: albumArtistListSortMap.navidrome[query.sortBy],
|
||||||
_start: query.startIndex,
|
_start: query.startIndex,
|
||||||
name: query.searchTerm,
|
name: query.searchTerm,
|
||||||
...query._custom?.navidrome,
|
...query._custom,
|
||||||
role: query.role || undefined,
|
role: query.role || undefined,
|
||||||
...excludeMissing(apiClientProps.server),
|
...excludeMissing(apiClientProps.server),
|
||||||
},
|
},
|
||||||
@@ -395,7 +394,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
},
|
},
|
||||||
getPlaylistList: async (args) => {
|
getPlaylistList: async (args) => {
|
||||||
const { apiClientProps, query } = args;
|
const { apiClientProps, query } = args;
|
||||||
const customQuery = query._custom?.navidrome;
|
const customQuery = query._custom;
|
||||||
|
|
||||||
// Smart playlists only became available in 0.48.0. Do not filter for previous versions
|
// Smart playlists only became available in 0.48.0. Do not filter for previous versions
|
||||||
if (
|
if (
|
||||||
@@ -570,7 +569,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
[getArtistSongKey(apiClientProps.server)]: query.artistIds ?? query.albumArtistIds,
|
[getArtistSongKey(apiClientProps.server)]: query.artistIds ?? query.albumArtistIds,
|
||||||
starred: query.favorite,
|
starred: query.favorite,
|
||||||
title: query.searchTerm,
|
title: query.searchTerm,
|
||||||
...query._custom?.navidrome,
|
...query._custom,
|
||||||
...excludeMissing(apiClientProps.server),
|
...excludeMissing(apiClientProps.server),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -643,7 +642,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
_order: sortOrderMap.navidrome[query.sortOrder],
|
_order: sortOrderMap.navidrome[query.sortOrder],
|
||||||
_sort: userListSortMap.navidrome[query.sortBy],
|
_sort: userListSortMap.navidrome[query.sortBy],
|
||||||
_start: query.startIndex,
|
_start: query.startIndex,
|
||||||
...query._custom?.navidrome,
|
...query._custom,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -724,8 +723,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
comment: body.comment || '',
|
comment: body.comment || '',
|
||||||
name: body.name,
|
name: body.name,
|
||||||
public: body?.public || false,
|
public: body?.public || false,
|
||||||
rules: body._custom?.navidrome?.rules ? body._custom.navidrome.rules : undefined,
|
...body._custom,
|
||||||
sync: body._custom?.navidrome?.sync || undefined,
|
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
id: query.id,
|
id: query.id,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { Omit } from 'lodash';
|
|||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import reverse from 'lodash/reverse';
|
import reverse from 'lodash/reverse';
|
||||||
import shuffle from 'lodash/shuffle';
|
import shuffle from 'lodash/shuffle';
|
||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
JFAlbumArtistListSort,
|
JFAlbumArtistListSort,
|
||||||
@@ -12,7 +11,6 @@ import {
|
|||||||
JFPlaylistListSort,
|
JFPlaylistListSort,
|
||||||
JFSongListSort,
|
JFSongListSort,
|
||||||
JFSortOrder,
|
JFSortOrder,
|
||||||
jfType,
|
|
||||||
} from '/@/shared/api/jellyfin/jellyfin-types';
|
} from '/@/shared/api/jellyfin/jellyfin-types';
|
||||||
import {
|
import {
|
||||||
NDAlbumArtistListSort,
|
NDAlbumArtistListSort,
|
||||||
@@ -21,7 +19,6 @@ import {
|
|||||||
NDPlaylistListSort,
|
NDPlaylistListSort,
|
||||||
NDSongListSort,
|
NDSongListSort,
|
||||||
NDSortOrder,
|
NDSortOrder,
|
||||||
ndType,
|
|
||||||
NDUserListSort,
|
NDUserListSort,
|
||||||
} from '/@/shared/api/navidrome/navidrome-types';
|
} from '/@/shared/api/navidrome/navidrome-types';
|
||||||
import { ServerFeatures } from '/@/shared/types/features-types';
|
import { ServerFeatures } from '/@/shared/types/features-types';
|
||||||
@@ -428,11 +425,8 @@ export type AlbumListArgs = BaseEndpointArgs & { query: AlbumListQuery };
|
|||||||
|
|
||||||
export type AlbumListCountArgs = BaseEndpointArgs & { query: ListCountQuery<AlbumListQuery> };
|
export type AlbumListCountArgs = BaseEndpointArgs & { query: ListCountQuery<AlbumListQuery> };
|
||||||
|
|
||||||
export interface AlbumListQuery extends BaseQuery<AlbumListSort> {
|
export interface AlbumListQuery extends AlbumListNavidromeQuery, BaseQuery<AlbumListSort> {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
jellyfin?: Partial<z.infer<typeof jfType._parameters.albumList>>;
|
|
||||||
navidrome?: Partial<z.infer<typeof ndType._parameters.albumList>>;
|
|
||||||
};
|
|
||||||
artistIds?: string[];
|
artistIds?: string[];
|
||||||
compilation?: boolean;
|
compilation?: boolean;
|
||||||
favorite?: boolean;
|
favorite?: boolean;
|
||||||
@@ -450,6 +444,11 @@ export type AlbumListResponse = BasePaginatedResponse<Album[]>;
|
|||||||
|
|
||||||
export type ListCountQuery<TQuery> = Omit<TQuery, 'limit' | 'startIndex'>;
|
export type ListCountQuery<TQuery> = Omit<TQuery, 'limit' | 'startIndex'>;
|
||||||
|
|
||||||
|
interface AlbumListNavidromeQuery {
|
||||||
|
hasRating?: boolean;
|
||||||
|
isRecentlyPlayed?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
type AlbumListSortMap = {
|
type AlbumListSortMap = {
|
||||||
jellyfin: Record<AlbumListSort, JFAlbumListSort | undefined>;
|
jellyfin: Record<AlbumListSort, JFAlbumListSort | undefined>;
|
||||||
navidrome: Record<AlbumListSort, NDAlbumListSort | undefined>;
|
navidrome: Record<AlbumListSort, NDAlbumListSort | undefined>;
|
||||||
@@ -553,10 +552,7 @@ export type SongListArgs = BaseEndpointArgs & { query: SongListQuery };
|
|||||||
export type SongListCountArgs = BaseEndpointArgs & { query: ListCountQuery<SongListQuery> };
|
export type SongListCountArgs = BaseEndpointArgs & { query: ListCountQuery<SongListQuery> };
|
||||||
|
|
||||||
export interface SongListQuery extends BaseQuery<SongListSort> {
|
export interface SongListQuery extends BaseQuery<SongListSort> {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
jellyfin?: Partial<z.infer<typeof jfType._parameters.songList>>;
|
|
||||||
navidrome?: Partial<z.infer<typeof ndType._parameters.songList>>;
|
|
||||||
};
|
|
||||||
albumArtistIds?: string[];
|
albumArtistIds?: string[];
|
||||||
albumIds?: string[];
|
albumIds?: string[];
|
||||||
artistIds?: string[];
|
artistIds?: string[];
|
||||||
@@ -668,10 +664,7 @@ export type AlbumArtistListCountArgs = BaseEndpointArgs & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export interface AlbumArtistListQuery extends BaseQuery<AlbumArtistListSort> {
|
export interface AlbumArtistListQuery extends BaseQuery<AlbumArtistListSort> {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
jellyfin?: Partial<z.infer<typeof jfType._parameters.albumArtistList>>;
|
|
||||||
navidrome?: Partial<z.infer<typeof ndType._parameters.albumArtistList>>;
|
|
||||||
};
|
|
||||||
limit?: number;
|
limit?: number;
|
||||||
musicFolderId?: string;
|
musicFolderId?: string;
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
@@ -763,10 +756,7 @@ export type ArtistListArgs = BaseEndpointArgs & { query: ArtistListQuery };
|
|||||||
export type ArtistListCountArgs = BaseEndpointArgs & { query: ListCountQuery<ArtistListQuery> };
|
export type ArtistListCountArgs = BaseEndpointArgs & { query: ListCountQuery<ArtistListQuery> };
|
||||||
|
|
||||||
export interface ArtistListQuery extends BaseQuery<ArtistListSort> {
|
export interface ArtistListQuery extends BaseQuery<ArtistListSort> {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
jellyfin?: Partial<z.infer<typeof jfType._parameters.albumArtistList>>;
|
|
||||||
navidrome?: Partial<z.infer<typeof ndType._parameters.albumArtistList>>;
|
|
||||||
};
|
|
||||||
limit?: number;
|
limit?: number;
|
||||||
musicFolderId?: string;
|
musicFolderId?: string;
|
||||||
role?: string;
|
role?: string;
|
||||||
@@ -855,14 +845,7 @@ export type AddToPlaylistResponse = null | undefined;
|
|||||||
export type CreatePlaylistArgs = BaseEndpointArgs & { body: CreatePlaylistBody };
|
export type CreatePlaylistArgs = BaseEndpointArgs & { body: CreatePlaylistBody };
|
||||||
|
|
||||||
export type CreatePlaylistBody = {
|
export type CreatePlaylistBody = {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
navidrome?: {
|
|
||||||
owner?: string;
|
|
||||||
ownerId?: string;
|
|
||||||
rules?: Record<string, any>;
|
|
||||||
sync?: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
comment?: string;
|
comment?: string;
|
||||||
name: string;
|
name: string;
|
||||||
public?: boolean;
|
public?: boolean;
|
||||||
@@ -895,10 +878,7 @@ export type PlaylistListArgs = BaseEndpointArgs & { query: PlaylistListQuery };
|
|||||||
export type PlaylistListCountArgs = BaseEndpointArgs & { query: ListCountQuery<PlaylistListQuery> };
|
export type PlaylistListCountArgs = BaseEndpointArgs & { query: ListCountQuery<PlaylistListQuery> };
|
||||||
|
|
||||||
export interface PlaylistListQuery extends BaseQuery<PlaylistListSort> {
|
export interface PlaylistListQuery extends BaseQuery<PlaylistListSort> {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
jellyfin?: Partial<z.infer<typeof jfType._parameters.playlistList>>;
|
|
||||||
navidrome?: Partial<z.infer<typeof ndType._parameters.playlistList>>;
|
|
||||||
};
|
|
||||||
limit?: number;
|
limit?: number;
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
startIndex: number;
|
startIndex: number;
|
||||||
@@ -948,14 +928,7 @@ export type UpdatePlaylistArgs = BaseEndpointArgs & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type UpdatePlaylistBody = {
|
export type UpdatePlaylistBody = {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
navidrome?: {
|
|
||||||
owner?: string;
|
|
||||||
ownerId?: string;
|
|
||||||
rules?: Record<string, any>;
|
|
||||||
sync?: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
comment?: string;
|
comment?: string;
|
||||||
genres?: Genre[];
|
genres?: Genre[];
|
||||||
name: string;
|
name: string;
|
||||||
@@ -1043,11 +1016,7 @@ export type PlaylistSongListResponse = BasePaginatedResponse<Song[]>;
|
|||||||
export type UserListArgs = BaseEndpointArgs & { query: UserListQuery };
|
export type UserListArgs = BaseEndpointArgs & { query: UserListQuery };
|
||||||
|
|
||||||
export interface UserListQuery extends BaseQuery<UserListSort> {
|
export interface UserListQuery extends BaseQuery<UserListSort> {
|
||||||
_custom?: {
|
_custom?: Record<string, any>;
|
||||||
navidrome?: {
|
|
||||||
owner_id?: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
limit?: number;
|
limit?: number;
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
startIndex: number;
|
startIndex: number;
|
||||||
@@ -1514,7 +1483,7 @@ export const sortAlbumList = (albums: Album[], sortBy: AlbumListSort, sortOrder:
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sortSongList = (songs: QueueSong[], sortBy: SongListSort, sortOrder: SortOrder) => {
|
export const sortSongList = (songs: Song[], sortBy: SongListSort, sortOrder: SortOrder) => {
|
||||||
let results = songs;
|
let results = songs;
|
||||||
|
|
||||||
const order = sortOrder === SortOrder.ASC ? 'asc' : 'desc';
|
const order = sortOrder === SortOrder.ASC ? 'asc' : 'desc';
|
||||||
|
|||||||
Reference in New Issue
Block a user