@@ -5,7 +5,7 @@ import { EVENT, BUS_API_EVENT, PROJECT_STATUS, PROJECT_PHASE_STATUS, PROJECT_MEM
55 from '../constants' ;
66import { createEvent } from '../services/busApi' ;
77import models from '../models' ;
8- import { getTopcoderProjectMembers , isSSO } from '../util' ;
8+ import util from '../util' ;
99
1010/**
1111 * Map of project status and event name sent to bus api
@@ -367,7 +367,7 @@ module.exports = (app, logger) => {
367367 userId : req . authUser . userId ,
368368 initiatorUserId : req . authUser . userId ,
369369 allowedUsers : created . status === PROJECT_PHASE_STATUS . DRAFT ?
370- getTopcoderProjectMembers ( project . members ) : null ,
370+ util . getTopcoderProjectMembers ( project . members ) : null ,
371371 } , logger ) ;
372372 return sendPlanReadyEventIfNeeded ( req , project , created ) ;
373373 } ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
@@ -393,7 +393,7 @@ module.exports = (app, logger) => {
393393 userId : req . authUser . userId ,
394394 initiatorUserId : req . authUser . userId ,
395395 allowedUsers : deleted . status === PROJECT_PHASE_STATUS . DRAFT ?
396- getTopcoderProjectMembers ( project . members ) : null ,
396+ util . getTopcoderProjectMembers ( project . members ) : null ,
397397 } , logger ) ;
398398 } ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
399399 } ) ;
@@ -446,7 +446,7 @@ module.exports = (app, logger) => {
446446 userId : req . authUser . userId ,
447447 initiatorUserId : req . authUser . userId ,
448448 allowedUsers : updated . status === PROJECT_PHASE_STATUS . DRAFT ?
449- getTopcoderProjectMembers ( project . members ) : null ,
449+ util . getTopcoderProjectMembers ( project . members ) : null ,
450450 } , logger ) ) ;
451451 events . forEach ( ( event ) => { eventsMap [ event ] = true ; } ) ;
452452 }
@@ -493,7 +493,7 @@ module.exports = (app, logger) => {
493493 userId : req . authUser . userId ,
494494 initiatorUserId : req . authUser . userId ,
495495 allowedUsers : updated . status === PROJECT_PHASE_STATUS . DRAFT ?
496- getTopcoderProjectMembers ( project . members ) : null ,
496+ util . getTopcoderProjectMembers ( project . members ) : null ,
497497 } , logger ) ;
498498 }
499499 } ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
@@ -704,27 +704,36 @@ module.exports = (app, logger) => {
704704 where : { id : projectId } ,
705705 } )
706706 . then ( ( project ) => {
707+ logger . debug ( util . isSSO ) ;
707708 if ( status === INVITE_STATUS . REQUESTED ) {
708709 createEvent ( BUS_API_EVENT . PROJECT_MEMBER_INVITE_REQUESTED , {
709710 projectId,
710711 userId,
711712 email,
712713 role,
713714 initiatorUserId : req . authUser . userId ,
714- isSSO : isSSO ( project ) ,
715+ isSSO : util . isSSO ( project ) ,
715716 } , logger ) ;
716717 } else {
717718 // send event to bus api
719+ logger . debug ( JSON . stringify ( {
720+ projectId,
721+ userId,
722+ email,
723+ role,
724+ initiatorUserId : req . authUser . userId ,
725+ isSSO : util . isSSO ( project ) ,
726+ } ) ) ;
718727 createEvent ( BUS_API_EVENT . PROJECT_MEMBER_INVITE_CREATED , {
719728 projectId,
720729 userId,
721730 email,
722731 role,
723732 initiatorUserId : req . authUser . userId ,
724- isSSO : isSSO ( project ) ,
733+ isSSO : util . isSSO ( project ) ,
725734 } , logger ) ;
726735 }
727- } ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
736+ } ) . catch ( err => logger . error ( err ) ) ; // eslint-disable-line no-unused-vars
728737 } ) ;
729738
730739 app . on ( EVENT . ROUTING_KEY . PROJECT_MEMBER_INVITE_UPDATED , ( { req, userId, email, status, role, createdBy } ) => {
@@ -735,6 +744,7 @@ module.exports = (app, logger) => {
735744 where : { id : projectId } ,
736745 } )
737746 . then ( ( project ) => {
747+ logger . debug ( util . isSSO ) ;
738748 if ( status === INVITE_STATUS . REQUEST_APPROVED ) {
739749 // send event to bus api
740750 createEvent ( BUS_API_EVENT . PROJECT_MEMBER_INVITE_APPROVED , {
@@ -745,7 +755,7 @@ module.exports = (app, logger) => {
745755 role,
746756 status,
747757 initiatorUserId : req . authUser . userId ,
748- isSSO : isSSO ( project ) ,
758+ isSSO : util . isSSO ( project ) ,
749759 } , logger ) ;
750760 } else if ( status === INVITE_STATUS . REQUEST_REJECTED ) {
751761 // send event to bus api
@@ -757,7 +767,7 @@ module.exports = (app, logger) => {
757767 role,
758768 status,
759769 initiatorUserId : req . authUser . userId ,
760- isSSO : isSSO ( project ) ,
770+ isSSO : util . isSSO ( project ) ,
761771 } , logger ) ;
762772 } else {
763773 // send event to bus api
@@ -768,7 +778,7 @@ module.exports = (app, logger) => {
768778 role,
769779 status,
770780 initiatorUserId : req . authUser . userId ,
771- isSSO : isSSO ( project ) ,
781+ isSSO : util . isSSO ( project ) ,
772782 } , logger ) ;
773783 }
774784 } ) . catch ( err => null ) ; // eslint-disable-line no-unused-vars
0 commit comments