aleph-im / pyaleph

Next generation network of decentralized big data applications. Current connected chains: Ethereum, Solana, Polkadot/Substrate, Cosmos-SDK, NULS.
https://aleph.im
MIT License
75 stars 19 forks source link

Add support for chain filter #281

Closed hoh closed 2 years ago

hoh commented 2 years ago

Users cannot filter messages based on the chain message field.

Suggestion:

src/aleph/web/controllers/messages.py --- 1/2 --- Python
46 46 
47 47     filters: List[Dict[str, Any]] = []
48 48     addresses = get_query_list_field("addresses")
.. 49     chains = get_query_list_field("chains")
49 50     refs = get_query_list_field("refs")
50 51     content_types = get_query_list_field("contentTypes")
51 52     channels = get_query_list_field("channels")

src/aleph/web/controllers/messages.py --- 2/2 --- Python
68 69             }
69 70         )
.. 71 
.. 72     if chains is not None:
.. 73         filters.append({"chain": {"$in": chains}})
70 74 
71 75     if content_keys is not None:
72 76         filters.append({"content.key": {"$in": content_keys}})

Related to https://github.com/aleph-im/aleph-message/pull/7

odesenfans commented 2 years ago

Resolved by #282.