mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 04:50:12 +02:00
use tags list for Navidrome genres to support counts
This commit is contained in:
@@ -442,18 +442,18 @@ const normalizePlaylist = (
|
||||
};
|
||||
|
||||
const normalizeGenre = (
|
||||
item: z.infer<typeof ndType._response.genre>,
|
||||
item: z.infer<typeof ndType._response.genre> & { albumCount?: number; songCount?: number },
|
||||
server: null | ServerListItem,
|
||||
): Genre => {
|
||||
return {
|
||||
_itemType: LibraryItem.GENRE,
|
||||
_serverId: server?.id || 'unknown',
|
||||
_serverType: ServerType.NAVIDROME,
|
||||
albumCount: null,
|
||||
albumCount: item.albumCount ?? null,
|
||||
id: item.id,
|
||||
imageUrl: null,
|
||||
name: item.name,
|
||||
songCount: null,
|
||||
songCount: item.songCount ?? null,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -235,6 +235,8 @@ const paginationParameters = z.object({
|
||||
_start: z.number().optional(),
|
||||
});
|
||||
|
||||
const optionalPaginationParameters = paginationParameters.partial();
|
||||
|
||||
const authenticate = z.object({
|
||||
id: z.string(),
|
||||
isAdmin: z.boolean(),
|
||||
@@ -578,7 +580,18 @@ const tag = z.object({
|
||||
tagValue: z.string(),
|
||||
});
|
||||
|
||||
const tags = z.array(tag);
|
||||
const tagList = z.array(tag);
|
||||
|
||||
export enum NDTagListSort {
|
||||
TAG_VALUE = 'tagValue',
|
||||
}
|
||||
|
||||
const tagListParameters = optionalPaginationParameters.extend({
|
||||
_sort: z.nativeEnum(NDTagListSort).optional(),
|
||||
library_id: z.array(z.string()).optional(),
|
||||
tag_name: z.string().optional(),
|
||||
tag_value: z.string().optional(), // Search
|
||||
});
|
||||
|
||||
export const ndType = {
|
||||
_enum: {
|
||||
@@ -587,6 +600,7 @@ export const ndType = {
|
||||
genreList: genreListSort,
|
||||
playlistList: NDPlaylistListSort,
|
||||
songList: NDSongListSort,
|
||||
tagList: NDTagListSort,
|
||||
userList: ndUserListSort,
|
||||
},
|
||||
_parameters: {
|
||||
@@ -601,6 +615,7 @@ export const ndType = {
|
||||
removeFromPlaylist: removeFromPlaylistParameters,
|
||||
shareItem: shareItemParameters,
|
||||
songList: songListParameters,
|
||||
tagList: tagListParameters,
|
||||
updatePlaylist: updatePlaylistParameters,
|
||||
userList: userListParameters,
|
||||
},
|
||||
@@ -625,7 +640,7 @@ export const ndType = {
|
||||
shareItem,
|
||||
song,
|
||||
songList,
|
||||
tags,
|
||||
tagList,
|
||||
updatePlaylist,
|
||||
user,
|
||||
userList,
|
||||
|
||||
Reference in New Issue
Block a user