From cd8348b630088f4c6c5d8695bc15e7d345444e95 Mon Sep 17 00:00:00 2001 From: Tahsin Tunan Date: Fri, 30 Jun 2023 06:10:29 +0600 Subject: [PATCH] fix: use user-provided sort direction (#71) --- digital_asset_types/src/dao/scopes/asset.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/digital_asset_types/src/dao/scopes/asset.rs b/digital_asset_types/src/dao/scopes/asset.rs index cbbbf5b97..5ab115e11 100644 --- a/digital_asset_types/src/dao/scopes/asset.rs +++ b/digital_asset_types/src/dao/scopes/asset.rs @@ -159,8 +159,8 @@ where let mut stmt = asset::Entity::find() .filter(condition) .join(JoinType::LeftJoin, relation.def()) - .order_by(sort_by, sort_direction) - .order_by(asset::Column::Id, Order::Asc); + .order_by(sort_by, sort_direction.clone()) + .order_by(asset::Column::Id, sort_direction); stmt = paginate(pagination, limit, stmt); let assets = stmt.all(conn).await?; @@ -253,8 +253,8 @@ pub async fn get_assets_by_condition( } stmt = stmt .filter(condition) - .order_by(sort_by, sort_direction) - .order_by(asset::Column::Id, Order::Asc); + .order_by(sort_by, sort_direction.clone()) + .order_by(asset::Column::Id, sort_direction); stmt = paginate(pagination, limit, stmt); let assets = stmt.all(conn).await?;