✨ Index in list destination api
This commit is contained in:
parent
e89f149336
commit
b7bedb8dfc
@ -6,6 +6,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type BaseDestination struct {
|
type BaseDestination struct {
|
||||||
|
ID int `json:"id,omitempty"` // Auto filled with index, only for user
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
Region string `json:"region"`
|
Region string `json:"region"`
|
||||||
|
@ -12,6 +12,7 @@ func listDestination(c *fiber.Ctx) error {
|
|||||||
for _, value := range services.DestinationsByIndex {
|
for _, value := range services.DestinationsByIndex {
|
||||||
var parsed models.BaseDestination
|
var parsed models.BaseDestination
|
||||||
_ = jsoniter.Unmarshal(value.Raw, &parsed)
|
_ = jsoniter.Unmarshal(value.Raw, &parsed)
|
||||||
|
parsed.ID = value.Index
|
||||||
destinations = append(destinations, parsed)
|
destinations = append(destinations, parsed)
|
||||||
}
|
}
|
||||||
return c.JSON(destinations)
|
return c.JSON(destinations)
|
||||||
|
Loading…
Reference in New Issue
Block a user