File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
src/routes/projectMemberInvites Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -213,16 +213,38 @@ module.exports = [
213213 transaction : t ,
214214 } ) ;
215215
216+ const copilotApplications = await models . CopilotApplication . findAll ( {
217+ where : {
218+ opportunityId : {
219+ [ Op . in ] : allCopilotOpportunityByRequestIds . map ( item => item . id ) ,
220+ } ,
221+ } ,
222+ transaction : t ,
223+ } ) ;
224+
216225 await models . CopilotApplication . update ( {
217226 status : COPILOT_APPLICATION_STATUS . CANCELED ,
218227 } , {
219228 where : {
220- opportunityId : {
221- [ Op . in ] : allCopilotOpportunityByRequestIds . map ( item => item . id ) ,
229+ id : {
230+ [ Op . in ] : copilotApplications . map ( item => item . id ) ,
222231 } ,
223232 } ,
224233 transaction : t ,
225234 } ) ;
235+
236+ // Cancel the existing invites which are opened via
237+ // applications
238+ await models . ProjectMemberInvite . update ( {
239+ status : INVITE_STATUS . CANCELED ,
240+ } , {
241+ where : {
242+ applicationId : {
243+ [ Op . in ] : copilotApplications . map ( item => item . id ) ,
244+ }
245+ } ,
246+ transaction : t ,
247+ } ) ;
226248 }
227249
228250 await t . commit ( ) ;
You can’t perform that action at this time.
0 commit comments