Skip to content

Commit

Permalink
Fix airline endpoint on soap request
Browse files Browse the repository at this point in the history
  • Loading branch information
boozec committed Jul 9, 2024
1 parent 8ce26f6 commit 5686380
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/http/soap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"
"time"

"github.com/acme-sky/workers/internal/db"
"github.com/acme-sky/workers/internal/models"
"github.com/charmbracelet/log"
"github.com/tiaguinho/gosoap"
Expand Down Expand Up @@ -44,7 +45,14 @@ func MakeRentRequest(rent models.Rent, offer models.Offer) (*BookRentResponse, e
return nil, err
}

endpoint := fmt.Sprintf("%s/airports/code/%s/", offer.Journey.Flight1.Airline, offer.Journey.Flight1.DepartureAirport)
db, _ := db.GetDb()

var flight1Airline models.Airline
if err := db.Where("name = ?", offer.Journey.Flight1.Airline).First(&flight1Airline).Error; err != nil {
return nil, err
}

endpoint := fmt.Sprintf("%s/airports/code/%s/", flight1Airline.Endpoint, offer.Journey.Flight1.DepartureAirport)
airport, err := GetAirportInfo(endpoint)
if err != nil {
log.Errorf("Can't find info for departure airport: %s", err.Error())
Expand Down

0 comments on commit 5686380

Please sign in to comment.