diff --git a/src/graphql/operations/proposals.ts b/src/graphql/operations/proposals.ts index e3409f19..d02b9f4e 100644 --- a/src/graphql/operations/proposals.ts +++ b/src/graphql/operations/proposals.ts @@ -72,6 +72,11 @@ export default async function (parent, args) { searchSql += ' AND p.flagged = 0'; } + if (where?.labels_in?.length) { + searchSql += ' AND JSON_OVERLAPS(p.labels, ?)'; + params.push(JSON.stringify(where.labels_in)); + } + let orderBy = args.orderBy || 'created'; let orderDirection = args.orderDirection || 'desc'; if (!['created', 'start', 'end'].includes(orderBy)) orderBy = 'created'; diff --git a/src/graphql/schema.gql b/src/graphql/schema.gql index dd6ee209..c4823f34 100644 --- a/src/graphql/schema.gql +++ b/src/graphql/schema.gql @@ -221,6 +221,7 @@ input ProposalWhere { end_lte: Int scores_state: String scores_state_in: [String] + labels_in: [String] state: String space_verified: Boolean flagged: Boolean