diff --git a/momentum-core/routers/application-router.go b/momentum-core/routers/application-router.go index 984fdde..6529a0b 100644 --- a/momentum-core/routers/application-router.go +++ b/momentum-core/routers/application-router.go @@ -118,6 +118,7 @@ func (a *ApplicationRouter) addApplication(c *gin.Context) { application, err := a.applicationService.AddApplication(request, traceId) if err != nil { + transaction.Rollback(ctx) c.IndentedJSON(http.StatusBadRequest, models.NewApiError(err, http.StatusBadRequest, c, traceId)) config.LOGGER.LogError(err.Error(), err, traceId) return diff --git a/momentum-core/routers/deployment-router.go b/momentum-core/routers/deployment-router.go index 45f43c9..26a80c0 100644 --- a/momentum-core/routers/deployment-router.go +++ b/momentum-core/routers/deployment-router.go @@ -98,6 +98,7 @@ func (d *DeploymentRouter) addDeployment(c *gin.Context) { deployment, err := d.deploymentService.AddDeployment(request, traceId) if err != nil { + transaction.Rollback(ctx) c.IndentedJSON(http.StatusBadRequest, models.NewApiError(err, http.StatusBadRequest, c, traceId)) config.LOGGER.LogError(err.Error(), err, traceId) return diff --git a/momentum-core/routers/stage-router.go b/momentum-core/routers/stage-router.go index 8bbd761..0ab8734 100644 --- a/momentum-core/routers/stage-router.go +++ b/momentum-core/routers/stage-router.go @@ -98,6 +98,7 @@ func (sr *StageRouter) addStage(c *gin.Context) { stage, err := sr.stageService.AddStage(request, traceId) if err != nil { + transaction.Rollback(ctx) c.IndentedJSON(http.StatusBadRequest, models.NewApiError(err, http.StatusBadRequest, c, traceId)) config.LOGGER.LogError(err.Error(), err, traceId) return