From 0c51ea8b76b9282b8702bdd327b63e4656cfd3fc Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Mon, 8 Aug 2022 09:34:58 +0000 Subject: [PATCH] bug fixed --- src/models/pagination/mod.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/models/pagination/mod.rs b/src/models/pagination/mod.rs index 04209da..c3ac7aa 100644 --- a/src/models/pagination/mod.rs +++ b/src/models/pagination/mod.rs @@ -10,26 +10,26 @@ pub enum Sort { DESC(String), } -impl From for bpr::protobuf::pagination::Sort { - fn from(d: Sort) -> Self { +impl From<&Sort> for bpr::protobuf::pagination::Sort { + fn from(d: &Sort) -> Self { match d { Sort::ASC(by) => bpr::protobuf::pagination::Sort { - by, + by: by.to_string(), order: bpr::protobuf::pagination::SortOrder::Asc as i32, }, Sort::DESC(by) => bpr::protobuf::pagination::Sort { - by, + by: by.to_string(), order: bpr::protobuf::pagination::SortOrder::Desc as i32, }, } } } -impl From for Sort { - fn from(d: bpr::protobuf::pagination::Sort) -> Self { +impl From<&bpr::protobuf::pagination::Sort> for Sort { + fn from(d: &bpr::protobuf::pagination::Sort) -> Self { match d.order { - x if x == bpr::protobuf::pagination::SortOrder::Desc as i32 => Sort::DESC(d.by), - _ => Sort::ASC(d.by), + x if x == bpr::protobuf::pagination::SortOrder::Desc as i32 => Sort::DESC(d.by.to_string()), + _ => Sort::ASC(d.by.to_string()), } } }