diff --git a/src/constants.js b/src/constants.js index 7385fe04..a31c965b 100644 --- a/src/constants.js +++ b/src/constants.js @@ -42,16 +42,6 @@ export const PROJECT_MEMBER_MANAGER_ROLES = [ PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT, ]; -export const PROJECT_MEMBER_NON_CUSTOMER_ROLES = [ - PROJECT_MEMBER_ROLE.MANAGER, - PROJECT_MEMBER_ROLE.COPILOT, - PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER, - PROJECT_MEMBER_ROLE.ACCOUNT_EXECUTIVE, - PROJECT_MEMBER_ROLE.PROJECT_MANAGER, - PROJECT_MEMBER_ROLE.PROGRAM_MANAGER, - PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT, -]; - export const USER_ROLE = { TOPCODER_ADMIN: 'administrator', MANAGER: 'Connect Manager', diff --git a/src/routes/projects/list.js b/src/routes/projects/list.js index fc58c03b..91119da3 100755 --- a/src/routes/projects/list.js +++ b/src/routes/projects/list.js @@ -5,7 +5,7 @@ import _ from 'lodash'; import config from 'config'; import models from '../../models'; -import { MANAGER_ROLES, INVITE_STATUS, PROJECT_MEMBER_NON_CUSTOMER_ROLES } from '../../constants'; +import { MANAGER_ROLES, INVITE_STATUS } from '../../constants'; import util from '../../util'; const ES_PROJECT_INDEX = config.get('elasticsearchConfig.indexName'); @@ -228,14 +228,13 @@ const buildEsQueryWithFilter = (value, keyword, matchType, fieldName) => { } if (value === 'customer' || value === 'manager') { - const roles = value === 'customer' ? [value] : PROJECT_MEMBER_NON_CUSTOMER_ROLES; should = _.concat(should, { nested: { path: 'members', query: { bool: { must: [ - { terms: { 'members.role': roles } }, + { match: { 'members.role': value } }, { query_string: { query: keyword, diff --git a/src/routes/projects/list.spec.js b/src/routes/projects/list.spec.js index 0cbb4fc6..0dbe713e 100644 --- a/src/routes/projects/list.spec.js +++ b/src/routes/projects/list.spec.js @@ -93,9 +93,6 @@ const data = [ userId: 40051332, projectId: 2, role: 'copilot', - firstName: 'copi', - lastName: 'lott', - handle: 'tolipoc', isPrimary: true, createdBy: 1, updatedBy: 1, @@ -210,9 +207,6 @@ describe('LIST Project', () => { userId: 40051332, projectId: project2.id, role: 'copilot', - firstName: 'copi', - lastName: 'lott', - handle: 'tolipoc', isPrimary: true, createdBy: 1, updatedBy: 1, @@ -735,29 +729,6 @@ describe('LIST Project', () => { }); }); - it('should return all projects that match when filtering by manager, searching on any non-customer role', (done) => { - request(server) - .get('/v5/projects/?manager=copi*') - .set({ - Authorization: `Bearer ${testUtil.jwts.admin}`, - }) - .expect('Content-Type', /json/) - .expect(200) - .end((err, res) => { - if (err) { - done(err); - } else { - const resJson = res.body; - should.exist(resJson); - resJson.should.have.lengthOf(1); - resJson[0].name.should.equal('test2'); - resJson[0].members.should.have.deep.property('[0].role', 'copilot'); - resJson[0].members[0].userId.should.equal(40051332); - done(); - } - }); - }); - it('should return list of projects ordered ascending by lastActivityAt when sort column is "lastActivityAt"', (done) => { request(server) .get('/v5/projects/?sort=lastActivityAt')