From 5a7434835cb146dfe14cc743dee09558cb22c1a6 Mon Sep 17 00:00:00 2001 From: philogicae <38438271+philogicae@users.noreply.github.com> Date: Mon, 19 Feb 2024 05:52:23 +0200 Subject: [PATCH] Fix sortBy/sortOrder on Message/Post queries --- src/aleph/web/controllers/messages.py | 6 +++++- src/aleph/web/controllers/posts.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/aleph/web/controllers/messages.py b/src/aleph/web/controllers/messages.py index faf64b5f5..d54e70dbe 100644 --- a/src/aleph/web/controllers/messages.py +++ b/src/aleph/web/controllers/messages.py @@ -57,17 +57,21 @@ class BaseMessageQueryParams(BaseModel): sort_by: SortBy = Field( default=SortBy.TIME, + alias="sortBy", description="Key to use to sort the messages. " "'time' uses the message time field. " "'tx-time' uses the first on-chain confirmation time.", ) sort_order: SortOrder = Field( default=SortOrder.DESCENDING, + alias="sortOrder", description="Order in which messages should be listed: " "-1 means most recent messages first, 1 means older messages first.", ) message_type: Optional[MessageType] = Field( - default=None, alias="msgType", description="Message type. Deprecated: use msgTypes instead" + default=None, + alias="msgType", + description="Message type. Deprecated: use msgTypes instead", ) message_types: Optional[List[MessageType]] = Field( default=None, alias="msgTypes", description="Accepted message types." diff --git a/src/aleph/web/controllers/posts.py b/src/aleph/web/controllers/posts.py index 70cbd57f9..13a25d574 100644 --- a/src/aleph/web/controllers/posts.py +++ b/src/aleph/web/controllers/posts.py @@ -70,12 +70,14 @@ class PostQueryParams(BaseModel): ) sort_by: SortBy = Field( default=SortBy.TIME, + alias="sortBy", description="Key to use to sort the posts. " "'time' uses the post creation time field. " "'tx-time' uses the first on-chain confirmation time.", ) sort_order: SortOrder = Field( default=SortOrder.DESCENDING, + alias="sortOrder", description="Order in which messages should be listed: " "-1 means most recent messages first, 1 means older messages first.", )