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