playlists
This commit is contained in:
parent
edac4b1394
commit
f7dbb14a6b
4 changed files with 21 additions and 8 deletions
|
@ -278,11 +278,21 @@ impl Libary {
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
{
|
{
|
||||||
if Track::find_partial(doc! { "artist_id": artist.reference()}, json!({}), None, None)
|
if Track::find_partial(
|
||||||
|
doc! { "artist_id": artist.reference()},
|
||||||
|
json!({}),
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.is_empty()
|
.is_empty()
|
||||||
&& Album::find_partial(doc! { "artist_id": artist.reference()}, json!({}), None, None)
|
&& Album::find_partial(
|
||||||
|
doc! { "artist_id": artist.reference()},
|
||||||
|
json!({}),
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.is_empty()
|
.is_empty()
|
||||||
|
|
|
@ -90,7 +90,7 @@ impl Track {
|
||||||
"album_id": None::<String>
|
"album_id": None::<String>
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
None
|
None,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub async fn get_singles_route(u: User) -> FallibleApiResponse {
|
||||||
let singles = Track::find(
|
let singles = Track::find(
|
||||||
doc! { "album_id": None::<String>, "artist_id": {"$ne": None::<String> }},
|
doc! { "album_id": None::<String>, "artist_id": {"$ne": None::<String> }},
|
||||||
None,
|
None,
|
||||||
None
|
None,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -19,7 +19,10 @@ use super::ToAPI;
|
||||||
|
|
||||||
#[get("/playlists")]
|
#[get("/playlists")]
|
||||||
pub async fn playlists_route(u: User) -> FallibleApiResponse {
|
pub async fn playlists_route(u: User) -> FallibleApiResponse {
|
||||||
let mut playlists = vec![json!({"id": "recent", "name": "Recently Played"})];
|
let mut playlists = vec![
|
||||||
|
json!({"id": "recent", "name": "Recently Played"}),
|
||||||
|
json!({"id": "recentlyAdded", "name": "Recently Added"}),
|
||||||
|
];
|
||||||
|
|
||||||
let own_playlists = Playlist::find(doc! { "owner": u.reference()}, None, None)
|
let own_playlists = Playlist::find(doc! { "owner": u.reference()}, None, None)
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Reference in a new issue