@@ -221,9 +221,15 @@ esIndexPropertyMapping[config.get('esConfig.ES_INDEX_RESOURCE_BOOKING')] = {
221
221
updatedBy : { type : 'keyword' }
222
222
}
223
223
esIndexPropertyMapping [ config . get ( 'esConfig.ES_INDEX_ROLE' ) ] = {
224
- name : { type : 'keyword' } ,
224
+ name : {
225
+ type : 'keyword' ,
226
+ normalizer : 'lowercaseNormalizer'
227
+ } ,
225
228
description : { type : 'keyword' } ,
226
- listOfSkills : { type : 'keyword' } ,
229
+ listOfSkills : {
230
+ type : 'keyword' ,
231
+ normalizer : 'lowercaseNormalizer'
232
+ } ,
227
233
rates : {
228
234
properties : {
229
235
global : { type : 'integer' } ,
@@ -1199,6 +1205,24 @@ async function getTopcoderSkills (criteria) {
1199
1205
}
1200
1206
}
1201
1207
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
+
1202
1226
/**
1203
1227
* Function to get skill by id
1204
1228
* @param {String } skillId the skill Id
@@ -1745,29 +1769,27 @@ async function substituteStringByObject (string, object) {
1745
1769
return string
1746
1770
}
1747
1771
1748
-
1749
1772
/**
1750
1773
* Get tags from tagging service
1751
1774
* @param {String } description The challenge description
1752
1775
* @returns {Array } array of tags
1753
1776
*/
1754
1777
async 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 } `
1758
1781
const res = await request
1759
1782
. post ( url )
1760
1783
. set ( 'Accept' , 'application/json' )
1761
1784
. send ( querystring . stringify ( data ) )
1762
1785
1763
1786
localLogger . debug ( {
1764
1787
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' )
1768
1791
}
1769
1792
1770
-
1771
1793
/**
1772
1794
* @param {Object } currentUser the user performing the action
1773
1795
* @param {Object } data title of project and any other info
@@ -1819,6 +1841,7 @@ module.exports = {
1819
1841
getMembers,
1820
1842
getProjectById,
1821
1843
getTopcoderSkills,
1844
+ getAllTopcoderSkills,
1822
1845
getSkillById,
1823
1846
ensureJobById,
1824
1847
ensureResourceBookingById,
0 commit comments