mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
refactor
This commit is contained in:
44
api/server/apps_update.go
Normal file
44
api/server/apps_update.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
)
|
||||
|
||||
func handleAppUpdate(c *gin.Context) {
|
||||
log := c.MustGet("log").(logrus.FieldLogger)
|
||||
|
||||
app := &models.App{}
|
||||
|
||||
err := c.BindJSON(app)
|
||||
if err != nil {
|
||||
log.WithError(err).Debug(models.ErrInvalidJSON)
|
||||
c.JSON(http.StatusBadRequest, simpleError(models.ErrInvalidJSON))
|
||||
return
|
||||
}
|
||||
|
||||
if 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))
|
||||
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
|
||||
// }
|
||||
|
||||
// Nothing to update right now in apps
|
||||
c.JSON(http.StatusOK, simpleError(models.ErrAppsNothingToUpdate))
|
||||
}
|
||||
Reference in New Issue
Block a user