-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: filter spaces by strategies
, plugins
and network
#704
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #704 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 40 40
Lines 1936 2013 +77
Branches 40 40
======================================
- Misses 1896 1973 +77
Partials 40 40
☔ View full report in Codecov by Sentry. |
strategies
, plugins
and network
@@ -165,6 +165,21 @@ export async function fetchSpaces(args) { | |||
orderDirection = orderDirection.toUpperCase(); | |||
if (!['ASC', 'DESC'].includes(orderDirection)) orderDirection = 'DESC'; | |||
|
|||
if (where.strategies_in) { | |||
queryStr += " AND JSON_OVERLAPS(JSON_EXTRACT(settings, '$.strategies[*].name'), JSON_ARRAY(?))"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only returns spaces that return space that uses only one strategy, it should return any space that use the strategy being passed
For example if space A is using ticket
and erc721
and space B is using just ticket
strategy,
now if we request with strategies_in:["ticket"]
it return only space B, it should return space A too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be the case already, that's the job of JSON_OVERLAPS
. Do you have a specific example I can test ?
Running the query in the description is giving me spaces using multiple strategies
"strategies": [
{
"name": "whitelist"
},
{
"name": "delegation"
},
{
"name": "moloch-all"
},
{
"name": "loot-character-guilds"
},
{
"name": "rocketpool-node-operator"
},
{
"name": "honeyswap"
},
{
"name": "xdai-stake-holders"
},
{
"name": "yearn-vault"
}
],
Fix #548
Fix #535
Add
strategies_in
andplugins_in
filter to Space.This allow query such as:
Those filters behave differently than the proposal's
strategies_contains
.strategies_contains
is using string search, and can match anything, such as{
.strategies/plugins_in
filter will exact match the strategy/plugin name.Feature has been applied to Proposal via #705
The strategies search only apply to level 2 strategies, and will not match nested strategies
Creating the following indices will improve search performance
The goal of those new filters will be to enable the snapshot UI to show the list of spaces using specific network/strategy/plugin
Note
JSON_OVERLAPS
require Mysql version >= 8.0.17