mirror of
https://github.com/markuryy/shark.git
synced 2025-12-12 19:51:01 +00:00
fix(db): playlist username fallback handling
This commit is contained in:
@@ -146,7 +146,7 @@ export async function upsertPlaylists(playlists: any[]): Promise<void> {
|
|||||||
String(playlist.PLAYLIST_ID),
|
String(playlist.PLAYLIST_ID),
|
||||||
playlist.TITLE || '',
|
playlist.TITLE || '',
|
||||||
playlist.NB_SONG || 0,
|
playlist.NB_SONG || 0,
|
||||||
playlist.PARENT_USERNAME || 'Unknown',
|
playlist.PARENT_USERNAME || playlist._USER_NAME_FALLBACK || 'Unknown',
|
||||||
playlist.PLAYLIST_PICTURE || null,
|
playlist.PLAYLIST_PICTURE || null,
|
||||||
playlist.PICTURE_TYPE || null,
|
playlist.PICTURE_TYPE || null,
|
||||||
now
|
now
|
||||||
|
|||||||
@@ -340,7 +340,15 @@ export class DeezerAPI {
|
|||||||
nb: -1
|
nb: -1
|
||||||
});
|
});
|
||||||
|
|
||||||
return response.TAB?.playlists?.data || [];
|
const playlists = response.TAB?.playlists?.data || [];
|
||||||
|
const userName = response.DATA?.USER?.BLOG_NAME || 'Unknown';
|
||||||
|
|
||||||
|
// Attach userName to each playlist for use as fallback in database
|
||||||
|
playlists.forEach((playlist: any) => {
|
||||||
|
playlist._USER_NAME_FALLBACK = userName;
|
||||||
|
});
|
||||||
|
|
||||||
|
return playlists;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching playlists:', error);
|
console.error('Error fetching playlists:', error);
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
Reference in New Issue
Block a user