- Replaced imports in UserProfilePage.tsx (listPlaylists → playlistsApi.list) - Replaced imports in PlaylistDetailPage.tsx (getCollaborators → playlistsApi.getCollaborators) - Replaced imports in CreatePlaylistDialog.tsx (createPlaylist → playlistsApi.create) - Replaced imports in PlaylistList.tsx (searchPlaylists → playlistsApi.search) - Replaced imports in CollaboratorManagement.tsx (getCollaborators → playlistsApi.getCollaborators) - Replaced imports in PlaylistSearch.tsx (searchPlaylists → playlistsApi.search) - Replaced imports in unifiedSearchService.ts (searchPlaylists → playlistsApi.search) - Replaced imports in GlobalSearchBar.tsx (searchPlaylists → playlistsApi.search) - Fixed type imports in services/api/playlists.ts (types from types.ts, not playlistService.ts) - All function calls updated to use playlistsApi methods - Test files and hooks still use direct imports (acceptable - tests can use implementation details, hooks will be updated in Action 6.1.1.10) - No TypeScript errors related to playlistsApi - Action 6.1.1.7 complete
155 lines
2.9 KiB
TypeScript
155 lines
2.9 KiB
TypeScript
/**
|
|
* Playlists API Service
|
|
* Action 6.1.1.4: Create playlists API service
|
|
* Service layer for playlist-related API operations
|
|
* Wraps existing playlist API functions into a unified service object
|
|
*/
|
|
|
|
import {
|
|
createPlaylist,
|
|
getPlaylist,
|
|
updatePlaylist,
|
|
deletePlaylist,
|
|
listPlaylists,
|
|
addCollaborator,
|
|
removeCollaborator,
|
|
updateCollaboratorPermission,
|
|
searchPlaylists,
|
|
createShareLink,
|
|
reorderPlaylistTracks,
|
|
removeTrackFromPlaylist,
|
|
getPlaylistRecommendations,
|
|
getCollaborators,
|
|
addTrackToPlaylist,
|
|
followPlaylist,
|
|
unfollowPlaylist,
|
|
getPlaylistFollowStatus,
|
|
type PlaylistCollaborator,
|
|
type AddCollaboratorRequest,
|
|
type UpdateCollaboratorPermissionRequest,
|
|
type SearchPlaylistsParams,
|
|
type PlaylistShareLink,
|
|
type ReorderTracksRequest,
|
|
type PlaylistRecommendation,
|
|
type GetRecommendationsParams,
|
|
type FollowPlaylistResponse,
|
|
} from '@/features/playlists/services/playlistService';
|
|
import type {
|
|
Playlist,
|
|
CreatePlaylistRequest,
|
|
UpdatePlaylistRequest,
|
|
PlaylistListResponse,
|
|
} from '@/features/playlists/types';
|
|
|
|
/**
|
|
* Playlists API Service Object
|
|
* Action 6.1.1.4: Exports unified playlistsApi object with all playlist operations
|
|
*/
|
|
export const playlistsApi = {
|
|
/**
|
|
* Create a new playlist
|
|
*/
|
|
create: createPlaylist,
|
|
|
|
/**
|
|
* Get a playlist by ID
|
|
*/
|
|
get: getPlaylist,
|
|
|
|
/**
|
|
* Update a playlist
|
|
*/
|
|
update: updatePlaylist,
|
|
|
|
/**
|
|
* Delete a playlist
|
|
*/
|
|
delete: deletePlaylist,
|
|
|
|
/**
|
|
* List playlists with pagination and filters
|
|
*/
|
|
list: listPlaylists,
|
|
|
|
/**
|
|
* Search playlists
|
|
*/
|
|
search: searchPlaylists,
|
|
|
|
/**
|
|
* Add a track to a playlist
|
|
*/
|
|
addTrack: addTrackToPlaylist,
|
|
|
|
/**
|
|
* Remove a track from a playlist
|
|
*/
|
|
removeTrack: removeTrackFromPlaylist,
|
|
|
|
/**
|
|
* Reorder tracks in a playlist
|
|
*/
|
|
reorderTracks: reorderPlaylistTracks,
|
|
|
|
/**
|
|
* Add a collaborator to a playlist
|
|
*/
|
|
addCollaborator,
|
|
|
|
/**
|
|
* Remove a collaborator from a playlist
|
|
*/
|
|
removeCollaborator,
|
|
|
|
/**
|
|
* Update collaborator permissions
|
|
*/
|
|
updateCollaboratorPermission,
|
|
|
|
/**
|
|
* Get collaborators of a playlist
|
|
*/
|
|
getCollaborators,
|
|
|
|
/**
|
|
* Create a share link for a playlist
|
|
*/
|
|
createShareLink,
|
|
|
|
/**
|
|
* Follow a playlist
|
|
*/
|
|
follow: followPlaylist,
|
|
|
|
/**
|
|
* Unfollow a playlist
|
|
*/
|
|
unfollow: unfollowPlaylist,
|
|
|
|
/**
|
|
* Get playlist follow status
|
|
*/
|
|
getFollowStatus: getPlaylistFollowStatus,
|
|
|
|
/**
|
|
* Get playlist recommendations
|
|
*/
|
|
getRecommendations: getPlaylistRecommendations,
|
|
};
|
|
|
|
// Re-export types for convenience
|
|
export type {
|
|
Playlist,
|
|
CreatePlaylistRequest,
|
|
UpdatePlaylistRequest,
|
|
PlaylistListResponse,
|
|
PlaylistCollaborator,
|
|
AddCollaboratorRequest,
|
|
UpdateCollaboratorPermissionRequest,
|
|
SearchPlaylistsParams,
|
|
PlaylistShareLink,
|
|
ReorderTracksRequest,
|
|
PlaylistRecommendation,
|
|
GetRecommendationsParams,
|
|
FollowPlaylistResponse,
|
|
};
|