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 = [
213
213
transaction : t ,
214
214
} ) ;
215
215
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
+
216
225
await models . CopilotApplication . update ( {
217
226
status : COPILOT_APPLICATION_STATUS . CANCELED ,
218
227
} , {
219
228
where : {
220
- opportunityId : {
221
- [ Op . in ] : allCopilotOpportunityByRequestIds . map ( item => item . id ) ,
229
+ id : {
230
+ [ Op . in ] : copilotApplications . map ( item => item . id ) ,
222
231
} ,
223
232
} ,
224
233
transaction : t ,
225
234
} ) ;
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
+ } ) ;
226
248
}
227
249
228
250
await t . commit ( ) ;
You can’t perform that action at this time.
0 commit comments