@@ -221,9 +221,15 @@ esIndexPropertyMapping[config.get('esConfig.ES_INDEX_RESOURCE_BOOKING')] = {
221221 updatedBy : { type : 'keyword' }
222222}
223223esIndexPropertyMapping [ config . get ( 'esConfig.ES_INDEX_ROLE' ) ] = {
224- name : { type : 'keyword' } ,
224+ name : {
225+ type : 'keyword' ,
226+ normalizer : 'lowercaseNormalizer'
227+ } ,
225228 description : { type : 'keyword' } ,
226- listOfSkills : { type : 'keyword' } ,
229+ listOfSkills : {
230+ type : 'keyword' ,
231+ normalizer : 'lowercaseNormalizer'
232+ } ,
227233 rates : {
228234 properties : {
229235 global : { type : 'integer' } ,
@@ -1199,6 +1205,24 @@ async function getTopcoderSkills (criteria) {
11991205 }
12001206}
12011207
1208+ /**
1209+ * Function to search and retrive all skills from v5/skills
1210+ * - only returns skills from Topcoder Skills Provider defined by `TOPCODER_SKILL_PROVIDER_ID`
1211+ *
1212+ * @param {Object } criteria the search criteria
1213+ * @returns the request result
1214+ */
1215+ async function getAllTopcoderSkills ( criteria ) {
1216+ const skills = await getTopcoderSkills ( _ . assign ( criteria , { page : 1 , perPage : 100 } ) )
1217+ while ( skills . page * skills . perPage <= skills . total ) {
1218+ const newSkills = await getTopcoderSkills ( _ . assign ( criteria , { page : skills . page + 1 , perPage : 100 } ) )
1219+ skills . result = [ ...skills . result , ...newSkills . result ]
1220+ skills . page = newSkills . page
1221+ skills . total = newSkills . total
1222+ }
1223+ return skills . result
1224+ }
1225+
12021226/**
12031227 * Function to get skill by id
12041228 * @param {String } skillId the skill Id
@@ -1745,29 +1769,27 @@ async function substituteStringByObject (string, object) {
17451769 return string
17461770}
17471771
1748-
17491772/**
17501773 * Get tags from tagging service
17511774 * @param {String } description The challenge description
17521775 * @returns {Array } array of tags
17531776 */
17541777async function getTags ( description ) {
1755- const data = { text : description , extract_confidence : false }
1756- const type = " emsi/internal_no_refresh"
1757- const url = `${ config . TC_API } /contest-tagging/${ type } ` ;
1778+ const data = { text : description , extract_confidence : false }
1779+ const type = ' emsi/internal_no_refresh'
1780+ const url = `${ config . TC_API } /contest-tagging/${ type } `
17581781 const res = await request
17591782 . post ( url )
17601783 . set ( 'Accept' , 'application/json' )
17611784 . send ( querystring . stringify ( data ) )
17621785
17631786 localLogger . debug ( {
17641787 context : 'getTags' ,
1765- message : `response body: ${ JSON . stringify ( res . body ) } ` ,
1766- } ) ;
1767- return _ . get ( res , 'body' ) ;
1788+ message : `response body: ${ JSON . stringify ( res . body ) } `
1789+ } )
1790+ return _ . get ( res , 'body' )
17681791}
17691792
1770-
17711793/**
17721794 * @param {Object } currentUser the user performing the action
17731795 * @param {Object } data title of project and any other info
@@ -1819,6 +1841,7 @@ module.exports = {
18191841 getMembers,
18201842 getProjectById,
18211843 getTopcoderSkills,
1844+ getAllTopcoderSkills,
18221845 getSkillById,
18231846 ensureJobById,
18241847 ensureResourceBookingById,
0 commit comments