Booking trace API

This commit is contained in:
mr 2024-08-21 15:22:13 +02:00
parent c14e067449
commit 4db037afd0
3 changed files with 10 additions and 2 deletions

View File

@ -45,6 +45,10 @@ const (
BOOKING = utils.BOOKING
)
func (d LibDataEnum) API() string {
return utils.DefaultAPI[d]
}
func (d LibDataEnum) String() string {
return utils.Str[d]
}

View File

@ -19,7 +19,7 @@ const (
BOOKING
)
var defaultAPI = [...]string{
var DefaultAPI = [...]string{
"",
"oc-catalog",
"oc-catalog",
@ -58,7 +58,7 @@ func FromInt(i int) string {
}
func (d DataType) API() string {
return defaultAPI[d]
return DefaultAPI[d]
}
func (d DataType) String() string {

View File

@ -65,6 +65,10 @@ func (wfa *Workflow) CheckBooking(subPath string) (bool, error) {
return false, err
}
caller := tools.NewHTTPCaller(map[string]map[tools.METHOD]string{})
if strings.Contains(p.(*peer.Peer).Url, "localhost") || strings.Contains(p.(*peer.Peer).Url, "127.0.0.1") {
subPath = strings.ReplaceAll(subPath, "localhost", utils.BOOKING.API())
subPath = strings.ReplaceAll(subPath, "127.0.0.1", utils.BOOKING.API())
}
subPath = strings.ReplaceAll(subPath, ":start_date", wfa.getFormat(wfa.Schedule.Start))
subPath = strings.ReplaceAll(subPath, ":end_date", wfa.getFormat(&e))
resp, err := caller.CallGet(p.(*peer.Peer).Url, subPath)