mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
remove limit / startIndex from count query args
This commit is contained in:
parent
78fb9b5ab7
commit
abd1d55f23
4 changed files with 30 additions and 11 deletions
|
|
@ -4,7 +4,7 @@ import { api } from '/@/renderer/api';
|
|||
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||
import { QueryHookArgs } from '/@/renderer/lib/react-query';
|
||||
import { getServerById } from '/@/renderer/store';
|
||||
import { AlbumDetailQuery, AlbumListQuery } from '/@/shared/types/domain-types';
|
||||
import { AlbumDetailQuery, AlbumListQuery, ListCountQuery } from '/@/shared/types/domain-types';
|
||||
|
||||
export const albumQueries = {
|
||||
detail: (args: QueryHookArgs<AlbumDetailQuery>) => {
|
||||
|
|
@ -35,7 +35,7 @@ export const albumQueries = {
|
|||
...args.options,
|
||||
});
|
||||
},
|
||||
listCount: (args: QueryHookArgs<AlbumListQuery>) => {
|
||||
listCount: (args: QueryHookArgs<ListCountQuery<AlbumListQuery>>) => {
|
||||
return queryOptions({
|
||||
queryFn: ({ signal }) => {
|
||||
return api.controller.getAlbumListCount({
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
AlbumArtistDetailQuery,
|
||||
AlbumArtistListQuery,
|
||||
ArtistListQuery,
|
||||
ListCountQuery,
|
||||
TopSongListQuery,
|
||||
} from '/@/shared/types/domain-types';
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ export const artistsQueries = {
|
|||
...args.options,
|
||||
});
|
||||
},
|
||||
albumArtistListCount: (args: QueryHookArgs<AlbumArtistListQuery>) => {
|
||||
albumArtistListCount: (args: QueryHookArgs<ListCountQuery<AlbumArtistListQuery>>) => {
|
||||
return queryOptions({
|
||||
queryFn: ({ signal }) => {
|
||||
return api.controller.getAlbumArtistListCount({
|
||||
|
|
@ -51,7 +52,7 @@ export const artistsQueries = {
|
|||
...args.options,
|
||||
});
|
||||
},
|
||||
artistListCount: (args: QueryHookArgs<ArtistListQuery>) => {
|
||||
artistListCount: (args: QueryHookArgs<ListCountQuery<ArtistListQuery>>) => {
|
||||
return queryOptions({
|
||||
queryFn: ({ signal }) => {
|
||||
return api.controller.getArtistListCount({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { controller } from '/@/renderer/api/controller';
|
|||
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||
import { QueryHookArgs } from '/@/renderer/lib/react-query';
|
||||
import { getServerById } from '/@/renderer/store';
|
||||
import { SimilarSongsQuery, SongListQuery } from '/@/shared/types/domain-types';
|
||||
import { ListCountQuery, SimilarSongsQuery, SongListQuery } from '/@/shared/types/domain-types';
|
||||
|
||||
export const songsQueries = {
|
||||
list: (args: QueryHookArgs<SongListQuery>, imageSize?: number) => {
|
||||
|
|
@ -22,7 +22,7 @@ export const songsQueries = {
|
|||
...args.options,
|
||||
});
|
||||
},
|
||||
listCount: (args: QueryHookArgs<SongListQuery>) => {
|
||||
listCount: (args: QueryHookArgs<ListCountQuery<SongListQuery>>) => {
|
||||
return queryOptions({
|
||||
queryFn: ({ signal }) => {
|
||||
const server = getServerById(args.serverId);
|
||||
|
|
|
|||
|
|
@ -416,6 +416,8 @@ export enum AlbumListSort {
|
|||
|
||||
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>>;
|
||||
|
|
@ -436,6 +438,8 @@ export interface AlbumListQuery extends BaseQuery<AlbumListSort> {
|
|||
// Album List
|
||||
export type AlbumListResponse = BasePaginatedResponse<Album[]>;
|
||||
|
||||
export type ListCountQuery<TQuery> = Omit<TQuery, 'limit' | 'startIndex'>;
|
||||
|
||||
type AlbumListSortMap = {
|
||||
jellyfin: Record<AlbumListSort, JFAlbumListSort | undefined>;
|
||||
navidrome: Record<AlbumListSort, NDAlbumListSort | undefined>;
|
||||
|
|
@ -536,6 +540,8 @@ export type AlbumInfo = {
|
|||
|
||||
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>>;
|
||||
|
|
@ -647,6 +653,10 @@ export enum AlbumArtistListSort {
|
|||
|
||||
export type AlbumArtistListArgs = BaseEndpointArgs & { query: AlbumArtistListQuery };
|
||||
|
||||
export type AlbumArtistListCountArgs = BaseEndpointArgs & {
|
||||
query: ListCountQuery<AlbumArtistListQuery>;
|
||||
};
|
||||
|
||||
export interface AlbumArtistListQuery extends BaseQuery<AlbumArtistListSort> {
|
||||
_custom?: {
|
||||
jellyfin?: Partial<z.infer<typeof jfType._parameters.albumArtistList>>;
|
||||
|
|
@ -740,6 +750,8 @@ export type AlbumArtistDetailResponse = AlbumArtist | null;
|
|||
|
||||
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>>;
|
||||
|
|
@ -872,6 +884,8 @@ export type FavoriteResponse = null | undefined;
|
|||
|
||||
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>>;
|
||||
|
|
@ -1004,6 +1018,10 @@ export type PlaylistDetailResponse = Playlist;
|
|||
|
||||
export type PlaylistSongListArgs = BaseEndpointArgs & { query: PlaylistSongListQuery };
|
||||
|
||||
export type PlaylistSongListCountArgs = BaseEndpointArgs & {
|
||||
query: ListCountQuery<PlaylistSongListQuery>;
|
||||
};
|
||||
|
||||
export type PlaylistSongListQuery = {
|
||||
id: string;
|
||||
};
|
||||
|
|
@ -1207,21 +1225,21 @@ export type ControllerEndpoint = {
|
|||
deletePlaylist: (args: DeletePlaylistArgs) => Promise<DeletePlaylistResponse>;
|
||||
getAlbumArtistDetail: (args: AlbumArtistDetailArgs) => Promise<AlbumArtistDetailResponse>;
|
||||
getAlbumArtistList: (args: AlbumArtistListArgs) => Promise<AlbumArtistListResponse>;
|
||||
getAlbumArtistListCount: (args: AlbumArtistListArgs) => Promise<number>;
|
||||
getAlbumArtistListCount: (args: AlbumArtistListCountArgs) => Promise<number>;
|
||||
getAlbumDetail: (args: AlbumDetailArgs) => Promise<AlbumDetailResponse>;
|
||||
getAlbumInfo?: (args: AlbumDetailArgs) => Promise<AlbumInfo>;
|
||||
getAlbumList: (args: AlbumListArgs) => Promise<AlbumListResponse>;
|
||||
getAlbumListCount: (args: AlbumListArgs) => Promise<number>;
|
||||
getAlbumListCount: (args: AlbumListCountArgs) => Promise<number>;
|
||||
// getArtistInfo?: (args: any) => void;
|
||||
getArtistList: (args: ArtistListArgs) => Promise<ArtistListResponse>;
|
||||
getArtistListCount: (args: ArtistListArgs) => Promise<number>;
|
||||
getArtistListCount: (args: ArtistListCountArgs) => Promise<number>;
|
||||
getDownloadUrl: (args: DownloadArgs) => string;
|
||||
getGenreList: (args: GenreListArgs) => Promise<GenreListResponse>;
|
||||
getLyrics?: (args: LyricsArgs) => Promise<LyricsResponse>;
|
||||
getMusicFolderList: (args: MusicFolderListArgs) => Promise<MusicFolderListResponse>;
|
||||
getPlaylistDetail: (args: PlaylistDetailArgs) => Promise<PlaylistDetailResponse>;
|
||||
getPlaylistList: (args: PlaylistListArgs) => Promise<PlaylistListResponse>;
|
||||
getPlaylistListCount: (args: PlaylistListArgs) => Promise<number>;
|
||||
getPlaylistListCount: (args: PlaylistListCountArgs) => Promise<number>;
|
||||
getPlaylistSongList: (args: PlaylistSongListArgs) => Promise<SongListResponse>;
|
||||
getRandomSongList: (args: RandomSongListArgs) => Promise<SongListResponse>;
|
||||
getRoles: (args: BaseEndpointArgs) => Promise<Array<string | { label: string; value: string }>>;
|
||||
|
|
@ -1229,7 +1247,7 @@ export type ControllerEndpoint = {
|
|||
getSimilarSongs: (args: SimilarSongsArgs) => Promise<Song[]>;
|
||||
getSongDetail: (args: SongDetailArgs) => Promise<SongDetailResponse>;
|
||||
getSongList: (args: SongListArgs) => Promise<SongListResponse>;
|
||||
getSongListCount: (args: SongListArgs) => Promise<number>;
|
||||
getSongListCount: (args: SongListCountArgs) => Promise<number>;
|
||||
getStructuredLyrics?: (args: StructuredLyricsArgs) => Promise<StructuredLyric[]>;
|
||||
getTags?: (args: TagArgs) => Promise<TagResponses>;
|
||||
getTopSongs: (args: TopSongListArgs) => Promise<TopSongListResponse>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue