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 {
|
2024-12-28 15:10:57 +00:00
|
|
|
var destinations []models.BaseDestination
|
2024-12-28 16:03:00 +00:00
|
|
|
for _, value := range services.DestinationsByIndex {
|
2024-12-28 15:10:57 +00:00
|
|
|
var parsed models.BaseDestination
|
2024-12-28 16:21:29 +00:00
|
|
|
_ = jsoniter.Unmarshal(value.Raw, &parsed)
|
2024-12-28 17:20:56 +00:00
|
|
|
parsed.ID = value.Index
|
2024-12-28 14:27:39 +00:00
|
|
|
destinations = append(destinations, parsed)
|
|
|
|
}
|
|
|
|
return c.JSON(destinations)
|
|
|
|
}
|