scalability: create playlists API service
- Created apps/web/src/services/api/playlists.ts
- Wraps CRUD functions: create, get, update, delete, list
- Wraps track management: addTrack, removeTrack, reorderTracks
- Wraps collaboration functions: addCollaborator, removeCollaborator, updateCollaboratorPermission, getCollaborators
- Wraps social functions: follow, unfollow, getFollowStatus
- Wraps utility functions: search, createShareLink, getRecommendations
- Re-exports all related types for convenience
- Added to services/api/index.ts for barrel export
- No TypeScript errors
- Follows existing service layer pattern (similar to tracks.ts and users.ts)
- Action 6.1.1.4 complete
2026-01-15 19:30:38 +00:00
|
|
|
/**
|
|
|
|
|
* 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';
|
2026-01-15 19:38:09 +00:00
|
|
|
import type {
|
|
|
|
|
Playlist,
|
|
|
|
|
CreatePlaylistRequest,
|
|
|
|
|
UpdatePlaylistRequest,
|
|
|
|
|
PlaylistListResponse,
|
|
|
|
|
} from '@/features/playlists/types';
|
scalability: create playlists API service
- Created apps/web/src/services/api/playlists.ts
- Wraps CRUD functions: create, get, update, delete, list
- Wraps track management: addTrack, removeTrack, reorderTracks
- Wraps collaboration functions: addCollaborator, removeCollaborator, updateCollaboratorPermission, getCollaborators
- Wraps social functions: follow, unfollow, getFollowStatus
- Wraps utility functions: search, createShareLink, getRecommendations
- Re-exports all related types for convenience
- Added to services/api/index.ts for barrel export
- No TypeScript errors
- Follows existing service layer pattern (similar to tracks.ts and users.ts)
- Action 6.1.1.4 complete
2026-01-15 19:30:38 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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,
|
|
|
|
|
};
|