File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ module.exports = [
1717 const phaseId = _ . parseInt ( req . params . phaseId ) ;
1818 const productId = _ . parseInt ( req . params . productId ) ;
1919
20- models . sequelize . transaction ( ( ) =>
20+ models . sequelize . transaction ( transaction =>
2121 // soft delete the record
2222 models . PhaseProduct . findOne ( {
2323 where : {
@@ -34,17 +34,17 @@ module.exports = [
3434 err . status = 404 ;
3535 return Promise . reject ( err ) ;
3636 }
37- return existing . update ( { deletedBy : req . authUser . userId } ) ;
37+ return existing . update ( { deletedBy : req . authUser . userId } , { transaction } ) ;
3838 } )
39- . then ( entity => entity . destroy ( ) ) )
39+ . then ( entity => entity . destroy ( { transaction } ) ) )
4040 . then ( ( deleted ) => {
4141 req . log . debug ( 'deleted phase product' , JSON . stringify ( deleted , null , 2 ) ) ;
4242 // emit the event
4343 util . sendResourceToKafkaBus (
4444 req ,
4545 EVENT . ROUTING_KEY . PROJECT_PHASE_PRODUCT_REMOVED ,
4646 RESOURCES . PHASE_PRODUCT ,
47- _ . pick ( deleted . toJSON ( ) , [ 'id' , 'projectId' ] ) ) ;
47+ _ . pick ( deleted . toJSON ( ) , [ 'id' , 'projectId' , 'phaseId' ] ) ) ;
4848
4949 res . status ( 204 ) . json ( { } ) ;
5050 } )
You can’t perform that action at this time.
0 commit comments