Skip to content

Commit f255d1b

Browse files
author
dengjun
committed
ci:adjust proxy api
1 parent a2ce444 commit f255d1b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/swagger.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ paths:
4444
content:
4545
application/json:
4646
schema:
47-
$ref: "#/components/schemas/Error"
47+
$ref: "#/components/schemas/Profile"
4848
"500":
4949
description: Internal Server Error
5050
content:
@@ -122,6 +122,9 @@ components:
122122
description: "The availability of the user"
123123
default: true
124124
example: true
125+
hasProfile:
126+
type: boolean
127+
description: "Whether has profile for the user"
125128
ProfileUpdate:
126129
required:
127130
- phone

src/server/services/recruitCRM.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,14 @@ export default class RecruitCRMService {
469469
if (candidate.error) {
470470
const error = candidate;
471471
logger.error(error);
472-
return res.status(error.status).send(error);
472+
const responseNoProfileMapping = {
473+
hasProfile: false,
474+
};
475+
return res.send(responseNoProfileMapping);
473476
}
474477
// apply desired response format
475478
const responseMapping = {
479+
hasProfile: true,
476480
phone: candidate.contact_number,
477481
resume: candidate.resume,
478482
availability: _.isNil(candidate.available_from) ? true
@@ -595,7 +599,7 @@ export default class RecruitCRMService {
595599
}
596600
const data = await response.json();
597601
// return error object if candidate with provided email not found
598-
if (data.data.length === 0) {
602+
if ((_.isArray(data) && data.length === 0) || data.data.length === 0) {
599603
const error = {
600604
error: true,
601605
status: 404,

0 commit comments

Comments
 (0)