diff pkg/controllers/publish.go @ 473:b2dea4e56ff1

/api/published (GET) returns a JSON document of the geo-services published by the gemma server.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 23 Aug 2018 13:24:26 +0200
parents
children 11d80120ed3d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pkg/controllers/publish.go	Thu Aug 23 13:24:26 2018 +0200
@@ -0,0 +1,21 @@
+package controllers
+
+import (
+	"database/sql"
+	"net/http"
+
+	"gemma.intevation.de/gemma/pkg/models"
+)
+
+func published(_ interface{}, req *http.Request, _ *sql.DB) (jr JSONResult, err error) {
+	jr = JSONResult{
+		Result: struct {
+			Internal []models.PubEntry `json:"internal"`
+			External []models.ExtEntry `json:"external"`
+		}{
+			Internal: models.PublishedServices.Filter(models.PublishedAll),
+			External: models.ExternalServices.Filter(models.ExternalAll),
+		},
+	}
+	return
+}