diff --git a/README.md b/README.md index 506997d..a4289d1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This repo refers to the Airline service used by ACME Sky. It is a REST API backend used by ACME Sky to find new flights and receive new -offerts. +offers. ## Build diff --git a/cmd/main.go b/cmd/main.go index a581846..373b6ca 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -68,7 +68,7 @@ func main() { hooks.POST("/", handlers.HookHandlerPost) hooks.GET("/:id/", handlers.HookHandlerGetId) hooks.PUT("/:id/", handlers.HookHandlerPut) - hooks.POST("/offert/", handlers.HookHandlerOffert) + hooks.POST("/offer/", handlers.HookHandlerOffer) } } diff --git a/internal/handlers/hook.go b/internal/handlers/hook.go index d56449e..8353245 100644 --- a/internal/handlers/hook.go +++ b/internal/handlers/hook.go @@ -78,17 +78,17 @@ func HookHandlerPut(c *gin.Context) { c.JSON(http.StatusOK, hook) } -// Handle POST request to send an offert to all the saved hooks. +// Handle POST request to send an offer to all the saved hooks. // First get all hooks, then validate the request payload which must be // `{"flight_id": }` // and finally send the flight object to all the hooks by their endpoint. -func HookHandlerOffert(c *gin.Context) { +func HookHandlerOffer(c *gin.Context) { db, _ := db.GetDb() var hooks []models.Hook db.Find(&hooks) - var input models.OffertInput + var input models.OfferInput if err := c.ShouldBindJSON(&input); err != nil { c.JSON(http.StatusBadRequest, gin.H{"message": err.Error()}) return @@ -136,7 +136,7 @@ func HookHandlerOffert(c *gin.Context) { total += 1 } - // Send back some info just to know how many hook work or not + // Send back some info just to know how many hook work or not c.JSON(http.StatusOK, gin.H{ "hooks": len(hooks), "sent": total, diff --git a/internal/models/hook.go b/internal/models/hook.go index a15ceae..1399cfb 100644 --- a/internal/models/hook.go +++ b/internal/models/hook.go @@ -19,7 +19,7 @@ type HookInput struct { } // Struct used to send a new request for a selected flight -type OffertInput struct { +type OfferInput struct { FlightId int `json:"flight_id" binding:"required"` }