From 071477ffdb7c1939a6357aa30accddc86ec35488 Mon Sep 17 00:00:00 2001 From: rakuja Date: Mon, 8 Jul 2024 01:04:16 +0200 Subject: [PATCH] chore: add rarity sorting --- src/db/shop_proxy.rs | 1 + src/models/shop_structs.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/db/shop_proxy.rs b/src/db/shop_proxy.rs index 291d937..66454e8 100644 --- a/src/db/shop_proxy.rs +++ b/src/db/shop_proxy.rs @@ -51,6 +51,7 @@ pub async fn get_paginated_items( ItemSortEnum::Name => a.core_item.name.cmp(&b.core_item.name), ItemSortEnum::Level => a.core_item.level.cmp(&b.core_item.level), ItemSortEnum::Type => a.core_item.item_type.cmp(&b.core_item.item_type), + ItemSortEnum::Rarity => a.core_item.rarity.cmp(&b.core_item.rarity), }; match pagination .shop_sort_data diff --git a/src/models/shop_structs.rs b/src/models/shop_structs.rs index de3592d..17ebf2a 100644 --- a/src/models/shop_structs.rs +++ b/src/models/shop_structs.rs @@ -52,6 +52,8 @@ pub enum ItemSortEnum { Level, #[serde(alias = "type", alias = "TYPE")] Type, + #[serde(alias = "rarity", alias = "RARITY")] + Rarity, } #[derive(Serialize, Deserialize, IntoParams, Validate, Eq, PartialEq, Hash, Default)]