Skip to content

Commit

Permalink
Sort tracks on library
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyfran committed Aug 22, 2024
1 parent 8e60d11 commit 846aa9f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/services/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export const LibraryLive = Layer.effect(
return {
...album,
artist: artist.value,
tracks: tracks.map((track) => ({
...track,
albumId: album.id,
mainArtist: artist.value,
secondaryArtists: [],
})),
tracks: tracks
.sort((a, b) => a.trackNumber - b.trackNumber)
.map((track) => ({
...track,
albumId: album.id,
mainArtist: artist.value,
secondaryArtists: [],
})),
};
}),
),
Expand Down

0 comments on commit 846aa9f

Please sign in to comment.