diff --git a/src/renderer/features/albums/api/album-api.ts b/src/renderer/features/albums/api/album-api.ts index cb55b8ec..07d9e520 100644 --- a/src/renderer/features/albums/api/album-api.ts +++ b/src/renderer/features/albums/api/album-api.ts @@ -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) => { @@ -35,7 +35,7 @@ export const albumQueries = { ...args.options, }); }, - listCount: (args: QueryHookArgs) => { + listCount: (args: QueryHookArgs>) => { return queryOptions({ queryFn: ({ signal }) => { return api.controller.getAlbumListCount({ diff --git a/src/renderer/features/artists/api/artists-api.ts b/src/renderer/features/artists/api/artists-api.ts index 1136bae6..853a843c 100644 --- a/src/renderer/features/artists/api/artists-api.ts +++ b/src/renderer/features/artists/api/artists-api.ts @@ -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) => { + albumArtistListCount: (args: QueryHookArgs>) => { return queryOptions({ queryFn: ({ signal }) => { return api.controller.getAlbumArtistListCount({ @@ -51,7 +52,7 @@ export const artistsQueries = { ...args.options, }); }, - artistListCount: (args: QueryHookArgs) => { + artistListCount: (args: QueryHookArgs>) => { return queryOptions({ queryFn: ({ signal }) => { return api.controller.getArtistListCount({ diff --git a/src/renderer/features/songs/api/songs-api.ts b/src/renderer/features/songs/api/songs-api.ts index 9b64bfd4..351bc007 100644 --- a/src/renderer/features/songs/api/songs-api.ts +++ b/src/renderer/features/songs/api/songs-api.ts @@ -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, imageSize?: number) => { @@ -22,7 +22,7 @@ export const songsQueries = { ...args.options, }); }, - listCount: (args: QueryHookArgs) => { + listCount: (args: QueryHookArgs>) => { return queryOptions({ queryFn: ({ signal }) => { const server = getServerById(args.serverId); diff --git a/src/shared/types/domain-types.ts b/src/shared/types/domain-types.ts index dfae356b..baeb3550 100644 --- a/src/shared/types/domain-types.ts +++ b/src/shared/types/domain-types.ts @@ -416,6 +416,8 @@ export enum AlbumListSort { export type AlbumListArgs = BaseEndpointArgs & { query: AlbumListQuery }; +export type AlbumListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; + export interface AlbumListQuery extends BaseQuery { _custom?: { jellyfin?: Partial>; @@ -436,6 +438,8 @@ export interface AlbumListQuery extends BaseQuery { // Album List export type AlbumListResponse = BasePaginatedResponse; +export type ListCountQuery = Omit; + type AlbumListSortMap = { jellyfin: Record; navidrome: Record; @@ -536,6 +540,8 @@ export type AlbumInfo = { export type SongListArgs = BaseEndpointArgs & { query: SongListQuery }; +export type SongListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; + export interface SongListQuery extends BaseQuery { _custom?: { jellyfin?: Partial>; @@ -647,6 +653,10 @@ export enum AlbumArtistListSort { export type AlbumArtistListArgs = BaseEndpointArgs & { query: AlbumArtistListQuery }; +export type AlbumArtistListCountArgs = BaseEndpointArgs & { + query: ListCountQuery; +}; + export interface AlbumArtistListQuery extends BaseQuery { _custom?: { jellyfin?: Partial>; @@ -740,6 +750,8 @@ export type AlbumArtistDetailResponse = AlbumArtist | null; export type ArtistListArgs = BaseEndpointArgs & { query: ArtistListQuery }; +export type ArtistListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; + export interface ArtistListQuery extends BaseQuery { _custom?: { jellyfin?: Partial>; @@ -872,6 +884,8 @@ export type FavoriteResponse = null | undefined; export type PlaylistListArgs = BaseEndpointArgs & { query: PlaylistListQuery }; +export type PlaylistListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; + export interface PlaylistListQuery extends BaseQuery { _custom?: { jellyfin?: Partial>; @@ -1004,6 +1018,10 @@ export type PlaylistDetailResponse = Playlist; export type PlaylistSongListArgs = BaseEndpointArgs & { query: PlaylistSongListQuery }; +export type PlaylistSongListCountArgs = BaseEndpointArgs & { + query: ListCountQuery; +}; + export type PlaylistSongListQuery = { id: string; }; @@ -1207,21 +1225,21 @@ export type ControllerEndpoint = { deletePlaylist: (args: DeletePlaylistArgs) => Promise; getAlbumArtistDetail: (args: AlbumArtistDetailArgs) => Promise; getAlbumArtistList: (args: AlbumArtistListArgs) => Promise; - getAlbumArtistListCount: (args: AlbumArtistListArgs) => Promise; + getAlbumArtistListCount: (args: AlbumArtistListCountArgs) => Promise; getAlbumDetail: (args: AlbumDetailArgs) => Promise; getAlbumInfo?: (args: AlbumDetailArgs) => Promise; getAlbumList: (args: AlbumListArgs) => Promise; - getAlbumListCount: (args: AlbumListArgs) => Promise; + getAlbumListCount: (args: AlbumListCountArgs) => Promise; // getArtistInfo?: (args: any) => void; getArtistList: (args: ArtistListArgs) => Promise; - getArtistListCount: (args: ArtistListArgs) => Promise; + getArtistListCount: (args: ArtistListCountArgs) => Promise; getDownloadUrl: (args: DownloadArgs) => string; getGenreList: (args: GenreListArgs) => Promise; getLyrics?: (args: LyricsArgs) => Promise; getMusicFolderList: (args: MusicFolderListArgs) => Promise; getPlaylistDetail: (args: PlaylistDetailArgs) => Promise; getPlaylistList: (args: PlaylistListArgs) => Promise; - getPlaylistListCount: (args: PlaylistListArgs) => Promise; + getPlaylistListCount: (args: PlaylistListCountArgs) => Promise; getPlaylistSongList: (args: PlaylistSongListArgs) => Promise; getRandomSongList: (args: RandomSongListArgs) => Promise; getRoles: (args: BaseEndpointArgs) => Promise>; @@ -1229,7 +1247,7 @@ export type ControllerEndpoint = { getSimilarSongs: (args: SimilarSongsArgs) => Promise; getSongDetail: (args: SongDetailArgs) => Promise; getSongList: (args: SongListArgs) => Promise; - getSongListCount: (args: SongListArgs) => Promise; + getSongListCount: (args: SongListCountArgs) => Promise; getStructuredLyrics?: (args: StructuredLyricsArgs) => Promise; getTags?: (args: TagArgs) => Promise; getTopSongs: (args: TopSongListArgs) => Promise;