mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* improvements on API error, swagger and status code * missing validation * removing typo * fix if-within-if * fix handle app delete
27 lines
594 B
Go
27 lines
594 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/iron-io/functions/api/models"
|
|
"github.com/iron-io/runner/common"
|
|
)
|
|
|
|
func (s *Server) handleAppList(c *gin.Context) {
|
|
ctx := c.MustGet("ctx").(context.Context)
|
|
log := common.Logger(ctx)
|
|
|
|
filter := &models.AppFilter{}
|
|
|
|
apps, err := s.Datastore.GetApps(ctx, filter)
|
|
if err != nil {
|
|
log.WithError(err).Error(models.ErrAppsList)
|
|
c.JSON(http.StatusInternalServerError, simpleError(ErrInternalServerError))
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, appsResponse{"Successfully listed applications", apps})
|
|
}
|