Skip to content

Commit 5aa0fdf

Browse files
Revert "support for job descriptions"
1 parent 1909681 commit 5aa0fdf

File tree

10 files changed

+26
-96
lines changed

10 files changed

+26
-96
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ node_modules
66
_auto_doc_
77
.vscode
88
topcoder-react-lib-*.*.*.tgz
9-
.idea

__tests__/__snapshots__/index.js.snap

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ Object {
7272
"getReviewTypesInit": [Function],
7373
"getSkillTagsDone": [Function],
7474
"getSkillTagsInit": [Function],
75-
"getTechnologiesDone": [Function],
76-
"getTechnologiesInit": [Function],
7775
"getTypesDone": [Function],
7876
"getTypesInit": [Function],
7977
},

__tests__/actions/__snapshots__/lookup.js.snap

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Object {
1717
"getReviewTypesInit": [Function],
1818
"getSkillTagsDone": [Function],
1919
"getSkillTagsInit": [Function],
20-
"getTechnologiesDone": [Function],
21-
"getTechnologiesInit": [Function],
2220
"getTypesDone": [Function],
2321
"getTypesInit": [Function],
2422
},

__tests__/reducers/__snapshots__/lookup.js.snap

-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Object {
2727
"status": "APPROVED",
2828
},
2929
],
30-
"technologies": Array [],
3130
"types": Array [],
3231
}
3332
`;
@@ -59,7 +58,6 @@ Object {
5958
"status": "APPROVED",
6059
},
6160
],
62-
"technologies": Array [],
6361
"types": Array [],
6462
}
6563
`;
@@ -85,7 +83,6 @@ Object {
8583
"status": "APPROVED",
8684
},
8785
],
88-
"technologies": Array [],
8986
"types": Array [],
9087
}
9188
`;
@@ -111,7 +108,6 @@ Object {
111108
"status": "APPROVED",
112109
},
113110
],
114-
"technologies": Array [],
115111
"types": Array [],
116112
}
117113
`;
@@ -129,7 +125,6 @@ Object {
129125
"oses": Array [],
130126
"reviewTypes": Array [],
131127
"skillTags": Array [],
132-
"technologies": Array [],
133128
"types": Array [],
134129
}
135130
`;
@@ -161,7 +156,6 @@ Object {
161156
"status": "APPROVED",
162157
},
163158
],
164-
"technologies": Array [],
165159
"types": Array [],
166160
}
167161
`;
@@ -193,7 +187,6 @@ Object {
193187
"status": "APPROVED",
194188
},
195189
],
196-
"technologies": Array [],
197190
"types": Array [],
198191
}
199192
`;
@@ -219,7 +212,6 @@ Object {
219212
"status": "APPROVED",
220213
},
221214
],
222-
"technologies": Array [],
223215
"types": Array [],
224216
}
225217
`;
@@ -245,7 +237,6 @@ Object {
245237
"status": "APPROVED",
246238
},
247239
],
248-
"technologies": Array [],
249240
"types": Array [],
250241
}
251242
`;
@@ -263,7 +254,6 @@ Object {
263254
"oses": Array [],
264255
"reviewTypes": Array [],
265256
"skillTags": Array [],
266-
"technologies": Array [],
267257
"types": Array [],
268258
}
269259
`;

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
3232
"test": "npm run lint && npm run jest"
3333
},
34-
"version": "1000.25.8",
34+
"version": "1000.25.7",
3535
"dependencies": {
3636
"auth0-js": "^6.8.4",
3737
"config": "^3.2.0",

src/actions/lookup.js

-18
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,6 @@ function getAllCountriesDone(tokenV3) {
173173
return getService(tokenV3).getAllCountries();
174174
}
175175

176-
/**
177-
* @static
178-
* @desc Creates an action that signals beginning of getting all technologies.
179-
* @return {Action}
180-
*/
181-
function getTechnologiesInit() {}
182-
183-
/**
184-
* @static
185-
* @desc Creates an action that gets all technologies.
186-
* @return {Action}
187-
*/
188-
function getTechnologiesDone() {
189-
return getService().getTechnologies();
190-
}
191-
192176
export default createActions({
193177
LOOKUP: {
194178
GET_TYPES_INIT: getTypesInit,
@@ -207,7 +191,5 @@ export default createActions({
207191
GET_REVIEW_TYPES_DONE: getReviewTypesDone,
208192
GET_ALL_COUNTRIES_INIT: getAllCountriesInit,
209193
GET_ALL_COUNTRIES_DONE: getAllCountriesDone,
210-
GET_TECHNOLOGIES_INIT: getTechnologiesInit,
211-
GET_TECHNOLOGIES_DONE: getTechnologiesDone,
212194
},
213195
});

src/reducers/lookup.js

-22
Original file line numberDiff line numberDiff line change
@@ -236,25 +236,6 @@ function onGetAllCountriesDone(state, { payload, error }) {
236236
});
237237
}
238238

239-
/**
240-
* Handles LOOKUP/GET_TECHNOLOGIES_DONE action.
241-
* @param {Object} state
242-
* @param {Object} action Payload will be JSON from api call
243-
* @return {Object} New state
244-
*/
245-
function onGetTechnologiesDone(state, { payload, error }) {
246-
if (error) {
247-
logger.error('Failed to get technologies', payload);
248-
return { ...state, loadingTechnologiesError: true };
249-
}
250-
251-
return ({
252-
...state,
253-
loadingTechnologiesError: false,
254-
technologies: payload,
255-
});
256-
}
257-
258239
/**
259240
* Creates a new Lookup reducer with the specified initial state.
260241
* @param {Object} initialState Optional. Initial state.
@@ -279,8 +260,6 @@ function create(initialState = {}) {
279260
[a.getReviewTypesDone]: onGetReviewTypesDone,
280261
[a.getAllCountriesInit]: state => state,
281262
[a.getAllCountriesDone]: onGetAllCountriesDone,
282-
[a.getTechnologiesInit]: state => state,
283-
[a.getTechnologiesDone]: onGetTechnologiesDone,
284263
}, _.defaults(initialState, {
285264
skillTags: [],
286265
countries: [],
@@ -294,7 +273,6 @@ function create(initialState = {}) {
294273
osPage: 1,
295274
hasMoreOses: false,
296275
reviewTypes: [],
297-
technologies: [],
298276
}));
299277
}
300278

src/services/lookup.js

-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class LookupService {
1515
constructor(tokenV3) {
1616
this.private = {
1717
api: getApi('V3', tokenV3),
18-
apiV4: getApi('V4', tokenV3),
1918
apiV5: getApi('V5', tokenV3),
2019
tokenV3,
2120
};
@@ -120,15 +119,6 @@ class LookupService {
120119
}
121120
return [];
122121
}
123-
124-
/**
125-
* Gets all technologies.
126-
* @return {Promise} Resolves to the review types.
127-
*/
128-
async getTechnologies() {
129-
const res = await this.private.apiV4.get('/technologies');
130-
return getApiResponsePayload(res);
131-
}
132122
}
133123

134124
let lastInstance = null;

src/services/user-traits.js

+24-29
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,9 @@
44
* via API V3.
55
*/
66
import toCapitalCase from 'to-capital-case';
7+
import { getApiResponsePayload } from '../utils/tc';
78
import { getApi } from './api';
89

9-
/**
10-
* Private. Handles given response from the member's traits API.
11-
* @param {Object} response
12-
* @return {Promise} On success resolves to the data fetched from the API.
13-
*/
14-
function handleApiResponse(response) {
15-
if (!response.ok) throw new Error(response.statusText);
16-
return response.json();
17-
}
18-
1910
/**
2011
* Service class.
2112
*/
@@ -25,7 +16,7 @@ class UserTraitsService {
2516
*/
2617
constructor(tokenV3) {
2718
this.private = {
28-
api: getApi('V5', tokenV3),
19+
api: getApi('V3', tokenV3),
2920
tokenV3,
3021
};
3122
}
@@ -38,7 +29,7 @@ class UserTraitsService {
3829
async getAllUserTraits(handle) {
3930
// FIXME: Remove the .toLowerCase() when the API is fixed to ignore the case in the route params
4031
const res = await this.private.api.get(`/members/${handle.toLowerCase()}/traits`);
41-
return handleApiResponse(res);
32+
return getApiResponsePayload(res);
4233
}
4334

4435
/**
@@ -49,17 +40,18 @@ class UserTraitsService {
4940
* @return {Promise} Resolves to the member traits.
5041
*/
5142
async addUserTrait(handle, traitId, data) {
52-
const body = [{
53-
traitId,
54-
categoryName: toCapitalCase(traitId),
55-
traits: {
43+
const body = {
44+
param: [{
5645
traitId,
57-
data,
58-
},
59-
}];
46+
categoryName: toCapitalCase(traitId),
47+
traits: {
48+
data,
49+
},
50+
}],
51+
};
6052

6153
const res = await this.private.api.postJson(`/members/${handle}/traits`, body);
62-
return handleApiResponse(res);
54+
return getApiResponsePayload(res);
6355
}
6456

6557
/**
@@ -70,16 +62,18 @@ class UserTraitsService {
7062
* @return {Promise} Resolves to the member traits.
7163
*/
7264
async updateUserTrait(handle, traitId, data) {
73-
const body = [{
74-
traitId,
75-
categoryName: toCapitalCase(traitId),
76-
traits: {
77-
data,
78-
},
79-
}];
65+
const body = {
66+
param: [{
67+
traitId,
68+
categoryName: toCapitalCase(traitId),
69+
traits: {
70+
data,
71+
},
72+
}],
73+
};
8074

8175
const res = await this.private.api.putJson(`/members/${handle}/traits`, body);
82-
return handleApiResponse(res);
76+
return getApiResponsePayload(res);
8377
}
8478

8579
/**
@@ -89,7 +83,8 @@ class UserTraitsService {
8983
* @return {Promise} Resolves to the member traits.
9084
*/
9185
async deleteUserTrait(handle, traitId) {
92-
await this.private.api.delete(`/members/${handle}/traits?traitIds=${traitId}`);
86+
const res = await this.private.api.delete(`/members/${handle}/traits?traitIds=${traitId}`);
87+
return getApiResponsePayload(res);
9388
}
9489
}
9590

0 commit comments

Comments
 (0)