-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Adds support for paginated storage queries, and implements paginati…
…on for the wallets_list endpoint (#3000) * 🎨 name the scan args Signed-off-by: ff137 <[email protected]> * 🎨 add return types and arg docstrings Signed-off-by: ff137 <[email protected]> * ✅ fix assertion Signed-off-by: ff137 <[email protected]> * :spark: implement `find_paginated_records` Signed-off-by: ff137 <[email protected]> * ✨ add `limit` and `offset` to BaseRecord.query, calling `find_paginated_records` if requested Signed-off-by: ff137 <[email protected]> * ✨ add `limit` and `offset` to wallet list query. define `MAXIMUM_PAGE_SIZE` and use in validation. use `limit` and `offset` in records query Signed-off-by: ff137 <[email protected]> * 🎨 organise imports Signed-off-by: ff137 <[email protected]> * ✅ fix assertion Signed-off-by: ff137 <[email protected]> * 🎨 correction: call `scan` on `store` Signed-off-by: ff137 <[email protected]> * 👷 Don't run integration tests when PR is in draft Signed-off-by: ff137 <[email protected]> * 🎨 call `scan` on `profile.opened.store` Signed-off-by: ff137 <[email protected]> * 🎨 remove unused options arg Signed-off-by: ff137 <[email protected]> * 🎨 NB: remove unused option `retrieveTags`. Unimplemented / has no effect Signed-off-by: ff137 <[email protected]> * 🎨 fix accessor for the store instance Signed-off-by: ff137 <[email protected]> * 🎨 add direct instantiation of `self._profile`, so that `self._profile.store` reference is resolvable Signed-off-by: ff137 <[email protected]> * ✨ add optional limit and offset to AskarStorageSearchSession.fetch Signed-off-by: ff137 <[email protected]> * ✨ implement PaginatedQuerySchema class for deduplication Signed-off-by: ff137 <[email protected]> * ✅ add tests for BaseRecord.query when called with limit or offset Signed-off-by: ff137 <[email protected]> * 🎨 organise imports Signed-off-by: ff137 <[email protected]> * 🎨 efficient subset of OrderedDict values Signed-off-by: ff137 <[email protected]> * ✅ test coverage for find_paginated_records Signed-off-by: ff137 <[email protected]> * 🎨 organise imports Signed-off-by: ff137 <[email protected]> * ✅ test coverage for PaginatedQuerySchema Signed-off-by: ff137 <[email protected]> * 🎨 fix marshmallow warning Signed-off-by: ff137 <[email protected]> * 🐛 fix reference to store, and add _profile to init for type hint Signed-off-by: ff137 <[email protected]> * Update lock file Signed-off-by: ff137 <[email protected]> --------- Signed-off-by: ff137 <[email protected]> Co-authored-by: jamshale <[email protected]>
- Loading branch information
Showing
16 changed files
with
541 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Class for paginated query parameters.""" | ||
|
||
from marshmallow import fields | ||
|
||
from aries_cloudagent.storage.base import DEFAULT_PAGE_SIZE, MAXIMUM_PAGE_SIZE | ||
|
||
from ...messaging.models.openapi import OpenAPISchema | ||
|
||
|
||
class PaginatedQuerySchema(OpenAPISchema): | ||
"""Parameters for paginated queries.""" | ||
|
||
limit = fields.Int( | ||
required=False, | ||
load_default=DEFAULT_PAGE_SIZE, | ||
validate=lambda x: x > 0 and x <= MAXIMUM_PAGE_SIZE, | ||
metadata={"description": "Number of results to return", "example": 50}, | ||
error_messages={ | ||
"validator_failed": ( | ||
"Value must be greater than 0 and " | ||
f"less than or equal to {MAXIMUM_PAGE_SIZE}" | ||
) | ||
}, | ||
) | ||
offset = fields.Int( | ||
required=False, | ||
load_default=0, | ||
validate=lambda x: x >= 0, | ||
metadata={"description": "Offset for pagination", "example": 0}, | ||
error_messages={"validator_failed": "Value must be 0 or greater"}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.