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
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
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ install_dependency: &install_dependency
sudo apt install jq
sudo apt install python3-pip
sudo pip3 install awscli --upgrade
sudo pip3 install docker==6.1.3
sudo pip3 install docker-compose
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
Expand Down Expand Up @@ -91,6 +92,7 @@ workflows:
only:
- dev
- CORE-40
- TSJR-327

- "build-qa":
context: org-global
Expand Down
19 changes: 19 additions & 0 deletions src/services/ChallengeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,24 @@ async function searchChallenges(currentUser, criteria) {
});
}

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

if (includedSkillIds.length > 0) {
const skillQuery=[]

for (const skillId of includedSkillIds) {
const matchPhrase = {};
matchPhrase[`skills.id`] = `${skillId}`;
skillQuery.push({"match_phrase":matchPhrase})
}
boolQuery.push({
bool:{
should:skillQuery,
minimum_should_match: 1
}
})
}

// FIXME: Tech Debt
let excludeTasks = true;
// if you're an admin or m2m, security rules wont be applied
Expand Down Expand Up @@ -881,6 +899,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