2024-12-28 14:27:39 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.solsynth.dev/hypernet/paperclip/pkg/internal/models"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
jsoniter "github.com/json-iterator/go"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
func listDestination(c *fiber.Ctx) error {
|
2024-12-28 15:10:57 +00:00
|
|
|
var destinations []models.BaseDestination
|
2024-12-28 14:27:39 +00:00
|
|
|
for _, value := range viper.GetStringSlice("destinations") {
|
2024-12-28 15:10:57 +00:00
|
|
|
var parsed models.BaseDestination
|
2024-12-28 14:27:39 +00:00
|
|
|
raw, _ := jsoniter.Marshal(value)
|
|
|
|
_ = jsoniter.Unmarshal(raw, &parsed)
|
|
|
|
destinations = append(destinations, parsed)
|
|
|
|
}
|
|
|
|
return c.JSON(destinations)
|
|
|
|
}
|