fixed sorting

This commit is contained in:
Robert 2024-02-25 17:26:09 +07:00
parent 99cef43899
commit 98039b6009
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -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: