Paperclip/pkg/internal/server/api/destinations_api.go

20 lines
543 B
Go
Raw Normal View History

2024-12-28 14:27:39 +00:00
package api
import (
"git.solsynth.dev/hypernet/paperclip/pkg/internal/models"
2024-12-28 16:03:00 +00:00
"git.solsynth.dev/hypernet/paperclip/pkg/internal/services"
2024-12-28 14:27:39 +00:00
"github.com/gofiber/fiber/v2"
jsoniter "github.com/json-iterator/go"
)
func listDestination(c *fiber.Ctx) error {
var destinations []models.BaseDestination
2024-12-28 16:03:00 +00:00
for _, value := range services.DestinationsByIndex {
var parsed models.BaseDestination
_ = jsoniter.Unmarshal(value.Raw, &parsed)
parsed.ID = value.Index
2024-12-28 14:27:39 +00:00
destinations = append(destinations, parsed)
}
return c.JSON(destinations)
}