35 lines
923 B
Go
35 lines
923 B
Go
package ocssapi
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func (s *OCSSApiService) PostBookings(ctx context.Context, booking ocss.Booking) (*ocss.Booking, error) {
|
|
result, err := s.Handler.Book(booking)
|
|
if err != nil {
|
|
log.Error().Err(err).Msg("issue in booking")
|
|
return nil, err
|
|
}
|
|
|
|
return &result.Booking, nil
|
|
}
|
|
func (s *OCSSApiService) PatchBookings(ctx context.Context, bookingId string, status ocss.BookingStatus, message *string) error {
|
|
err := s.Handler.UpdateBookingStatus(bookingId, status)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
func (s *OCSSApiService) GetBookings(ctx context.Context, bookingId string) (*ocss.Booking, error) {
|
|
result, err := s.Handler.GetBooking(bookingId)
|
|
if err != nil {
|
|
log.Error().Err(err).Msg("issue retrieving booking in handler")
|
|
return nil, err
|
|
}
|
|
|
|
return &result.Booking, nil
|
|
}
|