mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
added config to apps and routes
This commit is contained in:
@@ -14,34 +14,30 @@ func handleAppUpdate(c *gin.Context) {
|
||||
ctx := c.MustGet("ctx").(context.Context)
|
||||
log := titancommon.Logger(ctx)
|
||||
|
||||
app := &models.App{}
|
||||
wapp := models.AppWrapper{}
|
||||
|
||||
err := c.BindJSON(app)
|
||||
err := c.BindJSON(&wapp)
|
||||
if err != nil {
|
||||
log.WithError(err).Debug(models.ErrInvalidJSON)
|
||||
c.JSON(http.StatusBadRequest, simpleError(models.ErrInvalidJSON))
|
||||
return
|
||||
}
|
||||
|
||||
if app == nil {
|
||||
if wapp.App == nil {
|
||||
log.Debug(models.ErrAppsMissingNew)
|
||||
c.JSON(http.StatusBadRequest, simpleError(models.ErrAppsMissingNew))
|
||||
return
|
||||
}
|
||||
|
||||
if err := app.Validate(); err != nil {
|
||||
log.Error(err)
|
||||
c.JSON(http.StatusInternalServerError, simpleError(err))
|
||||
app, err := Api.Datastore.StoreApp(wapp.App)
|
||||
if err != nil {
|
||||
log.WithError(err).Debug(models.ErrAppsCreate)
|
||||
c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsCreate))
|
||||
return
|
||||
}
|
||||
|
||||
// app, err := Api.Datastore.StoreApp(wapp.App)
|
||||
// if err != nil {
|
||||
// log.WithError(err).Debug(models.ErrAppsCreate)
|
||||
// c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsCreate))
|
||||
// return
|
||||
// }
|
||||
wapp.App = app
|
||||
|
||||
// Nothing to update right now in apps
|
||||
c.JSON(http.StatusOK, simpleError(models.ErrAppsNothingToUpdate))
|
||||
c.JSON(http.StatusOK, appResponse{"App successfully updated", wapp})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user