From 98039b600973eb07f51afb72274810a789b149bf Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 25 Feb 2024 17:26:09 +0700 Subject: [PATCH] fixed sorting --- chain_service/repositories/chain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chain_service/repositories/chain.py b/chain_service/repositories/chain.py index 6218337..98c15f0 100644 --- a/chain_service/repositories/chain.py +++ b/chain_service/repositories/chain.py @@ -19,8 +19,8 @@ class ChainRepository: return chain async def get_list(self) -> List[Chain]: - sort_order = [("last_modified", pymongo.DESCENDING)] - chains = [chain async for chain in self.collection.find().sort(sort_order)] + sort_order = ("lastModified", pymongo.DESCENDING) + chains = [chain async for chain in self.collection.find().sort(*sort_order)] return TypeAdapter(List[Chain]).validate_python(chains) async def get_by_id(self, chain_id: str) -> Chain | None: