Missing trigger AppCreateListeners on route creation (if app not exists) (#358)

* trigger-app-listener-on-route-create

* remove fmt
This commit is contained in:
Pedro Nasser
2016-11-29 17:58:53 -02:00
committed by C Cirello
parent 8f6cd61ef0
commit 9f4cdf749c

View File

@@ -63,12 +63,27 @@ func (s *Server) handleRouteCreate(c *gin.Context) {
return
}
app, err = Api.Datastore.InsertApp(ctx, newapp)
err = Api.FireBeforeAppCreate(ctx, newapp)
if err != nil {
log.WithError(err).Errorln(models.ErrAppsCreate)
c.JSON(http.StatusInternalServerError, simpleError(err))
return
}
_, err = Api.Datastore.InsertApp(ctx, newapp)
if err != nil {
log.WithError(err).Error(models.ErrAppsCreate)
c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsCreate))
return
}
err = Api.FireAfterAppCreate(ctx, newapp)
if err != nil {
log.WithError(err).Errorln(models.ErrAppsCreate)
c.JSON(http.StatusInternalServerError, simpleError(err))
return
}
}
_, err = Api.Datastore.InsertRoute(ctx, wroute.Route)