Skip to content

Commit

Permalink
fix(media-list): newest is recently added and recent is recently played
Browse files Browse the repository at this point in the history
  • Loading branch information
vnghia committed Apr 10, 2024
1 parent a882af8 commit fd03a9f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/open_subsonic/media_list/get_album_list2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use axum::extract::State;
use diesel::dsl::sum;
use diesel::{ExpressionMethods, PgSortExpressionMethods, QueryDsl};
use diesel::dsl::{max, sum};
use diesel::{ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
use futures::{stream, StreamExt, TryStreamExt};
use nghe_proc_macros::{
Expand Down Expand Up @@ -41,7 +41,7 @@ pub async fn get_album_list2(
#[add_permission_filter]
#[add_count_offset]
get_album_id3_db()
.order(albums::year.desc().nulls_last())
.order(albums::created_at.desc())
.get_results::<AlbumId3Db>(&mut pool.get().await?)
.await?
}
Expand All @@ -61,7 +61,9 @@ pub async fn get_album_list2(
#[add_permission_filter]
#[add_count_offset]
get_album_id3_db()
.order(albums::created_at.desc())
.inner_join(playbacks::table)
.filter(playbacks::user_id.eq(user_id))
.order(max(playbacks::updated_at).desc())
.get_results::<AlbumId3Db>(&mut pool.get().await?)
.await?
}
Expand Down

0 comments on commit fd03a9f

Please sign in to comment.