Additional refactor for navidrome api controller types

This commit is contained in:
jeffvli 2023-04-30 17:55:23 -07:00
parent b9d5447b4f
commit 40aabd2217
7 changed files with 53 additions and 48 deletions

View file

@ -49,7 +49,7 @@ const authenticate = async (
): Promise<AuthenticationResponse> => {
const cleanServerUrl = url.replace(/\/$/, '');
const res = await ndApiClient({ url: cleanServerUrl }).authenticate({
const res = await ndApiClient({ server: null, url: cleanServerUrl }).authenticate({
body: {
password: body.password,
username: body.username,
@ -148,10 +148,6 @@ const getAlbumArtistList = async (args: AlbumArtistListArgs): Promise<AlbumArtis
throw new Error('Failed to get album artist list');
}
if (!apiClientProps.server) {
throw new Error('Server is required');
}
return {
items: res.body.data.map((albumArtist) =>
ndNormalize.albumArtist(albumArtist, apiClientProps.server),
@ -219,8 +215,6 @@ const getAlbumList = async (args: AlbumListArgs): Promise<AlbumListResponse> =>
const getSongList = async (args: SongListArgs): Promise<SongListResponse> => {
const { query, apiClientProps } = args;
console.log('query :>> ', query);
const res = await ndApiClient(apiClientProps).getSongList({
query: {
_end: query.startIndex + (query.limit || -1),
@ -278,7 +272,9 @@ const createPlaylist = async (args: CreatePlaylistArgs): Promise<CreatePlaylistR
throw new Error('Failed to create playlist');
}
return null;
return {
id: res.body.data.id,
};
};
const updatePlaylist = async (args: UpdatePlaylistArgs): Promise<UpdatePlaylistResponse> => {