Skip to content
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 proposals by plugins and strategies #705

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/graphql/operations/proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,19 @@ export default async function (parent, args) {
params.push(`%${where.plugins_contains}%`);
}

if (where.strategies_in) {
searchSql += " AND JSON_OVERLAPS(JSON_EXTRACT(p.strategies, '$[*].name'), JSON_ARRAY(?))";
ChaituVR marked this conversation as resolved.
Show resolved Hide resolved
params.push(where.strategies_in);
}

if (where.plugins_in) {
searchSql += ' AND JSON_OVERLAPS(JSON_KEYS(p.plugins) , JSON_ARRAY(?))';
params.push(where.plugins_in);
}

if (where.validation) {
searchSql += ' AND p.validation LIKE ?';
params.push(`%"name": "${where.validation}"%`);
searchSql += " AND JSON_EXTRACT(p.validation, '$.name') = ?";
params.push(where.validation);
}

if (where.space_verified) {
Expand Down
2 changes: 2 additions & 0 deletions src/graphql/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ input ProposalWhere {
title_contains: String
strategies_contains: String
plugins_contains: String
strategies_in: [String]
plugins_in: [String]
validation: String
type: String
type_in: [String]
Expand Down