feishin/src/renderer/api/query-keys.ts

51 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-12-30 21:04:06 -08:00
import type {
AlbumListQuery,
SongListQuery,
AlbumDetailQuery,
AlbumArtistListQuery,
ArtistListQuery,
2022-12-31 03:46:12 -08:00
PlaylistListQuery,
2022-12-30 21:04:06 -08:00
} from './types';
2022-12-19 15:59:14 -08:00
export const queryKeys = {
2022-12-30 21:04:06 -08:00
albumArtists: {
list: (serverId: string, query?: AlbumArtistListQuery) =>
[serverId, 'albumArtists', 'list', query] as const,
root: (serverId: string) => [serverId, 'albumArtists'] as const,
},
2022-12-19 15:59:14 -08:00
albums: {
2022-12-30 21:04:06 -08:00
detail: (serverId: string, query?: AlbumDetailQuery) =>
2022-12-19 15:59:14 -08:00
[serverId, 'albums', 'detail', query] as const,
2022-12-30 21:04:06 -08:00
list: (serverId: string, query?: AlbumListQuery) =>
[serverId, 'albums', 'list', query] as const,
root: (serverId: string) => [serverId, 'albums'],
2022-12-19 15:59:14 -08:00
serverRoot: (serverId: string) => [serverId, 'albums'],
songs: (serverId: string, query: SongListQuery) =>
[serverId, 'albums', 'songs', query] as const,
},
2022-12-30 21:04:06 -08:00
artists: {
list: (serverId: string, query?: ArtistListQuery) =>
[serverId, 'artists', 'list', query] as const,
root: (serverId: string) => [serverId, 'artists'] as const,
},
2022-12-19 15:59:14 -08:00
genres: {
list: (serverId: string) => [serverId, 'genres', 'list'] as const,
root: (serverId: string) => [serverId, 'genres'] as const,
},
2022-12-20 19:11:33 -08:00
musicFolders: {
list: (serverId: string) => [serverId, 'musicFolders', 'list'] as const,
},
2022-12-31 03:46:12 -08:00
playlists: {
list: (serverId: string, query?: PlaylistListQuery) =>
[serverId, 'playlists', 'list', query] as const,
root: (serverId: string) => [serverId, 'playlists'] as const,
},
2022-12-19 15:59:14 -08:00
server: {
root: (serverId: string) => [serverId] as const,
},
songs: {
2022-12-30 21:04:06 -08:00
list: (serverId: string, query?: SongListQuery) => [serverId, 'songs', 'list', query] as const,
root: (serverId: string) => [serverId, 'songs'] as const,
2022-12-19 15:59:14 -08:00
},
};