diff --git a/src/graphql/operations/proposals.ts b/src/graphql/operations/proposals.ts index 8faddd02..eb058b77 100644 --- a/src/graphql/operations/proposals.ts +++ b/src/graphql/operations/proposals.ts @@ -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(?))"; + 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) { diff --git a/src/graphql/schema.gql b/src/graphql/schema.gql index 73ee28c1..a5fbc4f6 100644 --- a/src/graphql/schema.gql +++ b/src/graphql/schema.gql @@ -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]