Skip to content

Commit c2abdef

Browse files
Update to filter on events.id instead of events.name
1 parent 58a5cb0 commit c2abdef

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

docs/swagger.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,11 @@ paths:
184184
- name: events
185185
in: query
186186
description: >-
187-
Filter by multiple event names, case-insensitive, partial matches are
188-
allowed.
187+
Filter by multiple event IDs
189188
required: false
190189
type: array
191190
items:
192-
type: string
191+
type: number
193192
- name: includeAllEvents
194193
in: query
195194
description: >-

src/services/ChallengeService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ async function searchChallenges (currentUser, criteria) {
277277
if (criteria.events) {
278278
if (criteria.includeAllEvents) {
279279
for (const e of criteria.events) {
280-
boolQuery.push({ match_phrase: { 'events.name': e } })
280+
boolQuery.push({ match_phrase: { 'events.id': e } })
281281
}
282282
} else {
283283
for (const e of criteria.events) {
284-
shouldQuery.push({ match: { 'events.name': e } })
284+
shouldQuery.push({ match: { 'events.id': e } })
285285
}
286286
}
287287
}
@@ -590,7 +590,7 @@ searchChallenges.schema = {
590590
isTask: Joi.boolean(),
591591
taskIsAssigned: Joi.boolean(),
592592
taskMemberId: Joi.string(),
593-
events: Joi.array().items(Joi.string()),
593+
events: Joi.array().items(Joi.number()),
594594
includeAllEvents: Joi.boolean().default(true)
595595
})
596596
}

0 commit comments

Comments
 (0)