fix: sorting by newest answer first
This commit is contained in:
parent
55f9e15468
commit
b3069687d0
|
@ -38,7 +38,7 @@ class UserAnswerRepository:
|
||||||
return list(result)
|
return list(result)
|
||||||
|
|
||||||
def get_by_user(self, user_id: str) -> list[UserAnswerEntity]:
|
def get_by_user(self, user_id: str) -> list[UserAnswerEntity]:
|
||||||
result = self.collection.find({"user_id": user_id})
|
result = self.collection.find({"user_id": user_id}).sort("answered_at", -1)
|
||||||
return [UserAnswerEntity(**doc) for doc in result]
|
return [UserAnswerEntity(**doc) for doc in result]
|
||||||
|
|
||||||
def get_by_session(self, session_id: str) -> List[dict]:
|
def get_by_session(self, session_id: str) -> List[dict]:
|
||||||
|
|
Loading…
Reference in New Issue