File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments