mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
map
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/helpers/logging"
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/providers/geonames"
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/viewmodels"
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/xmlmodels"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
@@ -13,13 +14,13 @@ const (
|
||||
DEFAULT_PLACE = ""
|
||||
)
|
||||
|
||||
func GetPlace(kgpz *xmlmodels.Library) fiber.Handler {
|
||||
func GetPlace(kgpz *xmlmodels.Library, geonamesProvider *geonames.GeonamesProvider) fiber.Handler {
|
||||
return func(c *fiber.Ctx) error {
|
||||
placeID := c.Params("place", DEFAULT_PLACE)
|
||||
placeID = strings.ToLower(placeID)
|
||||
|
||||
// Get places data using view model
|
||||
places := viewmodels.PlacesView(placeID, kgpz)
|
||||
places := viewmodels.PlacesView(placeID, kgpz, geonamesProvider)
|
||||
|
||||
// If no places found at all, return 404
|
||||
if len(places.Places) == 0 {
|
||||
@@ -48,13 +49,13 @@ func GetPlace(kgpz *xmlmodels.Library) fiber.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
func GetPlaceFragment(kgpz *xmlmodels.Library) fiber.Handler {
|
||||
func GetPlaceFragment(kgpz *xmlmodels.Library, geonamesProvider *geonames.GeonamesProvider) fiber.Handler {
|
||||
return func(c *fiber.Ctx) error {
|
||||
placeID := c.Params("place", DEFAULT_PLACE)
|
||||
placeID = strings.ToLower(placeID)
|
||||
|
||||
// Get places data using view model
|
||||
places := viewmodels.PlacesView(placeID, kgpz)
|
||||
places := viewmodels.PlacesView(placeID, kgpz, geonamesProvider)
|
||||
|
||||
// If no places found at all, return 404
|
||||
if len(places.Places) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user