Skip to content

Commit

Permalink
Merge pull request #49 from NabeelMukati/my-new-branch
Browse files Browse the repository at this point in the history
Documentation for swagger api's for developers.
  • Loading branch information
NabeelMukati authored Sep 24, 2024
2 parents 0b79b62 + e74bd9e commit 035f9b5
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
70 changes: 70 additions & 0 deletions server/services/tests/trackQueue.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TrackQueueItem } from '../trackQueue'
import { TrackQueue } from '../trackQueue'
import type { Track } from '@spotify/web-api-ts-sdk'


describe('Test TackQue', () => {
Expand All @@ -14,3 +15,72 @@ describe('Test TackQue', () => {
// it('should not pop track if peeked', () => {})
})


//sample track
const sometrack: Track = {
id: '1',
name: 'Test Track',
duration_ms: 300000, // The track's duration in milliseconds
album: {
id: 'album-id',
name: 'Test Album',
album_type: 'album',
album_group: 'album',
artists: [],
available_markets: [],
href: 'https://api.spotify.com/v1/albums/album-id',
images: [],
release_date: '2021-01-01',
release_date_precision: 'day',
total_tracks: 10,
type: 'album',
uri: 'spotify:album:album-id',
copyrights: [
{ text: '© 2021 Test Label', type: 'C' },
{ text: '℗ 2021 Test Label', type: 'P' }
],
external_ids: {
upc: '123456789012', // Example UPC
ean: '1234567890123', // Example EAN
isrc: 'USUM71702776' // Example ISRC
},
external_urls: {
spotify: 'https://open.spotify.com/album/album-id'
},
genres: ['pop'],
label: 'Test Label',
popularity: 75
},
external_ids: {
upc: '123456789012', // Required UPC field
ean: '1234567890123', // Required EAN field
isrc: 'USUM71702776' // Required ISRC field
},
popularity: 0,
artists: [
{
id: 'artist1',
name: 'Artist 1',
href: '',
external_urls: {
spotify: 'https://open.spotify.com/artist/1'
},
type: 'artist',
uri: 'spotify:artist:1'
}
],
available_markets: [],
disc_number: 1,
episode: false,
explicit: false,
external_urls: {
spotify: 'https://open.spotify.com/track/1'
},
href: 'https://api.spotify.com/v1/tracks/1',
is_local: false,
preview_url: null,
track: true,
track_number: 1,
type: 'track',
uri: 'spotify:track:1'
};
13 changes: 12 additions & 1 deletion server/services/trackQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@ export class TrackQueue {
constructor(readonly groupId: string) {}

public push(track: Track): number {
throw new NotImplementedError('TrackQueue.push')
this.tracks.push(new TrackQueueItem(track));
return 0;
// throw new NotImplementedError('TrackQueue.push')
}
public pop(): Track {
this.tracks.pop();
throw new NotImplementedError('TrackQueue.pop')
}
public peek(): Track {
return this.tracks[-1].track;
throw new NotImplementedError('TrackQueue.peek')
}
public setPosition(track: Track, pos: number) {}

}

// export interface Track extends SimplifiedTrack {
// album: SimplifiedAlbum;
// external_ids: ExternalIds;
// popularity: number;
// }

0 comments on commit 035f9b5

Please sign in to comment.