Skip to content

Commit 08a86ec

Browse files
Merge branch 'develop' into contentful-tabs-mobile
2 parents d4a2ae2 + d4fa135 commit 08a86ec

File tree

13 files changed

+82
-38
lines changed

13 files changed

+82
-38
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ workflows:
342342
filters:
343343
branches:
344344
only:
345-
- gigs-apply-integration
345+
- free
346346
# This is alternate dev env for parallel testing
347347
- "build-test":
348348
context : org-global
@@ -363,7 +363,7 @@ workflows:
363363
filters:
364364
branches:
365365
only:
366-
- contentful-tabs-mobile
366+
- free
367367
# This is stage env for production QA releases
368368
- "build-prod-staging":
369369
context : org-global

__tests__/shared/components/Header/__snapshots__/index.jsx.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,19 @@ exports[`Default render 1`] = `
8282
"title": "Competitive Programming",
8383
},
8484
Object {
85-
"href": "/thrive/tracks?track=Data%20Science&tax=",
85+
"href": "/thrive/tracks?track=Data%20Science",
8686
"title": "Data Science",
8787
},
8888
Object {
89-
"href": "/thrive/tracks?track=Design&tax=",
89+
"href": "/thrive/tracks?track=Design",
9090
"title": "Design",
9191
},
9292
Object {
93-
"href": "/thrive/tracks?track=Development&tax=",
93+
"href": "/thrive/tracks?track=Development",
9494
"title": "Development",
9595
},
9696
Object {
97-
"href": "/thrive/tracks?track=QA&tax=",
97+
"href": "/thrive/tracks?track=QA",
9898
"title": "QA",
9999
},
100100
],

config/default.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -358,19 +358,19 @@ module.exports = {
358358
},
359359
{
360360
title: 'Data Science',
361-
href: '/thrive/tracks?track=Data%20Science&tax=',
361+
href: '/thrive/tracks?track=Data%20Science',
362362
},
363363
{
364364
title: 'Design',
365-
href: '/thrive/tracks?track=Design&tax=',
365+
href: '/thrive/tracks?track=Design',
366366
},
367367
{
368368
title: 'Development',
369-
href: '/thrive/tracks?track=Development&tax=',
369+
href: '/thrive/tracks?track=Development',
370370
},
371371
{
372372
title: 'QA',
373-
href: '/thrive/tracks?track=QA&tax=',
373+
href: '/thrive/tracks?track=QA',
374374
},
375375
],
376376
},

config/production.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,19 @@ module.exports = {
139139
},
140140
{
141141
title: 'Data Science',
142-
href: '/thrive/tracks?track=Data%20Science&tax=',
142+
href: '/thrive/tracks?track=Data%20Science',
143143
},
144144
{
145145
title: 'Design',
146-
href: '/thrive/tracks?track=Design&tax=',
146+
href: '/thrive/tracks?track=Design',
147147
},
148148
{
149149
title: 'Development',
150-
href: '/thrive/tracks?track=Development&tax=',
150+
href: '/thrive/tracks?track=Development',
151151
},
152152
{
153153
title: 'QA',
154-
href: '/thrive/tracks?track=QA&tax=',
154+
href: '/thrive/tracks?track=QA',
155155
},
156156
],
157157
},

docs/swagger.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ components:
122122
description: "The availability of the user"
123123
default: true
124124
example: true
125+
skill:
126+
type: string
127+
description: "The candidate's skills separated via ,"
128+
example: "Java,Angular,SQL Server,JavaScript"
129+
salaryExpectation:
130+
type: integer
131+
description: "The candidate expected salary"
125132
hasProfile:
126133
type: boolean
127134
description: "Whether has profile for the user"

src/server/routes/recruitCRM.js

+36-13
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,42 @@ const routes = express.Router();
2424

2525
// Enables CORS on those routes according config above
2626
// ToDo configure CORS for set of our trusted domains
27-
routes.use(cors());
28-
routes.options('*', cors());
29-
30-
routes.get('/jobs', (req, res, next) => new RecruitCRMService().getAllJobs(req, res, next));
31-
routes.get('/jobs/cache', (req, res, next) => new RecruitCRMService().getJobsCacheStats(req, res, next));
32-
routes.get('/jobs/cache/flush', (req, res, next) => authenticator(authenticatorOptions)(req, res, next), (req, res, next) => new RecruitCRMService().getJobsCacheFlush(req, res, next));
33-
routes.get('/jobs/search', (req, res, next) => new RecruitCRMService().getJobs(req, res, next));
34-
routes.get('/jobs/:id', (req, res, next) => new RecruitCRMService().getJob(req, res, next));
35-
routes.post('/jobs/:id/apply', (req, res, next) => authenticator(authenticatorOptions)(req, res, next), upload.single('resume'), (req, res, next) => new RecruitCRMService().applyForJob(req, res, next));
36-
routes.get('/candidates/search', (req, res, next) => new RecruitCRMService().searchCandidates(req, res, next));
27+
// routes.use(cors());
28+
// routes.options('*', cors());
29+
30+
routes.options('/jobs', cors());
31+
routes.get('/jobs', cors(), (req, res, next) => new RecruitCRMService().getAllJobs(req, res, next));
32+
33+
routes.options('/jobs/cache', cors());
34+
routes.get('/jobs/cache', cors(), (req, res, next) => new RecruitCRMService().getJobsCacheStats(req, res, next));
35+
36+
routes.options('/jobs/cache/flush', cors());
37+
routes.get('/jobs/cache/flush', cors(), (req, res, next) => authenticator(authenticatorOptions)(req, res, next), (req, res, next) => new RecruitCRMService().getJobsCacheFlush(req, res, next));
38+
39+
routes.options('/jobs/search', cors());
40+
routes.get('/jobs/search', cors(), (req, res, next) => new RecruitCRMService().getJobs(req, res, next));
41+
42+
routes.options('/jobs/:id', cors());
43+
routes.get('/jobs/:id', cors(), (req, res, next) => new RecruitCRMService().getJob(req, res, next));
44+
45+
const applyOptions = {
46+
origin: true,
47+
methods: ['POST'],
48+
credentials: true,
49+
maxAge: 3600,
50+
allowedHeaders: ['Content-Type', 'Authorization'],
51+
};
52+
routes.options('/jobs/:id/apply', cors(applyOptions));
53+
routes.post('/jobs/:id/apply', cors(applyOptions), (req, res, next) => authenticator(authenticatorOptions)(req, res, next), upload.single('resume'), (req, res, next) => new RecruitCRMService().applyForJob(req, res, next));
54+
55+
routes.options('/candidates/search', cors());
56+
routes.get('/candidates/search', cors(), (req, res, next) => new RecruitCRMService().searchCandidates(req, res, next));
3757
// new router added
38-
routes.get('/profile', (req, res, next) => authenticator(authenticatorOptions)(req, res, next), (req, res, next) => new RecruitCRMService().getProfile(req, res, next));
39-
routes.post('/profile', (req, res, next) => authenticator(authenticatorOptions)(req, res, next), upload.single('resume'), (req, res, next) => new RecruitCRMService().updateProfile(req, res, next));
40-
routes.get('/taasjobs', (req, res, next) => new RecruitCRMService().getJobsFromTaas(req, res, next));
58+
routes.options('/profile', cors());
59+
routes.get('/profile', cors(), (req, res, next) => authenticator(authenticatorOptions)(req, res, next), (req, res, next) => new RecruitCRMService().getProfile(req, res, next));
60+
routes.post('/profile', cors(), (req, res, next) => authenticator(authenticatorOptions)(req, res, next), upload.single('resume'), (req, res, next) => new RecruitCRMService().updateProfile(req, res, next));
61+
62+
routes.options('/taasjobs', cors());
63+
routes.get('/taasjobs', cors(), (req, res, next) => new RecruitCRMService().getJobsFromTaas(req, res, next));
4164

4265
export default routes;

src/server/services/contentful.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ class ApiService {
134134
* @return {Promise}
135135
*/
136136
async queryEntries(query) {
137-
const res = await this.client.getEntries(query);
137+
const decode = o => _.mapValues(o, prop => (typeof prop === 'object' ? decode(prop) : decodeURIComponent(prop)));
138+
const decoded = decode(query);
139+
const res = await this.client.getEntries(decoded);
138140
return res.stringifySafe ? JSON.parse(res.stringifySafe()) : res;
139141
}
140142
}

src/server/services/recruitCRM.js

+2
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ export default class RecruitCRMService {
635635
const responseMapping = {
636636
hasProfile: true,
637637
phone: candidate.contact_number,
638+
salaryExpectation: candidate.salary_expectation,
639+
skill: candidate.skill,
638640
resume: candidate.resume,
639641
availability: _.isNil(candidate.available_from) ? true
640642
: new Date(candidate.available_from) <= new Date(),

src/shared/components/Contentful/Article/themes/default.scss

+2-3
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,8 @@
139139

140140
.catsContainer {
141141
display: flex;
142-
justify-content: flex-start;
143-
align-items: center;
144-
flex-wrap: wrap;
142+
flex-direction: column;
143+
align-items: flex-start;
145144
border-left: 3px solid #e9e9e9;
146145
padding-left: 7px;
147146
margin-bottom: 5px;

src/shared/components/Contentful/ArticleCard/themes/video.scss

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
min-height: 217px;
1010
display: flex;
1111
flex-direction: column;
12+
cursor: pointer;
1213

1314
@include xs-to-sm {
1415
margin: auto;

src/shared/components/Contentful/SearchPageFilter/FilterAuthor/themes/default.scss

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ $text-black: #2a2a2a;
8787
align-items: center;
8888
width: 100%;
8989
justify-content: flex-start;
90+
91+
&:last-child {
92+
height: auto;
93+
}
9094
}
9195

9296
span {

src/shared/containers/EDU/Search.jsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { updateQuery } from 'utils/url';
1313
import qs from 'qs';
1414
import LoadingIndicator from 'components/LoadingIndicator';
1515
import SearchPageFilter from 'components/Contentful/SearchPageFilter/SearchPageFilter';
16+
import moment from 'moment';
1617
// Partials
1718
import ResultTabs from './partials/ResultTabs';
1819
// CSS
@@ -66,8 +67,8 @@ export default class EDUSearch extends React.Component {
6667
const queryUpdate = {
6768
author: filterState.selectedAuthor,
6869
tags: filterState.tags,
69-
startDate: filterState.startDate.format('YYYY-MM-DD'),
70-
endDate: filterState.endDate.format('YYYY-MM-DD'),
70+
startDate: filterState.startDate instanceof moment ? filterState.startDate.format('YYYY-MM-DD') : moment(filterState.startDate).format('YYYY-MM-DD'),
71+
endDate: filterState.endDate instanceof moment ? filterState.endDate.format('YYYY-MM-DD') : moment(filterState.endDate).format('YYYY-MM-DD'),
7172
track: filterState.selectedCategory ? filterState.selectedCategory.title : null,
7273
tax: filterState.selectedCategory ? _.map(
7374
_.filter(filterState.selectedCategory.items, item => item.selected),
@@ -88,6 +89,8 @@ export default class EDUSearch extends React.Component {
8889
} = this.state;
8990
const title = 'Tutorials And Workshops That Matter | Thrive | Topcoder';
9091
const description = 'Thrive is our vault of content that we have been gathering over the years. It is full of tutorials and workshops that matter. Grow with us!';
92+
let inputSelectedFilter = '0';
93+
if (query.phrase) inputSelectedFilter = '1';
9194

9295
const metaTags = (
9396
<MetaTags
@@ -111,7 +114,10 @@ export default class EDUSearch extends React.Component {
111114
{/* Banner */}
112115
<div className={searchTheme.bannerContainer}>
113116
<div className={searchTheme.searchBarWrapp}>
114-
<SearchBar inputlVal={query.phrase || query.title} selectedFilter={query.phrase ? '1' : '0'} />
117+
<SearchBar
118+
inputlVal={query.phrase || query.title}
119+
inputSelectedFilter={inputSelectedFilter}
120+
/>
115121
</div>
116122
</div>
117123
<div className={searchTheme.shapeBanner} />

src/shared/services/contentful.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class Service {
316316
// thus we need to find it first
317317
await this.queryEntries({
318318
content_type: 'person',
319-
query: encodeURIComponent(author),
319+
query: author,
320320
})
321321
.then((result) => {
322322
query['fields.contentAuthor.sys.id'] = result.total ? result.items[0].sys.id : 'NO_SUCH_ID';
@@ -340,12 +340,12 @@ class Service {
340340
}
341341
if (track) query['fields.trackCategory'] = track;
342342
if (!_.isEmpty(tags)) {
343-
query['fields.tags[all]'] = tags.map(t => encodeURIComponent(t)).join(',');
343+
query['fields.tags[all]'] = tags.map(t => t).join(',');
344344
}
345345
if (startDate) query['fields.creationDate[gte]'] = startDate;
346346
if (endDate) query['fields.creationDate[lte]'] = endDate;
347-
if (phrase) query.query = encodeURIComponent(phrase);
348-
if (title) query['fields.title[match]'] = encodeURIComponent(title);
347+
if (phrase) query.query = phrase;
348+
if (title) query['fields.title[match]'] = title;
349349
if (sortBy) {
350350
switch (sortBy) {
351351
case 'Likes': query.order = '-fields.upvotes,-fields.creationDate'; break;

0 commit comments

Comments
 (0)