@@ -409,10 +409,20 @@ module.exports = class MentorsHelper {
409
409
raw : true ,
410
410
} )
411
411
412
- if ( updateCount === '0' ) {
413
- return common . failureResponse ( {
414
- statusCode : httpStatusCode . not_found ,
415
- message : 'MENTOR_EXTENSION_NOT_FOUND' ,
412
+ if ( updateCount === 0 ) {
413
+ const fallbackUpdatedUser = await mentorQueries . getMentorExtension ( userId )
414
+ if ( ! fallbackUpdatedUser ) {
415
+ return common . failureResponse ( {
416
+ statusCode : httpStatusCode . not_found ,
417
+ message : 'MENTOR_EXTENSION_NOT_FOUND' ,
418
+ } )
419
+ }
420
+
421
+ const processDbResponse = utils . processDbResponse ( fallbackUpdatedUser , validationData )
422
+ return common . successResponse ( {
423
+ statusCode : httpStatusCode . ok ,
424
+ message : 'MENTOR_EXTENSION_UPDATED' ,
425
+ result : processDbResponse ,
416
426
} )
417
427
}
418
428
@@ -557,11 +567,11 @@ module.exports = class MentorsHelper {
557
567
[ Op . in ] : [ orgId , defaultOrgId ] ,
558
568
} ,
559
569
} )
560
- console . log ( 'mentorExtension' , mentorExtension )
570
+
561
571
// validationData = utils.removeParentEntityTypes(JSON.parse(JSON.stringify(validationData)))
562
572
const validationData = removeDefaultOrgEntityTypes ( entityTypes , orgId )
563
573
const processDbResponse = utils . processDbResponse ( mentorExtension , validationData )
564
- console . log ( processDbResponse )
574
+
565
575
const totalSessionHosted = await sessionQueries . countHostedSessions ( id )
566
576
567
577
const totalSession = await sessionAttendeesQueries . countEnrolledSessions ( id )
0 commit comments