Skip to content

Commit

Permalink
✨ Index in list destination api
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleSheep2Code committed Dec 28, 2024
1 parent e89f149 commit b7bedb8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/internal/models/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const (
)

type BaseDestination struct {
ID int `json:"id,omitempty"` // Auto filled with index, only for user
Type string `json:"type"`
Label string `json:"label"`
Region string `json:"region"`
Expand Down
1 change: 1 addition & 0 deletions pkg/internal/server/api/destinations_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func listDestination(c *fiber.Ctx) error {
for _, value := range services.DestinationsByIndex {
var parsed models.BaseDestination
_ = jsoniter.Unmarshal(value.Raw, &parsed)
parsed.ID = value.Index
destinations = append(destinations, parsed)
}
return c.JSON(destinations)
Expand Down

0 comments on commit b7bedb8

Please sign in to comment.