aboutsummaryrefslogtreecommitdiff
path: root/application_router.go
diff options
context:
space:
mode:
Diffstat (limited to 'application_router.go')
-rw-r--r--application_router.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/application_router.go b/application_router.go
index 6d65960..1288eb1 100644
--- a/application_router.go
+++ b/application_router.go
@@ -20,14 +20,15 @@ package main
import (
"errors"
"fmt"
- "github.com/gin-gonic/contrib/static"
- "github.com/gin-gonic/gin"
- log "github.com/sirupsen/logrus"
"net/http"
"os"
"path/filepath"
"strings"
"time"
+
+ "github.com/gin-gonic/contrib/static"
+ "github.com/gin-gonic/gin"
+ log "github.com/sirupsen/logrus"
)
func CreateApplicationRouter(applicationContext *ApplicationContext,
@@ -389,6 +390,20 @@ func CreateApplicationRouter(applicationContext *ApplicationContext,
}
})
+ api.DELETE("/services", func(c *gin.Context) {
+ var service Service
+ if err := c.ShouldBindJSON(&service); err != nil {
+ badRequest(c, err)
+ return
+ }
+ if err := applicationContext.ServicesController.DeleteService(c, service); err == nil {
+ success(c, service)
+ notificationController.Notify("services.edit", service)
+ } else {
+ unprocessableEntity(c, err)
+ }
+ })
+
api.GET("/statistics", func(c *gin.Context) {
var filter StatisticsFilter
if err := c.ShouldBindQuery(&filter); err != nil {