mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-22 01:43:29 +01:00
Remove ability to filter album by artist, go via getArtist instead
This commit is contained in:
@@ -23,9 +23,6 @@ import {
|
||||
type P<T> = (t: T) => boolean;
|
||||
const all: P<any> = (_: any) => true;
|
||||
|
||||
const albumByArtist = (id: string): P<[Artist, Album]> => ([artist, _]) =>
|
||||
artist.id === id;
|
||||
|
||||
const albumWithGenre = (genre: string): P<[Artist, Album]> => ([_, album]) =>
|
||||
album.genre === genre;
|
||||
|
||||
@@ -75,10 +72,8 @@ export class InMemoryMusicService implements MusicService {
|
||||
.flatMap((artist) => artist.albums.map((album) => [artist, album]))
|
||||
.filter(
|
||||
pipe(
|
||||
pipe(O.fromNullable(q.artistId), O.map(albumByArtist)),
|
||||
O.alt(() =>
|
||||
pipe(O.fromNullable(q.genre), O.map(albumWithGenre))
|
||||
),
|
||||
O.fromNullable(q.genre),
|
||||
O.map(albumWithGenre),
|
||||
O.getOrElse(() => all)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user