Skip to content

Search by skill IDs #706

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

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
Initial skill search implementation
  • Loading branch information
jmgasper committed Dec 21, 2023
commit e6066ad9f36e4d16b63c363d4569229875af0d1e
15 changes: 15 additions & 0 deletions src/services/ChallengeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,20 @@ async function searchChallenges(currentUser, criteria) {
});
}

const includedSkillIds = _.isArray(criteria.skillIds) ? criteria.skillIds : [];

if (includedSkillIds.length > 0) {
for (const skillId of includedSkillIds) {
const matchPhrase = {};
matchPhrase[`skills.id`] = `${skillId}`;
mustQuery.push({
bool: {
should: matchPhrase,
},
});
}
}

// FIXME: Tech Debt
let excludeTasks = true;
// if you're an admin or m2m, security rules wont be applied
Expand Down Expand Up @@ -881,6 +895,7 @@ searchChallenges.schema = {
description: Joi.string(),
timelineTemplateId: Joi.string(), // Joi.optionalId(),
reviewType: Joi.string(),
skillIds: Joi.array().items(Joi.string()),
tag: Joi.string(),
tags: Joi.array().items(Joi.string()),
includeAllTags: Joi.boolean().default(true),
Expand Down