refactoring
This commit is contained in:
parent
d12c55d740
commit
150c913feb
|
@ -20,6 +20,7 @@ storage:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
grpc:
|
grpc:
|
||||||
|
ip: 0.0.0.0
|
||||||
enable: true
|
enable: true
|
||||||
port: 8089
|
port: 8089
|
||||||
solidarity-api:
|
solidarity-api:
|
||||||
|
|
|
@ -25,10 +25,7 @@ func (s *SolidarityServiceHandler) GetDriver(ctx context.Context, id string) (dr
|
||||||
func (s *SolidarityServiceHandler) SetDriverAvailabilities(ctx context.Context, driver internal.Driver) (err error) {
|
func (s *SolidarityServiceHandler) SetDriverAvailabilities(ctx context.Context, driver internal.Driver) (err error) {
|
||||||
driver.Driver.Operator = "internal-grpc"
|
driver.Driver.Operator = "internal-grpc"
|
||||||
err = s.Storage.CreateDriver(driver)
|
err = s.Storage.CreateDriver(driver)
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SolidarityServiceHandler) SetPassengerTrip(ctx context.Context, passenger internal.Passenger) (err error) {
|
func (s *SolidarityServiceHandler) SetPassengerTrip(ctx context.Context, passenger internal.Passenger) (err error) {
|
||||||
|
@ -65,20 +62,12 @@ func (s *SolidarityServiceHandler) UpdateBooking(ctx context.Context, bookingId
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SolidarityServiceHandler) GetBooking(ctx context.Context, bookingId string) (booking internal.Booking, passenger internal.Passenger, driver internal.Driver, err error) {
|
func (s *SolidarityServiceHandler) GetBooking(ctx context.Context, bookingId string) (booking internal.Booking, err error) {
|
||||||
booking, err = s.Storage.GetBooking(bookingId)
|
booking, err = s.Storage.GetBooking(bookingId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return internal.Booking{}, internal.Passenger{}, internal.Driver{}, err
|
return internal.Booking{}, err
|
||||||
}
|
}
|
||||||
passenger, err = s.Storage.GetPassenger(booking.Passenger.ID)
|
return booking, nil
|
||||||
if err != nil {
|
|
||||||
return internal.Booking{}, internal.Passenger{}, internal.Driver{}, err
|
|
||||||
}
|
|
||||||
driver, err = s.Storage.GetDriver(booking.Driver.ID)
|
|
||||||
if err != nil {
|
|
||||||
return internal.Booking{}, internal.Passenger{}, internal.Driver{}, err
|
|
||||||
}
|
|
||||||
return booking, passenger, driver, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SolidarityServiceHandler) GetBookingsByStatus(ctx context.Context, status string, filterType string, id string) (bookings []internal.Booking, err error) {
|
func (s *SolidarityServiceHandler) GetBookingsByStatus(ctx context.Context, status string, filterType string, id string) (bookings []internal.Booking, err error) {
|
||||||
|
|
|
@ -17,11 +17,8 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Passenger struct {
|
type Passenger struct {
|
||||||
Passenger_departure_address *geojson.Feature
|
Passenger User
|
||||||
Passenger_destination_address *geojson.Feature
|
Preferences Preferences
|
||||||
Passenger_pickup_date int64
|
|
||||||
Passenger User
|
|
||||||
Preferences Preferences
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Driver struct {
|
type Driver struct {
|
||||||
|
@ -64,12 +61,17 @@ type Preferences struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type BookingRequest struct {
|
type BookingRequest struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Passenger_id string `json:"passenger_id"`
|
Passenger_id string `json:"passenger_id"`
|
||||||
Driver_id string `json:"driver_id"`
|
Driver_id string `json:"driver_id"`
|
||||||
Status BookingStatus `json:"booking_status"`
|
Status BookingStatus `json:"booking_status"`
|
||||||
Details map[string]any `json:"booking_details"`
|
Details map[string]any `json:"booking_details"`
|
||||||
Operator string `json:"operator"`
|
Operator string `json:"operator"`
|
||||||
|
Departure_address *geojson.Feature
|
||||||
|
Destination_address *geojson.Feature
|
||||||
|
Pickup_date int64 `json:"pickup_date"`
|
||||||
|
Duration int64 `json:"duration"`
|
||||||
|
Distance float64 `json:"distance"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Booking struct {
|
type Booking struct {
|
||||||
|
@ -80,6 +82,9 @@ type Booking struct {
|
||||||
PassengerDropAddress *geojson.Feature
|
PassengerDropAddress *geojson.Feature
|
||||||
Status BookingStatus `json:"booking_status"`
|
Status BookingStatus `json:"booking_status"`
|
||||||
Details map[string]any `json:"booking_details"`
|
Details map[string]any `json:"booking_details"`
|
||||||
|
Pickup_date int64 `json:"pickup_date"`
|
||||||
|
Duration int64 `json:"duration"`
|
||||||
|
Distance float64 `json:"distance"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RegularAvailabilities struct {
|
type RegularAvailabilities struct {
|
||||||
|
|
|
@ -11,7 +11,6 @@ package openapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"net/http"
|
"net/http"
|
||||||
"solidarity-service/handler"
|
"solidarity-service/handler"
|
||||||
|
@ -42,7 +41,6 @@ func NewBookingsFilterAPIService(config *viper.Viper, handler *handler.Solidarit
|
||||||
func (s *BookingsFilterAPIService) FilterBookingsByStatus(ctx context.Context, operator string, status string, filterType string, id string) (ImplResponse, error) {
|
func (s *BookingsFilterAPIService) FilterBookingsByStatus(ctx context.Context, operator string, status string, filterType string, id string) (ImplResponse, error) {
|
||||||
bookings, err := s.storage.FilterUserBookingsByStatus(filterType, internal.BookingStatus(status), id)
|
bookings, err := s.storage.FilterUserBookingsByStatus(filterType, internal.BookingStatus(status), id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
|
||||||
if strings.Contains(err.Error(), " no rows in result set") {
|
if strings.Contains(err.Error(), " no rows in result set") {
|
||||||
return Response(http.StatusBadRequest, "no related data recheck your parameters"), nil
|
return Response(http.StatusBadRequest, "no related data recheck your parameters"), nil
|
||||||
} else {
|
} else {
|
||||||
|
@ -51,55 +49,48 @@ func (s *BookingsFilterAPIService) FilterBookingsByStatus(ctx context.Context, o
|
||||||
}
|
}
|
||||||
responses := []Booking{}
|
responses := []Booking{}
|
||||||
for _, v := range bookings {
|
for _, v := range bookings {
|
||||||
passenger, err := s.storage.GetPassenger(v.Passenger.ID)
|
|
||||||
if err != nil {
|
|
||||||
return Response(http.StatusInternalServerError, nil), nil
|
|
||||||
}
|
|
||||||
driver, err := s.storage.GetDriver(v.Driver.ID)
|
driver, err := s.storage.GetDriver(v.Driver.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Response(http.StatusInternalServerError, nil), nil
|
return Response(http.StatusInternalServerError, err.Error()), err
|
||||||
}
|
|
||||||
duration, err := s.handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
|
||||||
if err != nil {
|
|
||||||
duration = 0
|
|
||||||
}
|
}
|
||||||
|
car := driver.Car
|
||||||
responses = append(responses, Booking{
|
responses = append(responses, Booking{
|
||||||
Id: v.ID,
|
Id: v.ID,
|
||||||
Status: BookingStatus(v.Status),
|
Status: BookingStatus(v.Status),
|
||||||
Driver: User{
|
Driver: User{
|
||||||
Id: v.Driver.ID,
|
Id: v.Driver.ID,
|
||||||
Operator: driver.Driver.Operator,
|
Operator: v.Driver.Operator,
|
||||||
Alias: driver.Driver.Alias,
|
Alias: v.Driver.Alias,
|
||||||
FirstName: driver.Driver.FirstName,
|
FirstName: v.Driver.FirstName,
|
||||||
LastName: driver.Driver.LastName,
|
LastName: v.Driver.LastName,
|
||||||
Grade: int32(driver.Driver.Grade),
|
Grade: int32(v.Driver.Grade),
|
||||||
Picture: driver.Driver.Picture,
|
Picture: v.Driver.Picture,
|
||||||
Gender: driver.Driver.Gender,
|
Gender: v.Driver.Gender,
|
||||||
VerifiedIdentity: driver.Driver.VerifiedIdentity,
|
VerifiedIdentity: v.Driver.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
Passenger: User{
|
Passenger: User{
|
||||||
Id: v.Passenger.ID,
|
Id: v.Passenger.ID,
|
||||||
Operator: passenger.Passenger.Operator,
|
Operator: v.Passenger.Operator,
|
||||||
Alias: passenger.Passenger.Alias,
|
Alias: v.Passenger.Alias,
|
||||||
FirstName: passenger.Passenger.FirstName,
|
FirstName: v.Passenger.FirstName,
|
||||||
LastName: passenger.Passenger.LastName,
|
LastName: v.Passenger.LastName,
|
||||||
Grade: int32(passenger.Passenger.Grade),
|
Grade: int32(v.Passenger.Grade),
|
||||||
Picture: passenger.Passenger.Picture,
|
Picture: v.Passenger.Picture,
|
||||||
Gender: passenger.Passenger.Gender,
|
Gender: v.Passenger.Gender,
|
||||||
VerifiedIdentity: passenger.Passenger.VerifiedIdentity,
|
VerifiedIdentity: v.Passenger.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
PassengerPickupDate: int32(passenger.Passenger_pickup_date),
|
PassengerPickupDate: int32(v.Pickup_date),
|
||||||
PassengerPickupLat: passenger.Passenger_departure_address.Point().X(),
|
PassengerPickupLat: v.PassengerPickupAddress.Point().X(),
|
||||||
PassengerPickupLng: passenger.Passenger_departure_address.Point().Y(),
|
PassengerPickupLng: v.PassengerPickupAddress.Point().Y(),
|
||||||
PassengerPickupAddress: passenger.Passenger_departure_address.Properties.MustString("name"),
|
PassengerPickupAddress: v.PassengerPickupAddress.Properties.MustString("name"),
|
||||||
PassengerDropLat: passenger.Passenger_destination_address.Point().X(),
|
PassengerDropLat: v.PassengerDropAddress.Point().X(),
|
||||||
PassengerDropLng: passenger.Passenger_destination_address.Point().Y(),
|
PassengerDropLng: v.PassengerDropAddress.Point().Y(),
|
||||||
PassengerDropAddress: passenger.Passenger_destination_address.Properties.MustString("name"),
|
PassengerDropAddress: v.PassengerDropAddress.Properties.MustString("name"),
|
||||||
Duration: int32(duration),
|
Duration: int32(v.Duration),
|
||||||
Distance: int32(s.handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)),
|
Distance: int32(v.Distance),
|
||||||
Car: Car{
|
Car: Car{
|
||||||
Model: driver.Car.Model,
|
Model: car.Model,
|
||||||
Brand: driver.Car.Brand,
|
Brand: car.Brand,
|
||||||
},
|
},
|
||||||
Price: Price{
|
Price: Price{
|
||||||
Type: "FREE",
|
Type: "FREE",
|
||||||
|
|
|
@ -19,8 +19,6 @@ import (
|
||||||
"solidarity-service/handler"
|
"solidarity-service/handler"
|
||||||
"solidarity-service/internal"
|
"solidarity-service/internal"
|
||||||
"solidarity-service/storage"
|
"solidarity-service/storage"
|
||||||
"solidarity-service/utils"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DriverAvailabilityAndScheduleAPIService is a service that implements the logic for the DriverAvailabilityAndScheduleAPIServicer
|
// DriverAvailabilityAndScheduleAPIService is a service that implements the logic for the DriverAvailabilityAndScheduleAPIServicer
|
||||||
|
@ -79,9 +77,6 @@ func (s *DriverAvailabilityAndScheduleAPIService) DriverPunctualAvailabilitiesPo
|
||||||
driver.Car.Model = driverPunctualAvailabilitiesRequest.Car.Model
|
driver.Car.Model = driverPunctualAvailabilitiesRequest.Car.Model
|
||||||
err := s.storage.CreateDriver(driver)
|
err := s.storage.CreateDriver(driver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
|
||||||
return Response(http.StatusBadRequest, "ID already in use"), nil
|
|
||||||
}
|
|
||||||
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
||||||
} else {
|
} else {
|
||||||
return Response(201, "Punctual driver availabilities set successfully"), nil
|
return Response(201, "Punctual driver availabilities set successfully"), nil
|
||||||
|
@ -125,9 +120,6 @@ func (s *DriverAvailabilityAndScheduleAPIService) DriverRegularAvailabilitiesPos
|
||||||
driver.Car.Model = driverRegularAvailabilitiesRequest.Car.Model
|
driver.Car.Model = driverRegularAvailabilitiesRequest.Car.Model
|
||||||
err := s.storage.CreateDriver(driver)
|
err := s.storage.CreateDriver(driver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
|
||||||
return Response(http.StatusBadRequest, "ID already in use"), nil
|
|
||||||
}
|
|
||||||
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
||||||
} else {
|
} else {
|
||||||
return Response(201, "Regular driver availabilities set successfully"), nil
|
return Response(201, "Regular driver availabilities set successfully"), nil
|
||||||
|
|
|
@ -13,6 +13,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/paulmach/orb"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"net/http"
|
"net/http"
|
||||||
"solidarity-service/handler"
|
"solidarity-service/handler"
|
||||||
|
@ -50,63 +52,45 @@ func (s *InteractAPIService) GetBookings(ctx context.Context, operator string, b
|
||||||
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
passenger, err := s.storage.GetPassenger(booking.Passenger.ID)
|
|
||||||
if err != nil {
|
|
||||||
return Response(http.StatusInternalServerError, nil), nil
|
|
||||||
}
|
|
||||||
driver, err := s.storage.GetDriver(booking.Driver.ID)
|
|
||||||
if err != nil {
|
|
||||||
return Response(http.StatusInternalServerError, nil), nil
|
|
||||||
}
|
|
||||||
duration, err := s.handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
|
||||||
if err != nil {
|
|
||||||
duration = 0
|
|
||||||
}
|
|
||||||
response := Booking{
|
response := Booking{
|
||||||
Id: booking.ID,
|
Id: booking.ID,
|
||||||
Driver: User{
|
Driver: User{
|
||||||
Id: driver.Driver.ID,
|
Id: booking.Driver.ID,
|
||||||
Operator: driver.Driver.Operator,
|
Operator: booking.Driver.Operator,
|
||||||
Alias: driver.Driver.Alias,
|
Alias: booking.Driver.Alias,
|
||||||
FirstName: driver.Driver.FirstName,
|
FirstName: booking.Driver.FirstName,
|
||||||
LastName: driver.Driver.LastName,
|
LastName: booking.Driver.LastName,
|
||||||
Grade: int32(driver.Driver.Grade),
|
Grade: int32(booking.Driver.Grade),
|
||||||
Picture: driver.Driver.Picture,
|
Picture: booking.Driver.Picture,
|
||||||
Gender: driver.Driver.Gender,
|
Gender: booking.Driver.Gender,
|
||||||
VerifiedIdentity: driver.Driver.VerifiedIdentity,
|
VerifiedIdentity: booking.Driver.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
Passenger: User{
|
Passenger: User{
|
||||||
Id: passenger.Passenger.ID,
|
Id: booking.Passenger.ID,
|
||||||
Operator: passenger.Passenger.Operator,
|
Operator: booking.Passenger.Operator,
|
||||||
Alias: passenger.Passenger.Alias,
|
Alias: booking.Passenger.Alias,
|
||||||
FirstName: passenger.Passenger.FirstName,
|
FirstName: booking.Passenger.FirstName,
|
||||||
LastName: passenger.Passenger.LastName,
|
LastName: booking.Passenger.LastName,
|
||||||
Grade: int32(passenger.Passenger.Grade),
|
Grade: int32(booking.Passenger.Grade),
|
||||||
Picture: passenger.Passenger.Picture,
|
Picture: booking.Passenger.Picture,
|
||||||
Gender: passenger.Passenger.Gender,
|
Gender: booking.Passenger.Gender,
|
||||||
VerifiedIdentity: passenger.Passenger.VerifiedIdentity,
|
VerifiedIdentity: booking.Passenger.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
PassengerPickupDate: int32(passenger.Passenger_pickup_date),
|
PassengerPickupDate: int32(booking.Pickup_date),
|
||||||
PassengerPickupLat: passenger.Passenger_departure_address.Point().X(),
|
PassengerPickupLat: booking.PassengerPickupAddress.Point().X(),
|
||||||
PassengerPickupLng: passenger.Passenger_departure_address.Point().Y(),
|
PassengerPickupLng: booking.PassengerPickupAddress.Point().Y(),
|
||||||
PassengerPickupAddress: passenger.Passenger_departure_address.Properties.MustString("name"),
|
PassengerPickupAddress: booking.PassengerPickupAddress.Properties.MustString("name"),
|
||||||
PassengerDropLat: passenger.Passenger_destination_address.Point().X(),
|
PassengerDropLat: booking.PassengerDropAddress.Point().X(),
|
||||||
PassengerDropLng: passenger.Passenger_destination_address.Point().Y(),
|
PassengerDropLng: booking.PassengerDropAddress.Point().Y(),
|
||||||
PassengerDropAddress: passenger.Passenger_destination_address.Properties.MustString("name"),
|
PassengerDropAddress: booking.PassengerDropAddress.Properties.MustString("name"),
|
||||||
Status: BookingStatus(booking.Status),
|
Status: BookingStatus(booking.Status),
|
||||||
Duration: int32(duration),
|
Duration: int32(booking.Duration),
|
||||||
Distance: int32(s.handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)),
|
Distance: int32(booking.Distance),
|
||||||
Car: Car{
|
|
||||||
Model: driver.Car.Model,
|
|
||||||
Brand: driver.Car.Brand,
|
|
||||||
},
|
|
||||||
Price: Price{
|
Price: Price{
|
||||||
Type: "FREE",
|
Type: "FREE",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(response)
|
|
||||||
return Response(200, response), nil
|
return Response(200, response), nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PatchBookings - Updates status of an existing Booking request.
|
// PatchBookings - Updates status of an existing Booking request.
|
||||||
|
@ -130,6 +114,21 @@ func (s *InteractAPIService) PostBookings(ctx context.Context, bookingRequest Bo
|
||||||
booking.Driver_id = bookingRequest.DriverId
|
booking.Driver_id = bookingRequest.DriverId
|
||||||
booking.Passenger_id = bookingRequest.PassengerId
|
booking.Passenger_id = bookingRequest.PassengerId
|
||||||
booking.Operator = bookingRequest.Operator
|
booking.Operator = bookingRequest.Operator
|
||||||
|
booking.Departure_address = &geojson.Feature{
|
||||||
|
Type: "Feature",
|
||||||
|
Geometry: orb.Geometry(orb.Point{bookingRequest.DepartureAddressLat, bookingRequest.DepartureAddressLong}),
|
||||||
|
Properties: geojson.Properties{
|
||||||
|
"name": bookingRequest.DepartureAddress,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
booking.Destination_address = &geojson.Feature{
|
||||||
|
Type: "Feature",
|
||||||
|
Geometry: orb.Geometry(orb.Point{bookingRequest.DestinationAddressLat, bookingRequest.DestinationAddressLong}),
|
||||||
|
Properties: geojson.Properties{
|
||||||
|
"name": bookingRequest.DestinationAddress,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
booking.Pickup_date = int64(bookingRequest.Pickup_date)
|
||||||
err := s.storage.CreateBooking(booking)
|
err := s.storage.CreateBooking(booking)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
||||||
|
@ -145,7 +144,7 @@ func (s *InteractAPIService) PostBookings(ctx context.Context, bookingRequest Bo
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Response(http.StatusInternalServerError, nil), errors.New("PostBookings internal server error")
|
return Response(http.StatusInternalServerError, nil), errors.New("PostBookings internal server error")
|
||||||
}
|
}
|
||||||
duration, err := s.handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
duration, err := s.handler.CalculateDurationBetweenFeatures(booking.Departure_address, booking.Destination_address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
duration = 0
|
duration = 0
|
||||||
}
|
}
|
||||||
|
@ -173,16 +172,16 @@ func (s *InteractAPIService) PostBookings(ctx context.Context, bookingRequest Bo
|
||||||
Gender: passenger.Passenger.Gender,
|
Gender: passenger.Passenger.Gender,
|
||||||
VerifiedIdentity: passenger.Passenger.VerifiedIdentity,
|
VerifiedIdentity: passenger.Passenger.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
PassengerPickupDate: int32(passenger.Passenger_pickup_date),
|
PassengerPickupDate: int32(booking.Pickup_date),
|
||||||
PassengerPickupLat: passenger.Passenger_departure_address.Point().X(),
|
PassengerPickupLat: booking.Departure_address.Point().X(),
|
||||||
PassengerPickupLng: passenger.Passenger_departure_address.Point().Y(),
|
PassengerPickupLng: booking.Departure_address.Point().Y(),
|
||||||
PassengerPickupAddress: passenger.Passenger_departure_address.Properties.MustString("name"),
|
PassengerPickupAddress: booking.Departure_address.Properties.MustString("name"),
|
||||||
PassengerDropLat: passenger.Passenger_destination_address.Point().X(),
|
PassengerDropLat: booking.Destination_address.Point().X(),
|
||||||
PassengerDropLng: passenger.Passenger_destination_address.Point().Y(),
|
PassengerDropLng: booking.Destination_address.Point().Y(),
|
||||||
PassengerDropAddress: passenger.Passenger_destination_address.Properties.MustString("name"),
|
PassengerDropAddress: booking.Destination_address.Properties.MustString("name"),
|
||||||
Status: bookingRequest.Status,
|
Status: bookingRequest.Status,
|
||||||
Duration: int32(duration),
|
Duration: int32(duration),
|
||||||
Distance: int32(s.handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)),
|
Distance: int32(s.handler.CalculateDistanceBetweenFeatures(booking.Departure_address, booking.Destination_address)),
|
||||||
Car: Car{
|
Car: Car{
|
||||||
Model: driver.Car.Model,
|
Model: driver.Car.Model,
|
||||||
Brand: driver.Car.Brand,
|
Brand: driver.Car.Brand,
|
||||||
|
|
|
@ -12,15 +12,11 @@ package openapi
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/paulmach/orb"
|
|
||||||
"github.com/paulmach/orb/geojson"
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"net/http"
|
"net/http"
|
||||||
"solidarity-service/handler"
|
"solidarity-service/handler"
|
||||||
"solidarity-service/internal"
|
"solidarity-service/internal"
|
||||||
"solidarity-service/storage"
|
"solidarity-service/storage"
|
||||||
"solidarity-service/utils"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// PassengerTripRequestAPIService is a service that implements the logic for the PassengerTripRequestAPIServicer
|
// PassengerTripRequestAPIService is a service that implements the logic for the PassengerTripRequestAPIServicer
|
||||||
|
@ -44,21 +40,6 @@ func NewPassengerTripRequestAPIService(config *viper.Viper, handler *handler.Sol
|
||||||
// PassengerPost - Create a Passenger Trip Request
|
// PassengerPost - Create a Passenger Trip Request
|
||||||
func (s *PassengerTripRequestAPIService) PassengerPost(ctx context.Context, passengerTripRequest PassengerTripRequest) (ImplResponse, error) {
|
func (s *PassengerTripRequestAPIService) PassengerPost(ctx context.Context, passengerTripRequest PassengerTripRequest) (ImplResponse, error) {
|
||||||
passenger := internal.Passenger{}
|
passenger := internal.Passenger{}
|
||||||
passenger.Passenger_departure_address = &geojson.Feature{
|
|
||||||
Type: "Feature",
|
|
||||||
Geometry: orb.Geometry(orb.Point{passengerTripRequest.DepartureLatitude, passengerTripRequest.DepartureLongitude}),
|
|
||||||
Properties: geojson.Properties{
|
|
||||||
"name": passengerTripRequest.DepartureAddress,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
passenger.Passenger_destination_address = &geojson.Feature{
|
|
||||||
Type: "Feature",
|
|
||||||
Geometry: orb.Geometry(orb.Point{passengerTripRequest.DestinationLatitude, passengerTripRequest.DestinationLongitude}),
|
|
||||||
Properties: geojson.Properties{
|
|
||||||
"name": passengerTripRequest.DestinationAddress,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
passenger.Passenger_pickup_date = int64(passengerTripRequest.DepartureDate)
|
|
||||||
passenger.Passenger.ID = passengerTripRequest.User.Id
|
passenger.Passenger.ID = passengerTripRequest.User.Id
|
||||||
passenger.Passenger.Operator = passengerTripRequest.User.Operator
|
passenger.Passenger.Operator = passengerTripRequest.User.Operator
|
||||||
passenger.Passenger.Alias = passengerTripRequest.User.Alias
|
passenger.Passenger.Alias = passengerTripRequest.User.Alias
|
||||||
|
@ -75,9 +56,6 @@ func (s *PassengerTripRequestAPIService) PassengerPost(ctx context.Context, pass
|
||||||
passenger.Preferences.Music = passengerTripRequest.Preferences.Music
|
passenger.Preferences.Music = passengerTripRequest.Preferences.Music
|
||||||
err := s.storage.CreatePassenger(passenger)
|
err := s.storage.CreatePassenger(passenger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
|
||||||
return Response(http.StatusBadRequest, "ID already in use"), nil
|
|
||||||
}
|
|
||||||
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
return Response(http.StatusInternalServerError, nil), errors.New("DriverPunctualAvailabilitiesPost internal server error")
|
||||||
} else {
|
} else {
|
||||||
return Response(201, "Trip request created"), nil
|
return Response(201, "Trip request created"), nil
|
||||||
|
|
|
@ -21,16 +21,31 @@ type BookingRequest struct {
|
||||||
Status BookingStatus `json:"status"`
|
Status BookingStatus `json:"status"`
|
||||||
|
|
||||||
Operator string `json:"operator"`
|
Operator string `json:"operator"`
|
||||||
|
|
||||||
|
DepartureAddressLat float64 `json:"departure_address_lat"`
|
||||||
|
DepartureAddressLong float64 `json:"departure_address_long"`
|
||||||
|
DestinationAddressLat float64 `json:"destination_address_lat"`
|
||||||
|
DestinationAddressLong float64 `json:"destination_address_long"`
|
||||||
|
DepartureAddress string `json:"departure_address"`
|
||||||
|
DestinationAddress string `json:"destination_address"`
|
||||||
|
Pickup_date int32 `json:"pickup_date"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssertBookingRequestRequired checks if the required fields are not zero-ed
|
// AssertBookingRequestRequired checks if the required fields are not zero-ed
|
||||||
func AssertBookingRequestRequired(obj BookingRequest) error {
|
func AssertBookingRequestRequired(obj BookingRequest) error {
|
||||||
elements := map[string]interface{}{
|
elements := map[string]interface{}{
|
||||||
"id": obj.Id,
|
"id": obj.Id,
|
||||||
"passengerId": obj.PassengerId,
|
"passengerId": obj.PassengerId,
|
||||||
"driverId": obj.DriverId,
|
"driverId": obj.DriverId,
|
||||||
"status": obj.Status,
|
"status": obj.Status,
|
||||||
"operator": obj.Operator,
|
"operator": obj.Operator,
|
||||||
|
"departure_address_lat": obj.DepartureAddressLat,
|
||||||
|
"departure_address_long": obj.DepartureAddressLong,
|
||||||
|
"destination_address_lat": obj.DestinationAddressLat,
|
||||||
|
"destination_address_long": obj.DestinationAddressLong,
|
||||||
|
"pickup_date": obj.Pickup_date,
|
||||||
|
"departure_address": obj.DepartureAddress,
|
||||||
|
"destination_address": obj.DestinationAddress,
|
||||||
}
|
}
|
||||||
for name, el := range elements {
|
for name, el := range elements {
|
||||||
if isZero := IsZeroValue(el); isZero {
|
if isZero := IsZeroValue(el); isZero {
|
||||||
|
|
|
@ -10,37 +10,14 @@
|
||||||
package openapi
|
package openapi
|
||||||
|
|
||||||
type PassengerTripRequest struct {
|
type PassengerTripRequest struct {
|
||||||
User User `json:"user"`
|
User User `json:"user"`
|
||||||
|
|
||||||
DestinationAddress string `json:"destination_address"`
|
|
||||||
|
|
||||||
DestinationLatitude float64 `json:"destination_latitude"`
|
|
||||||
|
|
||||||
DestinationLongitude float64 `json:"destination_longitude"`
|
|
||||||
|
|
||||||
DepartureAddress string `json:"departure_address"`
|
|
||||||
|
|
||||||
DepartureLatitude float64 `json:"departure_latitude"`
|
|
||||||
|
|
||||||
DepartureLongitude float64 `json:"departure_longitude"`
|
|
||||||
|
|
||||||
// Departure datetime using a UNIX UTC timestamp in seconds.
|
|
||||||
DepartureDate int32 `json:"departure_date"`
|
|
||||||
|
|
||||||
Preferences Preferences `json:"preferences,omitempty"`
|
Preferences Preferences `json:"preferences,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssertPassengerTripRequestRequired checks if the required fields are not zero-ed
|
// AssertPassengerTripRequestRequired checks if the required fields are not zero-ed
|
||||||
func AssertPassengerTripRequestRequired(obj PassengerTripRequest) error {
|
func AssertPassengerTripRequestRequired(obj PassengerTripRequest) error {
|
||||||
elements := map[string]interface{}{
|
elements := map[string]interface{}{
|
||||||
"user": obj.User,
|
"user": obj.User,
|
||||||
"destination_address": obj.DestinationAddress,
|
|
||||||
"destination_latitude": obj.DestinationLatitude,
|
|
||||||
"destination_longitude": obj.DestinationLongitude,
|
|
||||||
"departure_address": obj.DepartureAddress,
|
|
||||||
"departure_latitude": obj.DepartureLatitude,
|
|
||||||
"departure_longitude": obj.DepartureLongitude,
|
|
||||||
"departure_date": obj.DepartureDate,
|
|
||||||
}
|
}
|
||||||
for name, el := range elements {
|
for name, el := range elements {
|
||||||
if isZero := IsZeroValue(el); isZero {
|
if isZero := IsZeroValue(el); isZero {
|
||||||
|
|
18
main.go
18
main.go
|
@ -19,19 +19,19 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
service_name = cfg.GetString("name")
|
serviceName = cfg.GetString("name")
|
||||||
grpc_enable = cfg.GetBool("services.grpc.enable")
|
grpcEnable = cfg.GetBool("services.grpc.enable")
|
||||||
solidarity_api_enable = cfg.GetBool("services.solidarity-api.enable")
|
solidarityApiEnable = cfg.GetBool("services.solidarity-api.enable")
|
||||||
routing_service_type = cfg.GetString("routing.type")
|
routingServiceType = cfg.GetString("routing.type")
|
||||||
valhalla_base_url = cfg.GetString("routing.valhalla.base_url")
|
valhallaBaseUrl = cfg.GetString("routing.valhalla.base_url")
|
||||||
)
|
)
|
||||||
log.Info().Msg("Running " + service_name)
|
log.Info().Msg("Running " + serviceName)
|
||||||
storageService, err := storage.NewStorage(cfg)
|
storageService, err := storage.NewStorage(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("Could not initiate the storage service")
|
log.Fatal().Err(err).Msg("Could not initiate the storage service")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
routing, err := routing.NewRoutingService(routing_service_type, valhalla_base_url)
|
routing, err := routing.NewRoutingService(routingServiceType, valhallaBaseUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("Could not initiate the routing service")
|
log.Fatal().Err(err).Msg("Could not initiate the routing service")
|
||||||
return
|
return
|
||||||
|
@ -43,12 +43,12 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
failed := make(chan error)
|
failed := make(chan error)
|
||||||
if grpc_enable {
|
if grpcEnable {
|
||||||
log.Info().Msg("Running gRPC server")
|
log.Info().Msg("Running gRPC server")
|
||||||
go grpcserver.Run(failed, cfg, handler)
|
go grpcserver.Run(failed, cfg, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
if solidarity_api_enable {
|
if solidarityApiEnable {
|
||||||
log.Info().Msg("Running Interoperability REST API")
|
log.Info().Msg("Running Interoperability REST API")
|
||||||
go api.Run(cfg, handler, storageService)
|
go api.Run(cfg, handler, storageService)
|
||||||
}
|
}
|
||||||
|
|
|
@ -726,10 +726,13 @@ type BookingRequest struct {
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
PassengerId string `protobuf:"bytes,2,opt,name=passengerId,proto3" json:"passengerId,omitempty"`
|
PassengerId string `protobuf:"bytes,2,opt,name=passengerId,proto3" json:"passengerId,omitempty"`
|
||||||
DriverId string `protobuf:"bytes,3,opt,name=driverId,proto3" json:"driverId,omitempty"`
|
DriverId string `protobuf:"bytes,3,opt,name=driverId,proto3" json:"driverId,omitempty"`
|
||||||
Status BookingStatus `protobuf:"varint,4,opt,name=status,proto3,enum=BookingStatus" json:"status,omitempty"`
|
Status BookingStatus `protobuf:"varint,4,opt,name=status,proto3,enum=BookingStatus" json:"status,omitempty"`
|
||||||
|
DepartureAddress *Feature `protobuf:"bytes,5,opt,name=departure_address,json=departureAddress,proto3" json:"departure_address,omitempty"`
|
||||||
|
DestinationAddress *Feature `protobuf:"bytes,6,opt,name=destination_address,json=destinationAddress,proto3" json:"destination_address,omitempty"`
|
||||||
|
PickupDate *timestamp.Timestamp `protobuf:"bytes,7,opt,name=pickup_date,json=pickupDate,proto3" json:"pickup_date,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BookingRequest) Reset() {
|
func (x *BookingRequest) Reset() {
|
||||||
|
@ -792,6 +795,27 @@ func (x *BookingRequest) GetStatus() BookingStatus {
|
||||||
return BookingStatus_INITIATED
|
return BookingStatus_INITIATED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *BookingRequest) GetDepartureAddress() *Feature {
|
||||||
|
if x != nil {
|
||||||
|
return x.DepartureAddress
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BookingRequest) GetDestinationAddress() *Feature {
|
||||||
|
if x != nil {
|
||||||
|
return x.DestinationAddress
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BookingRequest) GetPickupDate() *timestamp.Timestamp {
|
||||||
|
if x != nil {
|
||||||
|
return x.PickupDate
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Booking struct {
|
type Booking struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
@ -808,6 +832,7 @@ type Booking struct {
|
||||||
Distance *int64 `protobuf:"varint,9,opt,name=distance,proto3,oneof" json:"distance,omitempty"`
|
Distance *int64 `protobuf:"varint,9,opt,name=distance,proto3,oneof" json:"distance,omitempty"`
|
||||||
Price *Price `protobuf:"bytes,10,opt,name=price,proto3" json:"price,omitempty"`
|
Price *Price `protobuf:"bytes,10,opt,name=price,proto3" json:"price,omitempty"`
|
||||||
Car *Car `protobuf:"bytes,11,opt,name=car,proto3,oneof" json:"car,omitempty"`
|
Car *Car `protobuf:"bytes,11,opt,name=car,proto3,oneof" json:"car,omitempty"`
|
||||||
|
PickupDate *timestamp.Timestamp `protobuf:"bytes,12,opt,name=pickup_date,json=pickupDate,proto3" json:"pickup_date,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Booking) Reset() {
|
func (x *Booking) Reset() {
|
||||||
|
@ -919,6 +944,13 @@ func (x *Booking) GetCar() *Car {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Booking) GetPickupDate() *timestamp.Timestamp {
|
||||||
|
if x != nil {
|
||||||
|
return x.PickupDate
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Car struct {
|
type Car struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
@ -1307,7 +1339,7 @@ var file_solidarity_api_types_proto_rawDesc = []byte{
|
||||||
0x66, 0x57, 0x65, 0x65, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69,
|
0x66, 0x57, 0x65, 0x65, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69,
|
||||||
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54,
|
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54,
|
||||||
0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03,
|
0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x86, 0x01,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xb5, 0x02,
|
||||||
0x0a, 0x0e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x0a, 0x0e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||||
0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x64, 0x18,
|
0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x64, 0x18,
|
||||||
|
@ -1316,116 +1348,131 @@ var file_solidarity_api_types_proto_rawDesc = []byte{
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x26,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x26,
|
||||||
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e,
|
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e,
|
||||||
0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06,
|
0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06,
|
||||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x82, 0x04, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
|
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x11, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74,
|
||||||
0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
0x75, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||||
0x69, 0x64, 0x12, 0x1d, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01,
|
0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x10, 0x64, 0x65, 0x70,
|
||||||
0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65,
|
0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x39, 0x0a,
|
||||||
0x72, 0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x03,
|
0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64,
|
||||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61, 0x73,
|
0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61,
|
||||||
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e,
|
0x74, 0x75, 0x72, 0x65, 0x52, 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f,
|
||||||
0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20,
|
0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
|
||||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
|
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||||
0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70,
|
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x70, 0x69, 0x63, 0x6b, 0x75,
|
||||||
0x44, 0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
|
0x70, 0x44, 0x61, 0x74, 0x65, 0x22, 0xbf, 0x04, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
|
||||||
0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74,
|
0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
|
||||||
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72,
|
0x64, 0x12, 0x1d, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x65, 0x52, 0x17, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61,
|
0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72,
|
||||||
0x72, 0x74, 0x75, 0x72, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x1b, 0x70, 0x61,
|
0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x03, 0x20,
|
||||||
0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
|
0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73,
|
||||||
0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
|
||||||
0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65,
|
0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||||
0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07,
|
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x13,
|
||||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74,
|
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44,
|
||||||
0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x08,
|
0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72,
|
||||||
0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00,
|
0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
||||||
0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a,
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
|
||||||
0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x48,
|
0x52, 0x17, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72,
|
||||||
0x01, 0x52, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1c,
|
0x74, 0x75, 0x72, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x1b, 0x70, 0x61, 0x73,
|
||||||
0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e,
|
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69,
|
||||||
0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x03,
|
0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08,
|
||||||
0x63, 0x61, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x43, 0x61, 0x72, 0x48,
|
0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e,
|
||||||
0x02, 0x52, 0x03, 0x63, 0x61, 0x72, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75,
|
0x67, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f,
|
||||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61,
|
0x75, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20,
|
||||||
0x6e, 0x63, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x63, 0x61, 0x72, 0x22, 0x4f, 0x0a, 0x03, 0x43,
|
0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61,
|
||||||
0x61, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x08, 0x64,
|
||||||
0x09, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a,
|
0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52,
|
||||||
0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05,
|
0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08,
|
||||||
0x62, 0x72, 0x61, 0x6e, 0x64, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x6f, 0x64,
|
0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01,
|
||||||
0x65, 0x6c, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x22, 0xf1, 0x01, 0x0a,
|
0x52, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1c, 0x0a,
|
||||||
0x0b, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x07,
|
0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x50,
|
||||||
0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52,
|
0x72, 0x69, 0x63, 0x65, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x63,
|
||||||
0x07, 0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x61,
|
0x61, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x43, 0x61, 0x72, 0x48, 0x02,
|
||||||
0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x07,
|
0x52, 0x03, 0x63, 0x61, 0x72, 0x88, 0x01, 0x01, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b,
|
||||||
0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x6d, 0x75,
|
0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
|
||||||
0x73, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x05, 0x6d, 0x75, 0x73,
|
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||||
0x69, 0x63, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b,
|
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x70, 0x69, 0x63, 0x6b, 0x75,
|
||||||
0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x03, 0x52, 0x08, 0x69, 0x73, 0x54, 0x61,
|
0x70, 0x44, 0x61, 0x74, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
|
||||||
0x6c, 0x6b, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, 0x6c, 0x75, 0x67, 0x67, 0x61,
|
0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x42,
|
||||||
0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x04, 0x52,
|
0x06, 0x0a, 0x04, 0x5f, 0x63, 0x61, 0x72, 0x22, 0x4f, 0x0a, 0x03, 0x43, 0x61, 0x72, 0x12, 0x19,
|
||||||
0x0b, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x88, 0x01, 0x01, 0x42,
|
0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
|
||||||
0x0a, 0x0a, 0x08, 0x5f, 0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
|
0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x62, 0x72, 0x61,
|
||||||
0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x75, 0x73, 0x69,
|
0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x62, 0x72, 0x61, 0x6e,
|
||||||
0x63, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x42,
|
0x64, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x42, 0x08,
|
||||||
0x0f, 0x0a, 0x0d, 0x5f, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65,
|
0x0a, 0x06, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x22, 0xf1, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x65,
|
||||||
0x22, 0x8b, 0x01, 0x0a, 0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79,
|
0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x73, 0x6d, 0x6f, 0x6b,
|
||||||
0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65,
|
0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x73, 0x6d, 0x6f,
|
||||||
0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12,
|
0x6b, 0x69, 0x6e, 0x67, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x61, 0x6e, 0x69, 0x6d, 0x61,
|
||||||
0x1b, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48,
|
0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x07, 0x61, 0x6e, 0x69, 0x6d,
|
||||||
0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08,
|
0x61, 0x6c, 0x73, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x18,
|
||||||
0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02,
|
0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x88, 0x01,
|
||||||
0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a,
|
0x01, 0x12, 0x20, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x18, 0x04,
|
||||||
0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e,
|
0x20, 0x01, 0x28, 0x08, 0x48, 0x03, 0x52, 0x08, 0x69, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, 0x72,
|
||||||
0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xcf,
|
0x88, 0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73,
|
||||||
0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x04, 0x52, 0x0b, 0x6c, 0x75, 0x67,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73,
|
0x67, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x22, 0x0a,
|
0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x6e, 0x69, 0x6d,
|
||||||
0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
0x61, 0x6c, 0x73, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x42, 0x0c, 0x0a,
|
||||||
0x09, 0x48, 0x00, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01,
|
0x0a, 0x5f, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x42, 0x0f, 0x0a, 0x0d, 0x5f,
|
||||||
0x01, 0x12, 0x20, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04,
|
0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x8b, 0x01, 0x0a,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65,
|
0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
|
||||||
0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01,
|
0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||||
0x28, 0x03, 0x48, 0x02, 0x52, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d,
|
0x48, 0x00, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x61,
|
||||||
0x0a, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48,
|
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x01, 0x52, 0x06, 0x61,
|
||||||
0x03, 0x52, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a,
|
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72,
|
||||||
0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52,
|
0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x08, 0x63, 0x75,
|
||||||
0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x11, 0x76, 0x65,
|
0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x74, 0x79,
|
||||||
0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18,
|
0x70, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0b, 0x0a,
|
||||||
0x08, 0x20, 0x01, 0x28, 0x08, 0x48, 0x05, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65,
|
0x09, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xcf, 0x02, 0x0a, 0x04, 0x55,
|
||||||
0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b,
|
0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x5f, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f,
|
0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x67, 0x72,
|
0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x22, 0x0a, 0x0a, 0x66, 0x69, 0x72,
|
||||||
0x61, 0x64, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x42,
|
0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
|
||||||
0x09, 0x0a, 0x07, 0x5f, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x76,
|
0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a,
|
||||||
0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
|
0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x2a, 0x4a, 0x0a, 0x09, 0x44, 0x61, 0x79, 0x4f, 0x66, 0x57, 0x65, 0x65, 0x6b, 0x12, 0x07, 0x0a,
|
0x48, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12,
|
||||||
0x03, 0x4d, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x55, 0x45, 0x10, 0x01, 0x12,
|
0x19, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x02,
|
||||||
0x07, 0x0a, 0x03, 0x57, 0x45, 0x44, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x48, 0x55, 0x10,
|
0x52, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x70, 0x69,
|
||||||
0x04, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x52, 0x49, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x41,
|
0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x07, 0x70,
|
||||||
0x54, 0x10, 0x06, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x55, 0x4e, 0x10, 0x07, 0x2a, 0x2e, 0x0a, 0x09,
|
0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x67, 0x65, 0x6e,
|
||||||
0x50, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x52, 0x45,
|
0x64, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x06, 0x67, 0x65, 0x6e,
|
||||||
0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12,
|
0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69,
|
||||||
0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0xb2, 0x01, 0x0a,
|
0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||||
0x0d, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d,
|
0x08, 0x48, 0x05, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x49, 0x64, 0x65,
|
||||||
0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1f, 0x0a,
|
0x6e, 0x74, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x66, 0x69, 0x72,
|
||||||
0x1b, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x5f,
|
0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6c, 0x61, 0x73, 0x74,
|
||||||
0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x22,
|
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x67, 0x72, 0x61, 0x64, 0x65, 0x42,
|
||||||
0x0a, 0x1e, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x45, 0x4e,
|
0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f,
|
||||||
0x47, 0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e,
|
0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66,
|
||||||
0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x10,
|
0x69, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2a, 0x4a, 0x0a, 0x09,
|
||||||
0x03, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x04,
|
0x44, 0x61, 0x79, 0x4f, 0x66, 0x57, 0x65, 0x65, 0x6b, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x4f, 0x4e,
|
||||||
0x12, 0x20, 0x0a, 0x1c, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x45,
|
0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x55, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x57,
|
||||||
0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e,
|
0x45, 0x44, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x48, 0x55, 0x10, 0x04, 0x12, 0x07, 0x0a,
|
||||||
0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10,
|
0x03, 0x46, 0x52, 0x49, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x41, 0x54, 0x10, 0x06, 0x12,
|
||||||
0x06, 0x2a, 0x25, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a,
|
0x07, 0x0a, 0x03, 0x53, 0x55, 0x4e, 0x10, 0x07, 0x2a, 0x2e, 0x0a, 0x09, 0x50, 0x72, 0x69, 0x63,
|
||||||
0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x70, 0x61, 0x73,
|
0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x52, 0x45, 0x45, 0x10, 0x00, 0x12,
|
||||||
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x10, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e,
|
0x0a, 0x0a, 0x06, 0x50, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55,
|
||||||
0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f,
|
0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0xb2, 0x01, 0x0a, 0x0d, 0x42, 0x6f, 0x6f,
|
||||||
0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61,
|
0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e,
|
||||||
0x72, 0x69, 0x74, 0x79, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72,
|
0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x57, 0x41, 0x49,
|
||||||
0x76, 0x65, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x46,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x49, 0x52, 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x57, 0x41,
|
||||||
|
0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x5f,
|
||||||
|
0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0d,
|
||||||
|
0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a,
|
||||||
|
0x09, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x12, 0x20, 0x0a, 0x1c,
|
||||||
|
0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e,
|
||||||
|
0x47, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x05, 0x12, 0x0d,
|
||||||
|
0x0a, 0x09, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x06, 0x2a, 0x25, 0x0a,
|
||||||
|
0x08, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x64, 0x72, 0x69,
|
||||||
|
0x76, 0x65, 0x72, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
|
||||||
|
0x65, 0x72, 0x10, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70,
|
||||||
|
0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61,
|
||||||
|
0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79,
|
||||||
|
0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
|
||||||
|
0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -1478,20 +1525,24 @@ var file_solidarity_api_types_proto_depIdxs = []int32{
|
||||||
17, // 12: PunctualAvailabilitySlot.date:type_name -> google.protobuf.Timestamp
|
17, // 12: PunctualAvailabilitySlot.date:type_name -> google.protobuf.Timestamp
|
||||||
0, // 13: RegularAvailabilitySlot.dayOfWeek:type_name -> DayOfWeek
|
0, // 13: RegularAvailabilitySlot.dayOfWeek:type_name -> DayOfWeek
|
||||||
2, // 14: BookingRequest.status:type_name -> BookingStatus
|
2, // 14: BookingRequest.status:type_name -> BookingStatus
|
||||||
16, // 15: Booking.driver:type_name -> User
|
4, // 15: BookingRequest.departure_address:type_name -> Feature
|
||||||
16, // 16: Booking.passenger:type_name -> User
|
4, // 16: BookingRequest.destination_address:type_name -> Feature
|
||||||
17, // 17: Booking.passengerPickupDate:type_name -> google.protobuf.Timestamp
|
17, // 17: BookingRequest.pickup_date:type_name -> google.protobuf.Timestamp
|
||||||
4, // 18: Booking.passenger_departure_route:type_name -> Feature
|
16, // 18: Booking.driver:type_name -> User
|
||||||
4, // 19: Booking.passenger_destination_route:type_name -> Feature
|
16, // 19: Booking.passenger:type_name -> User
|
||||||
2, // 20: Booking.status:type_name -> BookingStatus
|
17, // 20: Booking.passengerPickupDate:type_name -> google.protobuf.Timestamp
|
||||||
15, // 21: Booking.price:type_name -> Price
|
4, // 21: Booking.passenger_departure_route:type_name -> Feature
|
||||||
13, // 22: Booking.car:type_name -> Car
|
4, // 22: Booking.passenger_destination_route:type_name -> Feature
|
||||||
1, // 23: Price.type:type_name -> PriceType
|
2, // 23: Booking.status:type_name -> BookingStatus
|
||||||
24, // [24:24] is the sub-list for method output_type
|
15, // 24: Booking.price:type_name -> Price
|
||||||
24, // [24:24] is the sub-list for method input_type
|
13, // 25: Booking.car:type_name -> Car
|
||||||
24, // [24:24] is the sub-list for extension type_name
|
17, // 26: Booking.pickup_date:type_name -> google.protobuf.Timestamp
|
||||||
24, // [24:24] is the sub-list for extension extendee
|
1, // 27: Price.type:type_name -> PriceType
|
||||||
0, // [0:24] is the sub-list for field type_name
|
28, // [28:28] is the sub-list for method output_type
|
||||||
|
28, // [28:28] is the sub-list for method input_type
|
||||||
|
28, // [28:28] is the sub-list for extension type_name
|
||||||
|
28, // [28:28] is the sub-list for extension extendee
|
||||||
|
0, // [0:28] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_solidarity_api_types_proto_init() }
|
func init() { file_solidarity_api_types_proto_init() }
|
||||||
|
|
|
@ -63,6 +63,9 @@ message BookingRequest {
|
||||||
string passengerId = 2;
|
string passengerId = 2;
|
||||||
string driverId = 3;
|
string driverId = 3;
|
||||||
BookingStatus status = 4;
|
BookingStatus status = 4;
|
||||||
|
Feature departure_address =5;
|
||||||
|
Feature destination_address = 6;
|
||||||
|
google.protobuf.Timestamp pickup_date = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Booking {
|
message Booking {
|
||||||
|
@ -77,6 +80,7 @@ message Booking {
|
||||||
optional int64 distance = 9;
|
optional int64 distance = 9;
|
||||||
Price price = 10;
|
Price price = 10;
|
||||||
optional Car car = 11;
|
optional Car car = 11;
|
||||||
|
google.protobuf.Timestamp pickup_date = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,8 @@ type PassengerTripRequest struct {
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
PassengerDepartureAddress *Feature `protobuf:"bytes,1,opt,name=passenger_departure_address,json=passengerDepartureAddress,proto3" json:"passenger_departure_address,omitempty"`
|
Passenger *User `protobuf:"bytes,1,opt,name=passenger,proto3" json:"passenger,omitempty"`
|
||||||
PassengerDestinationAddress *Feature `protobuf:"bytes,2,opt,name=passenger_destination_address,json=passengerDestinationAddress,proto3" json:"passenger_destination_address,omitempty"`
|
Preferences *Preferences `protobuf:"bytes,2,opt,name=preferences,proto3,oneof" json:"preferences,omitempty"`
|
||||||
PassengerPickupDate *timestamp.Timestamp `protobuf:"bytes,3,opt,name=passenger_pickup_date,json=passengerPickupDate,proto3" json:"passenger_pickup_date,omitempty"`
|
|
||||||
Passenger *User `protobuf:"bytes,4,opt,name=passenger,proto3" json:"passenger,omitempty"`
|
|
||||||
Preferences *Preferences `protobuf:"bytes,5,opt,name=preferences,proto3,oneof" json:"preferences,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PassengerTripRequest) Reset() {
|
func (x *PassengerTripRequest) Reset() {
|
||||||
|
@ -65,27 +62,6 @@ func (*PassengerTripRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_solidarity_api_proto_rawDescGZIP(), []int{0}
|
return file_solidarity_api_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PassengerTripRequest) GetPassengerDepartureAddress() *Feature {
|
|
||||||
if x != nil {
|
|
||||||
return x.PassengerDepartureAddress
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PassengerTripRequest) GetPassengerDestinationAddress() *Feature {
|
|
||||||
if x != nil {
|
|
||||||
return x.PassengerDestinationAddress
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PassengerTripRequest) GetPassengerPickupDate() *timestamp.Timestamp {
|
|
||||||
if x != nil {
|
|
||||||
return x.PassengerPickupDate
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PassengerTripRequest) GetPassenger() *User {
|
func (x *PassengerTripRequest) GetPassenger() *User {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Passenger
|
return x.Passenger
|
||||||
|
@ -846,162 +822,147 @@ var file_solidarity_api_proto_rawDesc = []byte{
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
||||||
0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72,
|
0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72,
|
||||||
0x69, 0x74, 0x79, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
|
0x69, 0x74, 0x79, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
|
||||||
0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x02, 0x0a, 0x14, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
|
0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
|
||||||
0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x48, 0x0a, 0x1b,
|
0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x09,
|
||||||
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74,
|
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
0x75, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
|
||||||
0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73,
|
0x72, 0x12, 0x33, 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73,
|
||||||
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x41,
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65,
|
||||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4c, 0x0a, 0x1d, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e,
|
0x6e, 0x63, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
|
||||||
0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
|
0x63, 0x65, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x65,
|
||||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e,
|
0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, 0xa3, 0x01, 0x0a, 0x1b, 0x44, 0x72, 0x69, 0x76, 0x65,
|
||||||
0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x1b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
|
0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69,
|
||||||
0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64,
|
0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72,
|
||||||
0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x15, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
|
0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
|
||||||
0x72, 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20,
|
0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4d, 0x0a,
|
||||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
|
0x15, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69,
|
||||||
0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70,
|
0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x52,
|
||||||
0x44, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
|
0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69,
|
||||||
0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09,
|
0x74, 0x79, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x14, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76,
|
||||||
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x0b, 0x70, 0x72, 0x65,
|
0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa5, 0x01, 0x0a,
|
||||||
0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c,
|
0x1c, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41,
|
||||||
0x2e, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0b,
|
0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x35, 0x0a,
|
||||||
0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0e,
|
0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18,
|
||||||
0x0a, 0x0c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, 0xa3,
|
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65,
|
||||||
0x01, 0x0a, 0x1b, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||||
0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x35,
|
0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x15, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x61,
|
||||||
0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52,
|
0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76,
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65,
|
|
||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4d, 0x0a, 0x15, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f,
|
|
||||||
0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02,
|
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76,
|
|
||||||
0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x14,
|
0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x14,
|
||||||
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69,
|
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69,
|
||||||
0x74, 0x69, 0x65, 0x73, 0x22, 0xa5, 0x01, 0x0a, 0x1c, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x50,
|
0x74, 0x69, 0x65, 0x73, 0x22, 0x5c, 0x0a, 0x15, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
|
||||||
0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c,
|
0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a,
|
||||||
0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f,
|
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
|
||||||
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
|
0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||||
0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x64,
|
0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
|
||||||
0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x15,
|
0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||||
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c,
|
0x67, 0x65, 0x22, 0x63, 0x0a, 0x1c, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69,
|
||||||
0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x50, 0x75,
|
0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69,
|
0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20,
|
||||||
0x74, 0x79, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x14, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76,
|
0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07,
|
||||||
0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5c, 0x0a, 0x15,
|
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
|
||||||
0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x73,
|
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
|
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x41, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12,
|
0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||||
0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x29, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||||
0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a,
|
0x32, 0x0f, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x63, 0x0a, 0x1c, 0x44, 0x72,
|
0x74, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x3b, 0x0a, 0x15, 0x43, 0x72,
|
||||||
0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69,
|
0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75,
|
0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01,
|
||||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63,
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07,
|
||||||
0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
|
0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x88, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22,
|
0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01,
|
||||||
0x41, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
|
0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||||
0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
|
0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
|
||||||
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
|
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||||
0x6e, 0x67, 0x22, 0x3b, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b,
|
0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
|
||||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62,
|
0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||||
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42,
|
0x67, 0x65, 0x22, 0x5c, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b,
|
||||||
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22,
|
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73,
|
||||||
0x88, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
|
0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75,
|
||||||
0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6b,
|
0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||||
0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f,
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||||
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
|
0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||||
0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
|
0x22, 0x32, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65,
|
||||||
0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
|
||||||
0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
|
||||||
0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a,
|
0x6e, 0x67, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
|
||||||
0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5c, 0x0a, 0x15, 0x55, 0x70,
|
0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62, 0x6f,
|
||||||
|
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x6f,
|
||||||
|
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x7c,
|
||||||
|
0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53,
|
||||||
|
0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x06,
|
||||||
|
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x42,
|
||||||
|
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74,
|
||||||
|
0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||||
|
0x28, 0x0e, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74,
|
||||||
|
0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x82, 0x01, 0x0a,
|
||||||
|
0x15, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52,
|
||||||
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x09, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74,
|
||||||
|
0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74,
|
||||||
|
0x75, 0x72, 0x65, 0x52, 0x09, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x12, 0x41,
|
||||||
|
0x0a, 0x0e, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x65,
|
||||||
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
|
||||||
|
0x6d, 0x70, 0x52, 0x0d, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x44, 0x61, 0x74,
|
||||||
|
0x65, 0x22, 0x51, 0x0a, 0x16, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e,
|
||||||
|
0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0f, 0x64,
|
||||||
|
0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x18, 0x01,
|
||||||
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75,
|
||||||
|
0x72, 0x6e, 0x65, 0x79, 0x52, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72,
|
||||||
|
0x6e, 0x65, 0x79, 0x73, 0x22, 0x41, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
|
||||||
|
0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
|
0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01,
|
||||||
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07,
|
||||||
|
0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x32, 0xf2, 0x04, 0x0a, 0x11, 0x53, 0x6f, 0x6c, 0x69,
|
||||||
|
0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a,
|
||||||
|
0x1e, 0x53, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61,
|
||||||
|
0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12,
|
||||||
|
0x1c, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41,
|
||||||
|
0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x1d, 0x2e,
|
||||||
|
0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69,
|
||||||
|
0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61,
|
||||||
|
0x0a, 0x1f, 0x53, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x50, 0x75, 0x6e, 0x63, 0x74,
|
||||||
|
0x75, 0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65,
|
||||||
|
0x73, 0x12, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75,
|
||||||
|
0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73,
|
||||||
|
0x1a, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62,
|
||||||
|
0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
||||||
|
0x00, 0x12, 0x40, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
|
||||||
|
0x6e, 0x67, 0x12, 0x15, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
|
||||||
|
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x43, 0x72, 0x65, 0x61,
|
||||||
|
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
|
0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f,
|
||||||
|
0x6b, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f,
|
||||||
|
0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x55, 0x70,
|
||||||
0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01,
|
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b,
|
||||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a,
|
0x69, 0x6e, 0x67, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
|
||||||
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f,
|
||||||
0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08,
|
0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52,
|
||||||
0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x32, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42,
|
0x0a, 0x13, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53,
|
||||||
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a,
|
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
|
||||||
0x0a, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
0x09, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x12,
|
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73,
|
||||||
0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20,
|
0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62,
|
0x6e, 0x65, 0x79, 0x73, 0x12, 0x16, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75,
|
||||||
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x7c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f,
|
0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x44,
|
||||||
0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
|
0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x50, 0x61,
|
||||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74,
|
0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70, 0x12, 0x15, 0x2e, 0x50, 0x61,
|
||||||
0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x04,
|
0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65,
|
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72,
|
||||||
0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75,
|
0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x45, 0x5a, 0x43,
|
||||||
0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73,
|
0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f,
|
||||||
0x65, 0x72, 0x49, 0x64, 0x22, 0x82, 0x01, 0x0a, 0x15, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a,
|
0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f,
|
||||||
0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26,
|
0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x0a, 0x09, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72,
|
||||||
0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x64, 0x65, 0x70,
|
0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74,
|
|
||||||
0x75, 0x72, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
|
|
||||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
|
||||||
0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, 0x64, 0x65, 0x70, 0x61,
|
|
||||||
0x72, 0x74, 0x75, 0x72, 0x65, 0x44, 0x61, 0x74, 0x65, 0x22, 0x51, 0x0a, 0x16, 0x44, 0x72, 0x69,
|
|
||||||
0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
|
||||||
0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x6a, 0x6f,
|
|
||||||
0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44,
|
|
||||||
0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x0e, 0x64, 0x72,
|
|
||||||
0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x22, 0x41, 0x0a, 0x1b,
|
|
||||||
0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61,
|
|
||||||
0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62,
|
|
||||||
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42,
|
|
||||||
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x32,
|
|
||||||
0xf2, 0x04, 0x0a, 0x11, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x53, 0x65,
|
|
||||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x1e, 0x53, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76,
|
|
||||||
0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62,
|
|
||||||
0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1c, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72,
|
|
||||||
0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c,
|
|
||||||
0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76,
|
|
||||||
0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
|
|
||||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x1f, 0x53, 0x65, 0x74, 0x44, 0x72, 0x69,
|
|
||||||
0x76, 0x65, 0x72, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c,
|
|
||||||
0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76,
|
|
||||||
0x65, 0x72, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61,
|
|
||||||
0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65,
|
|
||||||
0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52,
|
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x43, 0x72, 0x65,
|
|
||||||
0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x43, 0x72, 0x65,
|
|
||||||
0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
|
||||||
0x74, 0x1a, 0x16, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
|
|
||||||
0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x55,
|
|
||||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x55,
|
|
||||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75,
|
|
||||||
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b,
|
|
||||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a,
|
|
||||||
0x0a, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x2e, 0x47, 0x65,
|
|
||||||
0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
|
||||||
0x13, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70,
|
|
||||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f,
|
|
||||||
0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e,
|
|
||||||
0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61,
|
|
||||||
0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x47, 0x65, 0x74,
|
|
||||||
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x44, 0x72,
|
|
||||||
0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x12, 0x16, 0x2e, 0x44,
|
|
||||||
0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71,
|
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75,
|
|
||||||
0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
|
|
||||||
0x43, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54,
|
|
||||||
0x72, 0x69, 0x70, 0x12, 0x15, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54,
|
|
||||||
0x72, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x61, 0x73,
|
|
||||||
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
|
||||||
0x73, 0x65, 0x22, 0x00, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70,
|
|
||||||
0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61,
|
|
||||||
0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79,
|
|
||||||
0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
|
|
||||||
0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
|
||||||
0x74, 0x6f, 0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -1033,60 +994,57 @@ var file_solidarity_api_proto_goTypes = []interface{}{
|
||||||
(*DriverJourneysRequest)(nil), // 12: DriverJourneysRequest
|
(*DriverJourneysRequest)(nil), // 12: DriverJourneysRequest
|
||||||
(*DriverJourneysResponse)(nil), // 13: DriverJourneysResponse
|
(*DriverJourneysResponse)(nil), // 13: DriverJourneysResponse
|
||||||
(*GetBookingsByStatusResponse)(nil), // 14: GetBookingsByStatusResponse
|
(*GetBookingsByStatusResponse)(nil), // 14: GetBookingsByStatusResponse
|
||||||
(*Feature)(nil), // 15: Feature
|
(*User)(nil), // 15: User
|
||||||
(*timestamp.Timestamp)(nil), // 16: google.protobuf.Timestamp
|
(*Preferences)(nil), // 16: Preferences
|
||||||
(*User)(nil), // 17: User
|
(*DriverRequest)(nil), // 17: DriverRequest
|
||||||
(*Preferences)(nil), // 18: Preferences
|
(*RegularAvailabilitySlot)(nil), // 18: RegularAvailabilitySlot
|
||||||
(*DriverRequest)(nil), // 19: DriverRequest
|
(*PunctualAvailabilitySlot)(nil), // 19: PunctualAvailabilitySlot
|
||||||
(*RegularAvailabilitySlot)(nil), // 20: RegularAvailabilitySlot
|
(*BookingRequest)(nil), // 20: BookingRequest
|
||||||
(*PunctualAvailabilitySlot)(nil), // 21: PunctualAvailabilitySlot
|
(*Booking)(nil), // 21: Booking
|
||||||
(*BookingRequest)(nil), // 22: BookingRequest
|
(BookingStatus)(0), // 22: BookingStatus
|
||||||
(*Booking)(nil), // 23: Booking
|
(UserType)(0), // 23: UserType
|
||||||
(BookingStatus)(0), // 24: BookingStatus
|
(*Feature)(nil), // 24: Feature
|
||||||
(UserType)(0), // 25: UserType
|
(*timestamp.Timestamp)(nil), // 25: google.protobuf.Timestamp
|
||||||
(*DriverJourney)(nil), // 26: DriverJourney
|
(*DriverJourney)(nil), // 26: DriverJourney
|
||||||
}
|
}
|
||||||
var file_solidarity_api_proto_depIdxs = []int32{
|
var file_solidarity_api_proto_depIdxs = []int32{
|
||||||
15, // 0: PassengerTripRequest.passenger_departure_address:type_name -> Feature
|
15, // 0: PassengerTripRequest.passenger:type_name -> User
|
||||||
15, // 1: PassengerTripRequest.passenger_destination_address:type_name -> Feature
|
16, // 1: PassengerTripRequest.preferences:type_name -> Preferences
|
||||||
16, // 2: PassengerTripRequest.passenger_pickup_date:type_name -> google.protobuf.Timestamp
|
17, // 2: DriverRegularAvailabilities.driver_request:type_name -> DriverRequest
|
||||||
17, // 3: PassengerTripRequest.passenger:type_name -> User
|
18, // 3: DriverRegularAvailabilities.driver_availabilities:type_name -> RegularAvailabilitySlot
|
||||||
18, // 4: PassengerTripRequest.preferences:type_name -> Preferences
|
17, // 4: DriverPunctualAvailabilities.driver_request:type_name -> DriverRequest
|
||||||
19, // 5: DriverRegularAvailabilities.driver_request:type_name -> DriverRequest
|
19, // 5: DriverPunctualAvailabilities.driver_availabilities:type_name -> PunctualAvailabilitySlot
|
||||||
20, // 6: DriverRegularAvailabilities.driver_availabilities:type_name -> RegularAvailabilitySlot
|
20, // 6: CreateBookingRequest.booking:type_name -> BookingRequest
|
||||||
19, // 7: DriverPunctualAvailabilities.driver_request:type_name -> DriverRequest
|
21, // 7: CreateBookingResponse.booking:type_name -> Booking
|
||||||
21, // 8: DriverPunctualAvailabilities.driver_availabilities:type_name -> PunctualAvailabilitySlot
|
22, // 8: UpdateBookingRequest.status:type_name -> BookingStatus
|
||||||
22, // 9: CreateBookingRequest.booking:type_name -> BookingRequest
|
21, // 9: GetBookingResponse.booking:type_name -> Booking
|
||||||
23, // 10: CreateBookingResponse.booking:type_name -> Booking
|
22, // 10: GetBookingsByStatusRequest.status:type_name -> BookingStatus
|
||||||
24, // 11: UpdateBookingRequest.status:type_name -> BookingStatus
|
23, // 11: GetBookingsByStatusRequest.type:type_name -> UserType
|
||||||
23, // 12: GetBookingResponse.booking:type_name -> Booking
|
24, // 12: DriverJourneysRequest.departure:type_name -> Feature
|
||||||
24, // 13: GetBookingsByStatusRequest.status:type_name -> BookingStatus
|
25, // 13: DriverJourneysRequest.departure_date:type_name -> google.protobuf.Timestamp
|
||||||
25, // 14: GetBookingsByStatusRequest.type:type_name -> UserType
|
26, // 14: DriverJourneysResponse.driver_journeys:type_name -> DriverJourney
|
||||||
15, // 15: DriverJourneysRequest.departure:type_name -> Feature
|
21, // 15: GetBookingsByStatusResponse.booking:type_name -> Booking
|
||||||
16, // 16: DriverJourneysRequest.departure_date:type_name -> google.protobuf.Timestamp
|
1, // 16: SolidarityService.SetDriverRegularAvailabilities:input_type -> DriverRegularAvailabilities
|
||||||
26, // 17: DriverJourneysResponse.driver_journeys:type_name -> DriverJourney
|
2, // 17: SolidarityService.SetDriverPunctualAvailabilities:input_type -> DriverPunctualAvailabilities
|
||||||
23, // 18: GetBookingsByStatusResponse.booking:type_name -> Booking
|
5, // 18: SolidarityService.CreateBooking:input_type -> CreateBookingRequest
|
||||||
1, // 19: SolidarityService.SetDriverRegularAvailabilities:input_type -> DriverRegularAvailabilities
|
7, // 19: SolidarityService.UpdateBooking:input_type -> UpdateBookingRequest
|
||||||
2, // 20: SolidarityService.SetDriverPunctualAvailabilities:input_type -> DriverPunctualAvailabilities
|
9, // 20: SolidarityService.GetBooking:input_type -> GetBookingRequest
|
||||||
5, // 21: SolidarityService.CreateBooking:input_type -> CreateBookingRequest
|
11, // 21: SolidarityService.GetBookingsByStatus:input_type -> GetBookingsByStatusRequest
|
||||||
7, // 22: SolidarityService.UpdateBooking:input_type -> UpdateBookingRequest
|
12, // 22: SolidarityService.DriverJourneys:input_type -> DriverJourneysRequest
|
||||||
9, // 23: SolidarityService.GetBooking:input_type -> GetBookingRequest
|
0, // 23: SolidarityService.SetPassengerTrip:input_type -> PassengerTripRequest
|
||||||
11, // 24: SolidarityService.GetBookingsByStatus:input_type -> GetBookingsByStatusRequest
|
4, // 24: SolidarityService.SetDriverRegularAvailabilities:output_type -> DriverAvailabilitiesResponse
|
||||||
12, // 25: SolidarityService.DriverJourneys:input_type -> DriverJourneysRequest
|
4, // 25: SolidarityService.SetDriverPunctualAvailabilities:output_type -> DriverAvailabilitiesResponse
|
||||||
0, // 26: SolidarityService.SetPassengerTrip:input_type -> PassengerTripRequest
|
6, // 26: SolidarityService.CreateBooking:output_type -> CreateBookingResponse
|
||||||
4, // 27: SolidarityService.SetDriverRegularAvailabilities:output_type -> DriverAvailabilitiesResponse
|
8, // 27: SolidarityService.UpdateBooking:output_type -> UpdateBookingResponse
|
||||||
4, // 28: SolidarityService.SetDriverPunctualAvailabilities:output_type -> DriverAvailabilitiesResponse
|
10, // 28: SolidarityService.GetBooking:output_type -> GetBookingResponse
|
||||||
6, // 29: SolidarityService.CreateBooking:output_type -> CreateBookingResponse
|
14, // 29: SolidarityService.GetBookingsByStatus:output_type -> GetBookingsByStatusResponse
|
||||||
8, // 30: SolidarityService.UpdateBooking:output_type -> UpdateBookingResponse
|
13, // 30: SolidarityService.DriverJourneys:output_type -> DriverJourneysResponse
|
||||||
10, // 31: SolidarityService.GetBooking:output_type -> GetBookingResponse
|
3, // 31: SolidarityService.SetPassengerTrip:output_type -> PassengerTripResponse
|
||||||
14, // 32: SolidarityService.GetBookingsByStatus:output_type -> GetBookingsByStatusResponse
|
24, // [24:32] is the sub-list for method output_type
|
||||||
13, // 33: SolidarityService.DriverJourneys:output_type -> DriverJourneysResponse
|
16, // [16:24] is the sub-list for method input_type
|
||||||
3, // 34: SolidarityService.SetPassengerTrip:output_type -> PassengerTripResponse
|
16, // [16:16] is the sub-list for extension type_name
|
||||||
27, // [27:35] is the sub-list for method output_type
|
16, // [16:16] is the sub-list for extension extendee
|
||||||
19, // [19:27] is the sub-list for method input_type
|
0, // [0:16] is the sub-list for field type_name
|
||||||
19, // [19:19] is the sub-list for extension type_name
|
|
||||||
19, // [19:19] is the sub-list for extension extendee
|
|
||||||
0, // [0:19] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_solidarity_api_proto_init() }
|
func init() { file_solidarity_api_proto_init() }
|
||||||
|
|
|
@ -16,11 +16,9 @@ service SolidarityService {
|
||||||
|
|
||||||
|
|
||||||
message PassengerTripRequest{
|
message PassengerTripRequest{
|
||||||
Feature passenger_departure_address = 1;
|
User passenger = 1;
|
||||||
Feature passenger_destination_address = 2;
|
|
||||||
google.protobuf.Timestamp passenger_pickup_date = 3;
|
optional Preferences preferences = 2;
|
||||||
User passenger = 4;
|
|
||||||
optional Preferences preferences = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message DriverRegularAvailabilities{
|
message DriverRegularAvailabilities{
|
||||||
|
|
|
@ -23,7 +23,7 @@ func NewSolidarityServiceServer(handler *handler.SolidarityServiceHandler) *Soli
|
||||||
|
|
||||||
func Run(done chan error, cfg *viper.Viper, handler *handler.SolidarityServiceHandler) {
|
func Run(done chan error, cfg *viper.Viper, handler *handler.SolidarityServiceHandler) {
|
||||||
var (
|
var (
|
||||||
address = ":" + cfg.GetString("services.grpc.port")
|
address = cfg.GetString("services.grpc.ip") + ":" + cfg.GetString("services.grpc.port")
|
||||||
)
|
)
|
||||||
|
|
||||||
server := grpc.NewServer()
|
server := grpc.NewServer()
|
||||||
|
|
|
@ -6,10 +6,12 @@ import (
|
||||||
"github.com/golang/protobuf/ptypes/timestamp"
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
"github.com/paulmach/orb"
|
"github.com/paulmach/orb"
|
||||||
"github.com/paulmach/orb/geojson"
|
"github.com/paulmach/orb/geojson"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"solidarity-service/internal"
|
"solidarity-service/internal"
|
||||||
"solidarity-service/servers/grpc/proto"
|
"solidarity-service/servers/grpc/proto"
|
||||||
"solidarity-service/utils"
|
"solidarity-service/utils"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *SolidarityServiceServerImpl) SetDriverRegularAvailabilities(ctx context.Context, req *proto.DriverRegularAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
|
func (s *SolidarityServiceServerImpl) SetDriverRegularAvailabilities(ctx context.Context, req *proto.DriverRegularAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
|
||||||
|
@ -78,9 +80,6 @@ func (s *SolidarityServiceServerImpl) SetDriverRegularAvailabilities(ctx context
|
||||||
|
|
||||||
err = s.Handler.SetDriverAvailabilities(context.Background(), driver)
|
err = s.Handler.SetDriverAvailabilities(context.Background(), driver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
|
||||||
err = errors.New("ID is already used")
|
|
||||||
}
|
|
||||||
return &proto.DriverAvailabilitiesResponse{
|
return &proto.DriverAvailabilitiesResponse{
|
||||||
Success: false,
|
Success: false,
|
||||||
}, err
|
}, err
|
||||||
|
@ -156,9 +155,6 @@ func (s *SolidarityServiceServerImpl) SetDriverPunctualAvailabilities(ctx contex
|
||||||
|
|
||||||
err = s.Handler.SetDriverAvailabilities(context.Background(), driver)
|
err = s.Handler.SetDriverAvailabilities(context.Background(), driver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
|
||||||
err = errors.New("ID is already used")
|
|
||||||
}
|
|
||||||
return &proto.DriverAvailabilitiesResponse{
|
return &proto.DriverAvailabilitiesResponse{
|
||||||
Success: false,
|
Success: false,
|
||||||
}, err
|
}, err
|
||||||
|
@ -169,7 +165,7 @@ func (s *SolidarityServiceServerImpl) SetDriverPunctualAvailabilities(ctx contex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *proto.CreateBookingRequest) (resp *proto.CreateBookingResponse, err error) {
|
func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *proto.CreateBookingRequest) (resp *proto.CreateBookingResponse, err error) {
|
||||||
if req.Booking.DriverId == "" || req.Booking.PassengerId == "" || req.Booking.Id == "" || req.Booking.Status.String() == "" {
|
if req.Booking.DriverId == "" || req.Booking.PassengerId == "" || req.Booking.Id == "" || req.Booking.Status.String() == "" || req.Booking.DepartureAddress == nil || req.Booking.DestinationAddress == nil || req.Booking.PickupDate.Seconds == 0 {
|
||||||
return nil, errors.New("missing required fields")
|
return nil, errors.New("missing required fields")
|
||||||
}
|
}
|
||||||
bookingRequest := internal.BookingRequest{
|
bookingRequest := internal.BookingRequest{
|
||||||
|
@ -177,6 +173,21 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
|
||||||
Passenger_id: req.Booking.PassengerId,
|
Passenger_id: req.Booking.PassengerId,
|
||||||
Driver_id: req.Booking.DriverId,
|
Driver_id: req.Booking.DriverId,
|
||||||
Status: internal.BookingStatus(req.Booking.Status.String()),
|
Status: internal.BookingStatus(req.Booking.Status.String()),
|
||||||
|
Destination_address: &geojson.Feature{
|
||||||
|
Type: "Feature",
|
||||||
|
Geometry: orb.Geometry(orb.Point{req.Booking.DestinationAddress.Lat, req.Booking.DestinationAddress.Long}),
|
||||||
|
Properties: geojson.Properties{
|
||||||
|
"name": req.Booking.DestinationAddress.Address,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Departure_address: &geojson.Feature{
|
||||||
|
Type: "Feature",
|
||||||
|
Geometry: orb.Geometry(orb.Point{req.Booking.DepartureAddress.Lat, req.Booking.DepartureAddress.Long}),
|
||||||
|
Properties: geojson.Properties{
|
||||||
|
"name": req.Booking.DepartureAddress.Address,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Pickup_date: req.Booking.PickupDate.Seconds,
|
||||||
}
|
}
|
||||||
passenger, driver, err := s.Handler.CreateBooking(context.Background(), bookingRequest)
|
passenger, driver, err := s.Handler.CreateBooking(context.Background(), bookingRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -185,11 +196,11 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
duration, err := s.Handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
duration, err := s.Handler.CalculateDurationBetweenFeatures(bookingRequest.Departure_address, bookingRequest.Destination_address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
duration = 0
|
duration = 0
|
||||||
}
|
}
|
||||||
distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
distance := s.Handler.CalculateDistanceBetweenFeatures(bookingRequest.Departure_address, bookingRequest.Destination_address)
|
||||||
priceType := proto.PriceType_FREE
|
priceType := proto.PriceType_FREE
|
||||||
resp = &proto.CreateBookingResponse{
|
resp = &proto.CreateBookingResponse{
|
||||||
Booking: &proto.Booking{},
|
Booking: &proto.Booking{},
|
||||||
|
@ -217,17 +228,17 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
|
||||||
VerifiedIdentity: &passenger.Passenger.VerifiedIdentity,
|
VerifiedIdentity: &passenger.Passenger.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
PassengerPickupDate: ×tamp.Timestamp{
|
PassengerPickupDate: ×tamp.Timestamp{
|
||||||
Seconds: passenger.Passenger_pickup_date,
|
Seconds: bookingRequest.Pickup_date,
|
||||||
},
|
},
|
||||||
PassengerDepartureRoute: &proto.Feature{
|
PassengerDepartureRoute: &proto.Feature{
|
||||||
Lat: passenger.Passenger_departure_address.Point().Lat(),
|
Lat: bookingRequest.Departure_address.Point().Lat(),
|
||||||
Long: passenger.Passenger_departure_address.Point().Lon(),
|
Long: bookingRequest.Departure_address.Point().Lon(),
|
||||||
Address: passenger.Passenger_departure_address.Properties.MustString("name"),
|
Address: bookingRequest.Departure_address.Properties.MustString("name"),
|
||||||
},
|
},
|
||||||
PassengerDestinationRoute: &proto.Feature{
|
PassengerDestinationRoute: &proto.Feature{
|
||||||
Lat: passenger.Passenger_destination_address.Point().Lat(),
|
Lat: bookingRequest.Destination_address.Point().Lat(),
|
||||||
Long: passenger.Passenger_destination_address.Point().Lon(),
|
Long: bookingRequest.Destination_address.Point().Lon(),
|
||||||
Address: passenger.Passenger_destination_address.Properties.MustString("name"),
|
Address: bookingRequest.Destination_address.Properties.MustString("name"),
|
||||||
},
|
},
|
||||||
Status: ConvertInternalToProtoBookingStatus(bookingRequest.Status),
|
Status: ConvertInternalToProtoBookingStatus(bookingRequest.Status),
|
||||||
Duration: &duration,
|
Duration: &duration,
|
||||||
|
@ -268,155 +279,211 @@ func (s *SolidarityServiceServerImpl) GetBooking(ctx context.Context, req *proto
|
||||||
if req.BookingId == "" {
|
if req.BookingId == "" {
|
||||||
return nil, errors.New("empty booking ID")
|
return nil, errors.New("empty booking ID")
|
||||||
}
|
}
|
||||||
booking, passenger, driver, err := s.Handler.GetBooking(context.Background(), req.BookingId)
|
booking, err := s.Handler.GetBooking(context.Background(), req.BookingId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_NO_ROWS) {
|
if strings.Contains(err.Error(), utils.SQL_NO_ROWS) {
|
||||||
err = errors.New("invalid ID")
|
err = errors.New("invalid ID")
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
duration, err := s.Handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
|
||||||
if err != nil {
|
|
||||||
duration = 0
|
|
||||||
}
|
|
||||||
resp = &proto.GetBookingResponse{
|
resp = &proto.GetBookingResponse{
|
||||||
Booking: &proto.Booking{},
|
Booking: &proto.Booking{},
|
||||||
}
|
}
|
||||||
distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
|
||||||
priceType := proto.PriceType_FREE
|
priceType := proto.PriceType_FREE
|
||||||
|
driver, err := s.Handler.GetDriver(context.Background(), booking.Driver.ID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
car := driver.Car
|
||||||
|
distance := int64(booking.Distance)
|
||||||
resp.Booking = &proto.Booking{
|
resp.Booking = &proto.Booking{
|
||||||
Id: booking.ID,
|
Id: booking.ID,
|
||||||
Driver: &proto.User{
|
Driver: &proto.User{
|
||||||
Id: driver.Driver.ID,
|
Id: booking.Driver.ID,
|
||||||
Alias: driver.Driver.Alias,
|
Alias: booking.Driver.Alias,
|
||||||
FirstName: &driver.Driver.FirstName,
|
FirstName: &booking.Driver.FirstName,
|
||||||
LastName: &driver.Driver.LastName,
|
LastName: &booking.Driver.LastName,
|
||||||
Grade: &driver.Driver.Grade,
|
Grade: &booking.Driver.Grade,
|
||||||
Picture: &driver.Driver.Picture,
|
Picture: &booking.Driver.Picture,
|
||||||
Gender: &driver.Driver.Gender,
|
Gender: &booking.Driver.Gender,
|
||||||
VerifiedIdentity: &driver.Driver.VerifiedIdentity,
|
VerifiedIdentity: &booking.Driver.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
Passenger: &proto.User{
|
Passenger: &proto.User{
|
||||||
Id: passenger.Passenger.ID,
|
Id: booking.Passenger.ID,
|
||||||
Alias: passenger.Passenger.Alias,
|
Alias: booking.Passenger.Alias,
|
||||||
FirstName: &passenger.Passenger.FirstName,
|
FirstName: &booking.Passenger.FirstName,
|
||||||
LastName: &passenger.Passenger.LastName,
|
LastName: &booking.Passenger.LastName,
|
||||||
Grade: &passenger.Passenger.Grade,
|
Grade: &booking.Passenger.Grade,
|
||||||
Picture: &passenger.Passenger.Picture,
|
Picture: &booking.Passenger.Picture,
|
||||||
Gender: &passenger.Passenger.Gender,
|
Gender: &booking.Passenger.Gender,
|
||||||
VerifiedIdentity: &passenger.Passenger.VerifiedIdentity,
|
VerifiedIdentity: &booking.Passenger.VerifiedIdentity,
|
||||||
},
|
},
|
||||||
PassengerPickupDate: ×tamp.Timestamp{
|
PassengerPickupDate: ×tamp.Timestamp{
|
||||||
Seconds: passenger.Passenger_pickup_date,
|
Seconds: booking.Pickup_date,
|
||||||
},
|
},
|
||||||
PassengerDepartureRoute: &proto.Feature{
|
PassengerDepartureRoute: &proto.Feature{
|
||||||
Lat: passenger.Passenger_departure_address.Point().Lat(),
|
Lat: booking.PassengerPickupAddress.Point().Lat(),
|
||||||
Long: passenger.Passenger_departure_address.Point().Lon(),
|
Long: booking.PassengerPickupAddress.Point().Lon(),
|
||||||
Address: passenger.Passenger_departure_address.Properties.MustString("name"),
|
Address: booking.PassengerPickupAddress.Properties.MustString("name"),
|
||||||
},
|
},
|
||||||
PassengerDestinationRoute: &proto.Feature{
|
PassengerDestinationRoute: &proto.Feature{
|
||||||
Lat: passenger.Passenger_destination_address.Point().Lat(),
|
Lat: booking.PassengerDropAddress.Point().Lat(),
|
||||||
Long: passenger.Passenger_destination_address.Point().Lon(),
|
Long: booking.PassengerDropAddress.Point().Lon(),
|
||||||
Address: passenger.Passenger_destination_address.Properties.MustString("name"),
|
Address: booking.PassengerDropAddress.Properties.MustString("name"),
|
||||||
},
|
},
|
||||||
Status: ConvertInternalToProtoBookingStatus(booking.Status),
|
Status: ConvertInternalToProtoBookingStatus(booking.Status),
|
||||||
Duration: &duration,
|
Duration: &booking.Duration,
|
||||||
Distance: &distance,
|
Distance: &distance,
|
||||||
|
Car: &proto.Car{
|
||||||
|
Model: &car.Model,
|
||||||
|
Brand: &car.Brand,
|
||||||
|
},
|
||||||
Price: &proto.Price{
|
Price: &proto.Price{
|
||||||
Type: &priceType,
|
Type: &priceType,
|
||||||
},
|
},
|
||||||
Car: &proto.Car{
|
|
||||||
Model: &driver.Car.Model,
|
|
||||||
Brand: &driver.Car.Brand,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SolidarityServiceServerImpl) GetBookingsByStatus(ctx context.Context, req *proto.GetBookingsByStatusRequest) (resp *proto.GetBookingsByStatusResponse, err error) {
|
func (s *SolidarityServiceServerImpl) GetBookingsByStatus(ctx context.Context, req *proto.GetBookingsByStatusRequest) (resp *proto.GetBookingsByStatusResponse, err error) {
|
||||||
if req.Type.String() == "" || req.Status.String() == "" || req.UserId == "" {
|
if req.Type.String() == "" || req.Status.String() == "" || req.UserId == "" {
|
||||||
return nil, errors.New("missing required fields")
|
return nil, errors.New("missing required fields")
|
||||||
}
|
}
|
||||||
bookings, err := s.Handler.GetBookingsByStatus(context.Background(), req.Status.String(), req.Type.String(), req.UserId)
|
|
||||||
|
bookings, err := s.Handler.GetBookingsByStatus(ctx, req.Status.String(), req.Type.String(), req.UserId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_NO_ROWS) {
|
if strings.Contains(err.Error(), utils.SQL_NO_ROWS) {
|
||||||
err = errors.New("invalid ID")
|
return nil, errors.New("invalid ID")
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resp = &proto.GetBookingsByStatusResponse{
|
|
||||||
Booking: []*proto.Booking{},
|
// Use a goroutine to concurrently convert bookings to proto
|
||||||
|
respChan := make(chan []*proto.Booking, 1)
|
||||||
|
go func() {
|
||||||
|
respChan <- convertInternalBookingsToProto(s, bookings, 50)
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case convertedBookings := <-respChan:
|
||||||
|
close(respChan)
|
||||||
|
|
||||||
|
resp = &proto.GetBookingsByStatusResponse{
|
||||||
|
Booking: convertedBookings,
|
||||||
|
}
|
||||||
|
return resp, nil
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
|
// If the context is canceled, return an error
|
||||||
|
return nil, ctx.Err()
|
||||||
}
|
}
|
||||||
responses := []*proto.Booking{}
|
}
|
||||||
|
|
||||||
|
func convertInternalBookingsToProto(s *SolidarityServiceServerImpl, bookings []internal.Booking, maxGoroutines int) []*proto.Booking {
|
||||||
|
var responses []*proto.Booking
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
var mu sync.Mutex
|
||||||
|
semaphore := make(chan struct{}, maxGoroutines)
|
||||||
|
|
||||||
for _, v := range bookings {
|
for _, v := range bookings {
|
||||||
passenger, err := s.Handler.GetPassenger(context.Background(), v.Passenger.ID)
|
wg.Add(1)
|
||||||
if err != nil {
|
semaphore <- struct{}{}
|
||||||
return nil, err
|
|
||||||
}
|
go func(booking internal.Booking) {
|
||||||
driver, err := s.Handler.GetDriver(context.Background(), v.Driver.ID)
|
defer func() {
|
||||||
if err != nil {
|
<-semaphore
|
||||||
return nil, err
|
wg.Done()
|
||||||
}
|
}()
|
||||||
duration, err := s.Handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
|
||||||
if err != nil {
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
duration = 0
|
defer cancel()
|
||||||
}
|
|
||||||
priceType := proto.PriceType_FREE
|
var driver internal.Driver
|
||||||
distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
|
var driverErr error
|
||||||
responses = append(responses, &proto.Booking{
|
driverCh := make(chan struct {
|
||||||
Id: v.ID,
|
Driver internal.Driver
|
||||||
Status: ConvertInternalToProtoBookingStatus(v.Status),
|
Err error
|
||||||
Driver: &proto.User{
|
})
|
||||||
Id: v.Driver.ID,
|
|
||||||
Alias: driver.Driver.Alias,
|
go func() {
|
||||||
FirstName: &driver.Driver.FirstName,
|
d, err := s.Handler.GetDriver(ctx, booking.Driver.ID)
|
||||||
LastName: &driver.Driver.LastName,
|
driverCh <- struct {
|
||||||
Grade: &driver.Driver.Grade,
|
Driver internal.Driver
|
||||||
Picture: &driver.Driver.Picture,
|
Err error
|
||||||
Gender: &driver.Driver.Gender,
|
}{Driver: d, Err: err}
|
||||||
VerifiedIdentity: &driver.Driver.VerifiedIdentity,
|
}()
|
||||||
},
|
|
||||||
Passenger: &proto.User{
|
driverRes := <-driverCh
|
||||||
Id: v.Passenger.ID,
|
driver = driverRes.Driver
|
||||||
Alias: passenger.Passenger.Alias,
|
driverErr = driverRes.Err
|
||||||
FirstName: &passenger.Passenger.FirstName,
|
|
||||||
LastName: &passenger.Passenger.LastName,
|
if driverErr != nil {
|
||||||
Grade: &passenger.Passenger.Grade,
|
log.Error().Err(driverErr).Msg("Error getting driver")
|
||||||
Picture: &passenger.Passenger.Picture,
|
return
|
||||||
Gender: &passenger.Passenger.Gender,
|
}
|
||||||
VerifiedIdentity: &passenger.Passenger.VerifiedIdentity,
|
|
||||||
},
|
car := driver.Car
|
||||||
PassengerPickupDate: ×tamp.Timestamp{
|
|
||||||
Seconds: passenger.Passenger_pickup_date,
|
priceType := proto.PriceType_FREE
|
||||||
},
|
distance := int64(booking.Distance)
|
||||||
PassengerDepartureRoute: &proto.Feature{
|
protoBooking := &proto.Booking{
|
||||||
Lat: passenger.Passenger_departure_address.Point().Lat(),
|
Id: booking.ID,
|
||||||
Long: passenger.Passenger_departure_address.Point().Lon(),
|
Status: ConvertInternalToProtoBookingStatus(booking.Status),
|
||||||
Address: passenger.Passenger_departure_address.Properties.MustString("name"),
|
Driver: convertInternalUserToProtoUser(driver.Driver),
|
||||||
},
|
Passenger: convertInternalUserToProtoUser(booking.Passenger),
|
||||||
PassengerDestinationRoute: &proto.Feature{
|
PassengerPickupDate: ×tamp.Timestamp{
|
||||||
Lat: passenger.Passenger_destination_address.Point().Lat(),
|
Seconds: booking.Pickup_date,
|
||||||
Long: passenger.Passenger_destination_address.Point().Lon(),
|
},
|
||||||
Address: passenger.Passenger_destination_address.Properties.MustString("name"),
|
PassengerDepartureRoute: convertInternalFeatureToProtoFeature(booking.PassengerPickupAddress),
|
||||||
},
|
PassengerDestinationRoute: convertInternalFeatureToProtoFeature(booking.PassengerDropAddress),
|
||||||
Duration: &duration,
|
Duration: &booking.Duration,
|
||||||
Distance: &distance,
|
Distance: &distance,
|
||||||
Car: &proto.Car{
|
Car: &proto.Car{
|
||||||
Model: &driver.Car.Model,
|
Model: &car.Model,
|
||||||
Brand: &driver.Car.Brand,
|
Brand: &car.Brand,
|
||||||
},
|
},
|
||||||
Price: &proto.Price{
|
Price: &proto.Price{
|
||||||
Type: &priceType,
|
Type: &priceType,
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// Use a mutex to safely append to the responses slice
|
||||||
|
mu.Lock()
|
||||||
|
responses = append(responses, protoBooking)
|
||||||
|
mu.Unlock()
|
||||||
|
}(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for all goroutines to finish before returning
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
close(semaphore)
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertInternalUserToProtoUser(user internal.User) *proto.User {
|
||||||
|
return &proto.User{
|
||||||
|
Id: user.ID,
|
||||||
|
Alias: user.Alias,
|
||||||
|
FirstName: &user.FirstName,
|
||||||
|
LastName: &user.LastName,
|
||||||
|
Grade: &user.Grade,
|
||||||
|
Picture: &user.Picture,
|
||||||
|
Gender: &user.Gender,
|
||||||
|
VerifiedIdentity: &user.VerifiedIdentity,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertInternalFeatureToProtoFeature(feature *geojson.Feature) *proto.Feature {
|
||||||
|
return &proto.Feature{
|
||||||
|
Lat: feature.Point().Lat(),
|
||||||
|
Long: feature.Point().Lon(),
|
||||||
|
Address: feature.Properties.MustString("name"),
|
||||||
}
|
}
|
||||||
resp.Booking = responses
|
|
||||||
return resp, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SolidarityServiceServerImpl) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (resp *proto.DriverJourneysResponse, err error) {
|
func (s *SolidarityServiceServerImpl) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (resp *proto.DriverJourneysResponse, err error) {
|
||||||
|
|
||||||
if req.DepartureDate.Seconds == 0 || req.Departure == nil {
|
if req.DepartureDate.Seconds == 0 || req.Departure == nil {
|
||||||
return nil, errors.New("missing required fields")
|
return nil, errors.New("missing required fields")
|
||||||
}
|
}
|
||||||
|
@ -507,33 +574,14 @@ func (s *SolidarityServiceServerImpl) DriverJourneys(ctx context.Context, req *p
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
func (s *SolidarityServiceServerImpl) SetPassengerTrip(ctx context.Context, req *proto.PassengerTripRequest) (resp *proto.PassengerTripResponse, err error) {
|
func (s *SolidarityServiceServerImpl) SetPassengerTrip(ctx context.Context, req *proto.PassengerTripRequest) (resp *proto.PassengerTripResponse, err error) {
|
||||||
if req.Passenger.Id == "" || req.Passenger.Alias == "" || req.PassengerPickupDate.Seconds == 0 || req.PassengerDestinationAddress == nil || req.PassengerDestinationAddress == nil {
|
if req.Passenger.Id == "" || req.Passenger.Alias == "" {
|
||||||
return &proto.PassengerTripResponse{
|
return &proto.PassengerTripResponse{
|
||||||
Success: false,
|
Success: false,
|
||||||
}, errors.New("missing required fields")
|
}, errors.New("missing required fields")
|
||||||
}
|
}
|
||||||
passenger := internal.Passenger{
|
passenger := internal.Passenger{}
|
||||||
Passenger_departure_address: &geojson.Feature{
|
passenger.Passenger.ID = req.Passenger.Id
|
||||||
Type: "Feature",
|
passenger.Passenger.Alias = req.Passenger.Alias
|
||||||
Geometry: orb.Geometry(orb.Point{req.PassengerDepartureAddress.Lat, req.PassengerDepartureAddress.Long}),
|
|
||||||
Properties: geojson.Properties{
|
|
||||||
"name": req.PassengerDepartureAddress.Address,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Passenger_destination_address: &geojson.Feature{
|
|
||||||
Type: "Feature",
|
|
||||||
Geometry: orb.Geometry(orb.Point{req.PassengerDestinationAddress.Lat, req.PassengerDestinationAddress.Long}),
|
|
||||||
Properties: geojson.Properties{
|
|
||||||
"name": req.PassengerDestinationAddress.Address,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Passenger_pickup_date: req.PassengerPickupDate.Seconds,
|
|
||||||
Passenger: internal.User{
|
|
||||||
ID: req.Passenger.Id,
|
|
||||||
Alias: req.Passenger.Alias,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Passenger.FirstName != nil {
|
if req.Passenger.FirstName != nil {
|
||||||
passenger.Passenger.FirstName = *req.Passenger.FirstName
|
passenger.Passenger.FirstName = *req.Passenger.FirstName
|
||||||
}
|
}
|
||||||
|
@ -564,9 +612,6 @@ func (s *SolidarityServiceServerImpl) SetPassengerTrip(ctx context.Context, req
|
||||||
|
|
||||||
err = s.Handler.SetPassengerTrip(context.Background(), passenger)
|
err = s.Handler.SetPassengerTrip(context.Background(), passenger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
|
||||||
err = errors.New("ID is already used")
|
|
||||||
}
|
|
||||||
return &proto.PassengerTripResponse{
|
return &proto.PassengerTripResponse{
|
||||||
Success: false,
|
Success: false,
|
||||||
}, err
|
}, err
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
"solidarity-service/utils"
|
"solidarity-service/utils"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -66,11 +67,7 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er
|
||||||
log.Error().Err(err).Msg("Postgresql Storage CreatePassenger invalid ID")
|
log.Error().Err(err).Msg("Postgresql Storage CreatePassenger invalid ID")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if passenger.Passenger_pickup_date == 0 {
|
|
||||||
errMsg := "Postgresql Storage CreatePassenger empty UNIX pickup Date timestamp"
|
|
||||||
log.Error().Err(err).Msg(errMsg)
|
|
||||||
return errors.New(errMsg)
|
|
||||||
}
|
|
||||||
if passenger.Passenger.Alias == "" || passenger.Passenger.Operator == "" {
|
if passenger.Passenger.Alias == "" || passenger.Passenger.Operator == "" {
|
||||||
errMsg := "Postgresql Storage CreatePassenger empty alias or operator FQDN."
|
errMsg := "Postgresql Storage CreatePassenger empty alias or operator FQDN."
|
||||||
log.Error().Msg(errMsg)
|
log.Error().Msg(errMsg)
|
||||||
|
@ -82,23 +79,8 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er
|
||||||
log.Error().Err(err).Msg(errMsg)
|
log.Error().Err(err).Msg(errMsg)
|
||||||
return errors.New(errMsg + err.Error())
|
return errors.New(errMsg + err.Error())
|
||||||
}
|
}
|
||||||
departureJSON, err := json.Marshal(passenger.Passenger_departure_address)
|
_, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (passenger_id, alias, last_name, first_name, grade, picture, verified_identity, operator, preferences) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)", s.Tables["passengers"]),
|
||||||
if err != nil {
|
|
||||||
errMsg := "Postgresql Storage CreatePassenger Error encoding departure Feature to JSON"
|
|
||||||
log.Error().Err(err).Msg(errMsg)
|
|
||||||
return errors.New(errMsg + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
destinationJSON, err := json.Marshal(passenger.Passenger_destination_address)
|
|
||||||
if err != nil {
|
|
||||||
errMsg := "Postgresql Storage CreatePassenger Error converting destination Feature to JSON"
|
|
||||||
log.Error().Err(err).Msg(errMsg)
|
|
||||||
return errors.New(errMsg + err.Error())
|
|
||||||
}
|
|
||||||
_, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (passenger_id, passenger_departure_route, passenger_destination_route, alias, last_name, first_name, grade, picture, verified_identity, operator, preferences, passenger_pickup_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)", s.Tables["passengers"]),
|
|
||||||
passenger.Passenger.ID,
|
passenger.Passenger.ID,
|
||||||
departureJSON,
|
|
||||||
destinationJSON,
|
|
||||||
passenger.Passenger.Alias,
|
passenger.Passenger.Alias,
|
||||||
passenger.Passenger.LastName,
|
passenger.Passenger.LastName,
|
||||||
passenger.Passenger.FirstName,
|
passenger.Passenger.FirstName,
|
||||||
|
@ -106,24 +88,72 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er
|
||||||
passenger.Passenger.Picture,
|
passenger.Passenger.Picture,
|
||||||
passenger.Passenger.VerifiedIdentity,
|
passenger.Passenger.VerifiedIdentity,
|
||||||
passenger.Passenger.Operator,
|
passenger.Passenger.Operator,
|
||||||
preferencesJSON,
|
preferencesJSON)
|
||||||
passenger.Passenger_pickup_date)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
||||||
|
err = s.UpdatePassenger(passenger)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
errMsg := "Postgresql Storage CreatePassenger Error inserting data into the database"
|
errMsg := "Postgresql Storage CreatePassenger Error inserting data into the database"
|
||||||
log.Error().Err(err).Msg(errMsg)
|
log.Error().Err(err).Msg(errMsg)
|
||||||
return errors.New(errMsg + err.Error())
|
return errors.New(errMsg + err.Error())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (s PostgresqlStorage) UpdatePassenger(passenger internal.Passenger) (err error) {
|
||||||
|
_, err = uuid.Parse(passenger.Passenger.ID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("Postgresql Storage UpdatePassenger invalid ID")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if passenger.Passenger.Alias == "" || passenger.Passenger.Operator == "" {
|
||||||
|
errMsg := "Postgresql Storage UpdatePassenger empty alias or operator FQDN."
|
||||||
|
log.Error().Msg(errMsg)
|
||||||
|
return errors.New(errMsg)
|
||||||
|
}
|
||||||
|
preferencesJSON, err := json.Marshal(passenger.Preferences)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdatePassenger Error encoding Preferences to JSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
_, err = s.DbConnection.Exec(fmt.Sprintf(`
|
||||||
|
UPDATE %s
|
||||||
|
SET
|
||||||
|
alias = $2,
|
||||||
|
last_name = $3,
|
||||||
|
first_name = $4,
|
||||||
|
grade = $5,
|
||||||
|
picture = $6,
|
||||||
|
verified_identity = $7,
|
||||||
|
operator = $8,
|
||||||
|
preferences = $9
|
||||||
|
WHERE passenger_id = $1
|
||||||
|
`, s.Tables["passengers"]),
|
||||||
|
passenger.Passenger.ID,
|
||||||
|
passenger.Passenger.Alias,
|
||||||
|
passenger.Passenger.LastName,
|
||||||
|
passenger.Passenger.FirstName,
|
||||||
|
passenger.Passenger.Grade,
|
||||||
|
passenger.Passenger.Picture,
|
||||||
|
passenger.Passenger.VerifiedIdentity,
|
||||||
|
passenger.Passenger.Operator,
|
||||||
|
preferencesJSON)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdatePassenger Error updating data in the database"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s PostgresqlStorage) GetPassenger(passengerID string) (passenger internal.Passenger, err error) {
|
func (s PostgresqlStorage) GetPassenger(passengerID string) (passenger internal.Passenger, err error) {
|
||||||
var preferencesJSON []byte
|
var preferencesJSON []byte
|
||||||
var departure_address []byte
|
err = s.DbConnection.QueryRow(fmt.Sprintf("SELECT alias, last_name, first_name, grade, picture, verified_identity, operator, preferences, passenger_id FROM %s WHERE passenger_id = $1", s.Tables["passengers"]), passengerID).
|
||||||
var destination_address []byte
|
|
||||||
err = s.DbConnection.QueryRow(fmt.Sprintf("SELECT passenger_departure_route, passenger_destination_route, alias, last_name, first_name, grade, picture, verified_identity, operator, preferences, passenger_pickup_date , passenger_id FROM %s WHERE passenger_id = $1", s.Tables["passengers"]), passengerID).
|
|
||||||
Scan(
|
Scan(
|
||||||
&departure_address,
|
|
||||||
&destination_address,
|
|
||||||
&passenger.Passenger.Alias,
|
&passenger.Passenger.Alias,
|
||||||
&passenger.Passenger.LastName,
|
&passenger.Passenger.LastName,
|
||||||
&passenger.Passenger.FirstName,
|
&passenger.Passenger.FirstName,
|
||||||
|
@ -132,11 +162,9 @@ func (s PostgresqlStorage) GetPassenger(passengerID string) (passenger internal.
|
||||||
&passenger.Passenger.VerifiedIdentity,
|
&passenger.Passenger.VerifiedIdentity,
|
||||||
&passenger.Passenger.Operator,
|
&passenger.Passenger.Operator,
|
||||||
&preferencesJSON,
|
&preferencesJSON,
|
||||||
&passenger.Passenger_pickup_date,
|
|
||||||
&passenger.Passenger.ID,
|
&passenger.Passenger.ID,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
|
||||||
errMsg := "Postgresql Storage GetPassenger Error querying data from the database"
|
errMsg := "Postgresql Storage GetPassenger Error querying data from the database"
|
||||||
log.Error().Err(err).Msg(errMsg)
|
log.Error().Err(err).Msg(errMsg)
|
||||||
return passenger, errors.New(errMsg + err.Error())
|
return passenger, errors.New(errMsg + err.Error())
|
||||||
|
@ -148,18 +176,6 @@ func (s PostgresqlStorage) GetPassenger(passengerID string) (passenger internal.
|
||||||
log.Error().Err(err).Msg(errMsg)
|
log.Error().Err(err).Msg(errMsg)
|
||||||
return passenger, errors.New(errMsg + err.Error())
|
return passenger, errors.New(errMsg + err.Error())
|
||||||
}
|
}
|
||||||
passenger.Passenger_destination_address, err = geojson.UnmarshalFeature(destination_address)
|
|
||||||
if err != nil {
|
|
||||||
errMsg := "Postgresql Storage GetPassenger Error decoding Passenger destination route into GeoJSON"
|
|
||||||
log.Error().Err(err).Msg(errMsg)
|
|
||||||
return passenger, errors.New(errMsg + err.Error())
|
|
||||||
}
|
|
||||||
passenger.Passenger_departure_address, err = geojson.UnmarshalFeature(departure_address)
|
|
||||||
if err != nil {
|
|
||||||
errMsg := "Postgresql Storage GetPassenger Error decoding Passenger departure route into GeoJSON"
|
|
||||||
log.Error().Err(err).Msg(errMsg)
|
|
||||||
return passenger, errors.New(errMsg + err.Error())
|
|
||||||
}
|
|
||||||
return passenger, nil
|
return passenger, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,13 +252,116 @@ func (s PostgresqlStorage) CreateDriver(driver internal.Driver) (err error) {
|
||||||
carJSON,
|
carJSON,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
|
||||||
|
err = s.UpdateDriver(driver)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
errMsg := "Postgresql Storage CreateDriver Error inserting data into the database"
|
errMsg := "Postgresql Storage CreateDriver Error inserting data into the database"
|
||||||
log.Error().Err(err).Msg(errMsg)
|
log.Error().Err(err).Msg(errMsg)
|
||||||
return errors.New(errMsg + err.Error())
|
return errors.New(errMsg + err.Error())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (s PostgresqlStorage) UpdateDriver(driver internal.Driver) (err error) {
|
||||||
|
var availabilities []byte
|
||||||
|
_, err = uuid.Parse(driver.Driver.ID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("Postgresql Storage UpdateDriver invalid ID")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
departureJSON, err := json.Marshal(driver.Driver_departure_address)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver Error encoding departure Feature to JSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
preferencesJSON, err := json.Marshal(driver.Preferences)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver Error encoding Preferences to JSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg + err.Error())
|
||||||
|
return errors.New(errMsg)
|
||||||
|
}
|
||||||
|
carJSON, err := json.Marshal(driver.Car)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver Error encoding Car to JSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
if driver.Driver.Alias == "" || driver.Driver.Operator == "" {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver empty alias or operator FQDN."
|
||||||
|
log.Error().Msg(errMsg)
|
||||||
|
return errors.New(errMsg)
|
||||||
|
}
|
||||||
|
if driver.AvailabilitiesType != internal.Punctual && driver.AvailabilitiesType != internal.Regular {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver invalid Availabilities Type"
|
||||||
|
log.Error().Msg(errMsg)
|
||||||
|
return errors.New(errMsg)
|
||||||
|
}
|
||||||
|
if driver.Radius == 0 {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver Radius has to be defined"
|
||||||
|
log.Error().Msg(errMsg)
|
||||||
|
return errors.New(errMsg)
|
||||||
|
}
|
||||||
|
switch driver.AvailabilitiesType {
|
||||||
|
case internal.Punctual:
|
||||||
|
availabilities, err = json.Marshal(driver.PunctualAvailabilities)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver error converting Punctual availabilities"
|
||||||
|
log.Error().Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
case internal.Regular:
|
||||||
|
availabilities, err = json.Marshal(driver.RegularAvailabilities)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver error converting Regular availabilities"
|
||||||
|
log.Error().Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = s.DbConnection.Exec(fmt.Sprintf(`
|
||||||
|
UPDATE %s
|
||||||
|
SET
|
||||||
|
driver_departure_route = $2,
|
||||||
|
driver_radius = $3,
|
||||||
|
last_name = $4,
|
||||||
|
first_name = $5,
|
||||||
|
grade = $6,
|
||||||
|
alias = $7,
|
||||||
|
picture = $8,
|
||||||
|
verified_identity = $9,
|
||||||
|
preferences = $10,
|
||||||
|
availabilities_type = $11,
|
||||||
|
availabilities = $12,
|
||||||
|
operator = $13,
|
||||||
|
car = $14
|
||||||
|
WHERE driver_id = $1
|
||||||
|
`, s.Tables["drivers"]),
|
||||||
|
driver.Driver.ID,
|
||||||
|
departureJSON,
|
||||||
|
driver.Radius,
|
||||||
|
driver.Driver.LastName,
|
||||||
|
driver.Driver.FirstName,
|
||||||
|
driver.Driver.Grade,
|
||||||
|
driver.Driver.Alias,
|
||||||
|
driver.Driver.Picture,
|
||||||
|
driver.Driver.VerifiedIdentity,
|
||||||
|
preferencesJSON,
|
||||||
|
driver.AvailabilitiesType,
|
||||||
|
string(availabilities),
|
||||||
|
driver.Driver.Operator,
|
||||||
|
carJSON,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage UpdateDriver Error updating data in the database"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s PostgresqlStorage) GetDriver(driverID string) (driver internal.Driver, err error) {
|
func (s PostgresqlStorage) GetDriver(driverID string) (driver internal.Driver, err error) {
|
||||||
var preferencesJSON []byte
|
var preferencesJSON []byte
|
||||||
|
@ -335,12 +454,38 @@ func (s PostgresqlStorage) CreateBooking(booking internal.BookingRequest) (err e
|
||||||
log.Error().Err(err).Msg("Postgresql Storage CreateBooking empty operator")
|
log.Error().Err(err).Msg("Postgresql Storage CreateBooking empty operator")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (booking_id , passenger_id , driver_id , operator, booking_status) VALUES ($1,$2,$3,$4,$5)", s.Tables["bookings"]),
|
departureJSON, err := json.Marshal(booking.Departure_address)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage CreateBooking Error encoding departure Feature to JSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
destinationJSON, err := json.Marshal(booking.Destination_address)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage CreateBooking Error converting destination Feature to JSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
if booking.Pickup_date == 0 {
|
||||||
|
errMsg := "Postgresql Storage CreateBooking empty UNIX pickup Date timestamp"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return errors.New(errMsg)
|
||||||
|
}
|
||||||
|
booking.Distance = utils.Haversine(booking.Departure_address.Point().Lat(), booking.Departure_address.Point().Lon(),
|
||||||
|
booking.Destination_address.Point().Lat(), booking.Destination_address.Point().Lon())
|
||||||
|
booking.Duration, _ = utils.CalculateDurationBetweenFeatures(booking.Departure_address, booking.Destination_address)
|
||||||
|
_, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (booking_id , passenger_id , driver_id , operator, booking_status,departure_address,destination_address,pickup_date,duration,distance) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", s.Tables["bookings"]),
|
||||||
booking.ID,
|
booking.ID,
|
||||||
booking.Passenger_id,
|
booking.Passenger_id,
|
||||||
booking.Driver_id,
|
booking.Driver_id,
|
||||||
booking.Operator,
|
booking.Operator,
|
||||||
booking.Status,
|
booking.Status,
|
||||||
|
departureJSON,
|
||||||
|
destinationJSON,
|
||||||
|
booking.Pickup_date,
|
||||||
|
booking.Duration,
|
||||||
|
booking.Distance,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := "Postgresql Storage CreateBooking Error inserting data into the database"
|
errMsg := "Postgresql Storage CreateBooking Error inserting data into the database"
|
||||||
|
@ -351,18 +496,37 @@ func (s PostgresqlStorage) CreateBooking(booking internal.BookingRequest) (err e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s PostgresqlStorage) GetBooking(id string) (booking internal.Booking, err error) {
|
func (s PostgresqlStorage) GetBooking(id string) (booking internal.Booking, err error) {
|
||||||
err = s.DbConnection.QueryRow(fmt.Sprintf("SELECT booking_id , passenger_id , driver_id , booking_status FROM %s WHERE booking_id = $1", s.Tables["bookings"]), id).
|
var departureAddress []byte
|
||||||
|
var destinationAddress []byte
|
||||||
|
err = s.DbConnection.QueryRow(fmt.Sprintf("SELECT booking_id , passenger_id , driver_id , booking_status , departure_address,destination_address,pickup_date,duration,distance FROM %s WHERE booking_id = $1", s.Tables["bookings"]), id).
|
||||||
Scan(
|
Scan(
|
||||||
&booking.ID,
|
&booking.ID,
|
||||||
&booking.Passenger.ID,
|
&booking.Passenger.ID,
|
||||||
&booking.Driver.ID,
|
&booking.Driver.ID,
|
||||||
&booking.Status,
|
&booking.Status,
|
||||||
|
&departureAddress,
|
||||||
|
&destinationAddress,
|
||||||
|
&booking.Pickup_date,
|
||||||
|
&booking.Duration,
|
||||||
|
&booking.Distance,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := "Postgresql Storage GetBooking Error getting booking"
|
errMsg := "Postgresql Storage GetBooking Error getting booking"
|
||||||
log.Error().Err(err).Msg(errMsg)
|
log.Error().Err(err).Msg(errMsg)
|
||||||
return booking, errors.New(errMsg + err.Error())
|
return internal.Booking{}, errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
booking.PassengerPickupAddress, err = geojson.UnmarshalFeature(departureAddress)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage GetBooking Error decoding Driver departure route into GeoJSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return internal.Booking{}, errors.New(errMsg + err.Error())
|
||||||
|
}
|
||||||
|
booking.PassengerDropAddress, err = geojson.UnmarshalFeature(destinationAddress)
|
||||||
|
if err != nil {
|
||||||
|
errMsg := "Postgresql Storage GetBooking Error decoding Driver destination route into GeoJSON"
|
||||||
|
log.Error().Err(err).Msg(errMsg)
|
||||||
|
return internal.Booking{}, errors.New(errMsg + err.Error())
|
||||||
}
|
}
|
||||||
passenger, err := s.GetPassenger(booking.Passenger.ID)
|
passenger, err := s.GetPassenger(booking.Passenger.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -371,8 +535,6 @@ func (s PostgresqlStorage) GetBooking(id string) (booking internal.Booking, err
|
||||||
return booking, errors.New(errMsg + err.Error())
|
return booking, errors.New(errMsg + err.Error())
|
||||||
}
|
}
|
||||||
booking.Passenger = passenger.Passenger
|
booking.Passenger = passenger.Passenger
|
||||||
booking.PassengerPickupAddress = passenger.Passenger_departure_address
|
|
||||||
booking.PassengerDropAddress = passenger.Passenger_destination_address
|
|
||||||
driver, err := s.GetDriver(booking.Driver.ID)
|
driver, err := s.GetDriver(booking.Driver.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := "Postgresql Storage GetBooking Error getting driver"
|
errMsg := "Postgresql Storage GetBooking Error getting driver"
|
||||||
|
@ -404,55 +566,147 @@ func (s PostgresqlStorage) UpdateBookingStatus(id string, status internal.Bookin
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s PostgresqlStorage) FilterUserBookingsByStatus(user_type string, status internal.BookingStatus, user_id string) (bookings []internal.Booking, err error) {
|
func (s PostgresqlStorage) FilterUserBookingsByStatus(userType string, status internal.BookingStatus, userID string) (bookings []internal.Booking, err error) {
|
||||||
_, err = uuid.Parse(user_id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("invalid uuid")
|
return nil, errors.New("invalid UUID")
|
||||||
}
|
}
|
||||||
|
|
||||||
if user_type != "driver" && user_type != "passenger" {
|
if userType != "driver" && userType != "passenger" {
|
||||||
return nil, errors.New("invalid user type")
|
return nil, errors.New("invalid user type")
|
||||||
}
|
}
|
||||||
switch user_type {
|
|
||||||
case "driver":
|
queryTemplate := fmt.Sprintf("SELECT booking_id, passenger_id, driver_id, booking_status, departure_address, destination_address, pickup_date,duration,distance FROM %s WHERE %s_id = $1 AND booking_status = $2", s.Tables["bookings"], userType)
|
||||||
rows, err := s.DbConnection.Query(fmt.Sprintf("SELECT booking_id, passenger_id, driver_id, booking_status FROM %s WHERE driver_id = $1 AND booking_status = $2", s.Tables["bookings"]),
|
|
||||||
user_id, status)
|
rows, err := s.DbConnection.Query(queryTemplate, userID, status)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
for rows.Next() {
|
|
||||||
var booking internal.Booking
|
var wg sync.WaitGroup
|
||||||
if err := rows.Scan(&booking.ID, &booking.Passenger.ID, &booking.Driver.ID, &booking.Status); err != nil {
|
var mu sync.Mutex
|
||||||
return nil, err
|
|
||||||
}
|
for rows.Next() {
|
||||||
bookings = append(bookings, booking)
|
var departureAddress []byte
|
||||||
}
|
var destinationAddress []byte
|
||||||
if err := rows.Err(); err != nil {
|
var booking internal.Booking
|
||||||
return nil, err
|
|
||||||
}
|
if err := rows.Scan(&booking.ID, &booking.Passenger.ID, &booking.Driver.ID, &booking.Status, &departureAddress, &destinationAddress, &booking.Pickup_date, &booking.Duration, &booking.Distance); err != nil {
|
||||||
case "passenger":
|
|
||||||
rows, err := s.DbConnection.Query(fmt.Sprintf("SELECT booking_id, passenger_id, driver_id, booking_status FROM %s WHERE passenger_id = $1 AND booking_status = $2", s.Tables["bookings"]),
|
|
||||||
user_id, status)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer rows.Close()
|
|
||||||
for rows.Next() {
|
|
||||||
var booking internal.Booking
|
|
||||||
if err := rows.Scan(&booking.ID, &booking.Passenger.ID, &booking.Driver.ID, &booking.Status); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
bookings = append(bookings, booking)
|
|
||||||
}
|
|
||||||
if err := rows.Err(); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wg.Add(1)
|
||||||
|
go func(booking internal.Booking, departureAddress, destinationAddress []byte) {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
// Common logic for both "driver" and "passenger" cases
|
||||||
|
booking, err := s.populateBookingDetails(booking, departureAddress, destinationAddress)
|
||||||
|
if err != nil {
|
||||||
|
mu.Lock()
|
||||||
|
err = fmt.Errorf("Error populating booking details: %w", err)
|
||||||
|
mu.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mu.Lock()
|
||||||
|
bookings = append(bookings, booking)
|
||||||
|
mu.Unlock()
|
||||||
|
}(booking, departureAddress, destinationAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for all goroutines to finish
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return bookings, nil
|
return bookings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) populateBookingDetails(booking internal.Booking, departureAddress, destinationAddress []byte) (internal.Booking, error) {
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
var mu sync.Mutex
|
||||||
|
errCh := make(chan error, 4) // Buffered channel to handle potential errors
|
||||||
|
|
||||||
|
// Concurrently fetch passenger information
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
passenger, err := s.GetPassenger(booking.Passenger.ID)
|
||||||
|
if err != nil {
|
||||||
|
errCh <- fmt.Errorf("Postgresql Storage GetBooking Error getting passenger: %w", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mu.Lock()
|
||||||
|
booking.Passenger = passenger.Passenger
|
||||||
|
mu.Unlock()
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Concurrently fetch driver information
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
driver, err := s.GetDriver(booking.Driver.ID)
|
||||||
|
if err != nil {
|
||||||
|
errCh <- fmt.Errorf("Postgresql Storage GetBooking Error getting driver: %w", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mu.Lock()
|
||||||
|
booking.Driver = driver.Driver
|
||||||
|
mu.Unlock()
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Concurrently decode departureAddress into GeoJSON
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
decodedDepartureAddress, err := geojson.UnmarshalFeature(departureAddress)
|
||||||
|
if err != nil {
|
||||||
|
errCh <- fmt.Errorf("Postgresql Storage FilterBookingsByStatus Error decoding Driver departure route into GeoJSON: %w", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mu.Lock()
|
||||||
|
booking.PassengerPickupAddress = decodedDepartureAddress
|
||||||
|
mu.Unlock()
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Concurrently decode destinationAddress into GeoJSON
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
decodedDestinationAddress, err := geojson.UnmarshalFeature(destinationAddress)
|
||||||
|
if err != nil {
|
||||||
|
errCh <- fmt.Errorf("Postgresql Storage FilterBookingsByStatus Error decoding Driver destination route into GeoJSON: %w", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mu.Lock()
|
||||||
|
booking.PassengerDropAddress = decodedDestinationAddress
|
||||||
|
mu.Unlock()
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Close the error channel after all goroutines are done
|
||||||
|
go func() {
|
||||||
|
wg.Wait()
|
||||||
|
close(errCh)
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Check for errors using a select statement
|
||||||
|
for err := range errCh {
|
||||||
|
return internal.Booking{}, err // Return the first error encountered
|
||||||
|
}
|
||||||
|
|
||||||
|
return booking, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s PostgresqlStorage) GetAllDrivers(date int64) (drivers []internal.Driver, err error) {
|
func (s PostgresqlStorage) GetAllDrivers(date int64) (drivers []internal.Driver, err error) {
|
||||||
rows, err := s.DbConnection.Query(fmt.Sprintf("SELECT driver_id, driver_departure_route, driver_radius, last_name, first_name, grade, alias, picture, verified_identity, preferences, availabilities_type, availabilities, operator, car FROM %s", s.Tables["drivers"]))
|
rows, err := s.DbConnection.Query(fmt.Sprintf("SELECT driver_id, driver_departure_route, driver_radius, last_name, first_name, grade, alias, picture, verified_identity, preferences, availabilities_type, availabilities, operator, car FROM %s", s.Tables["drivers"]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -496,34 +750,76 @@ func (s PostgresqlStorage) GetAllDrivers(date int64) (drivers []internal.Driver,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter drivers based on date matching punctual or regular availabilities.
|
// Filter drivers based on date and time matching punctual or regular availabilities.
|
||||||
if driver.AvailabilitiesType == internal.Punctual {
|
if driver.AvailabilitiesType == internal.Punctual {
|
||||||
if err := json.Unmarshal(availabilitiesJSON, &driver.PunctualAvailabilities); err != nil {
|
if err := json.Unmarshal(availabilitiesJSON, &driver.PunctualAvailabilities); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Convert the date to the day of the week and make it lowercase.
|
year, month, day := time.Unix(date, 0).Date()
|
||||||
dayOfWeek := strings.ToLower(time.Unix(date, 0).UTC().Format("Mon"))
|
dateHour := time.Unix(date, 0).UTC().Local()
|
||||||
|
dateHour_string := dateHour.Format("3:04 PM")
|
||||||
for _, avail := range driver.PunctualAvailabilities {
|
for _, avail := range driver.PunctualAvailabilities {
|
||||||
// Extract the day part of the punctual driver's date and compare.
|
availyear, availmonth, availday := time.Unix(avail.Date, 0).Date()
|
||||||
availDate := time.Unix(avail.Date, 0)
|
if availyear == year && availmonth == month && availday == day {
|
||||||
if strings.ToLower(availDate.Format("Mon")) == dayOfWeek {
|
startTime, err := time.Parse("3:04 PM", avail.StartTime)
|
||||||
drivers = append(drivers, driver)
|
if err != nil {
|
||||||
break
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
endTime, err := time.Parse("3:04 PM", avail.EndTime)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert DateHour_string to time.Time
|
||||||
|
dateHourTime, err := time.Parse("3:04 PM", dateHour_string)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if dateHourTime.After(startTime) || dateHourTime.Equal(startTime) {
|
||||||
|
if dateHourTime.Before(endTime) || dateHourTime.Equal(endTime) {
|
||||||
|
drivers = append(drivers, driver)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Check if the date and time match the punctual driver's availability.
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if driver.AvailabilitiesType == internal.Regular {
|
} else if driver.AvailabilitiesType == internal.Regular {
|
||||||
if err := json.Unmarshal(availabilitiesJSON, &driver.RegularAvailabilities); err != nil {
|
if err := json.Unmarshal(availabilitiesJSON, &driver.RegularAvailabilities); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Convert the date to the day of the week and make it lowercase.
|
|
||||||
dayOfWeek := strings.ToLower(time.Unix(date, 0).UTC().Format("Mon"))
|
dayOfWeek := strings.ToLower(time.Unix(date, 0).Local().Format("Mon"))
|
||||||
fmt.Println(dayOfWeek)
|
dateHour := time.Unix(date, 0).UTC().Local()
|
||||||
|
dateHour_string := dateHour.Format("3:04 PM")
|
||||||
|
|
||||||
for _, avail := range driver.RegularAvailabilities {
|
for _, avail := range driver.RegularAvailabilities {
|
||||||
fmt.Println(strings.ToLower(avail.DayOfWeek))
|
|
||||||
|
// Check if the day and time match the regular driver's availability.
|
||||||
if strings.ToLower(avail.DayOfWeek) == dayOfWeek {
|
if strings.ToLower(avail.DayOfWeek) == dayOfWeek {
|
||||||
drivers = append(drivers, driver)
|
startTime, err := time.Parse("3:04 PM", avail.StartTime)
|
||||||
break
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
endTime, err := time.Parse("3:04 PM", avail.EndTime)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert DateHour_string to time.Time
|
||||||
|
dateHourTime, err := time.Parse("3:04 PM", dateHour_string)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if dateHourTime.After(startTime) || dateHourTime.Equal(startTime) {
|
||||||
|
if dateHourTime.Before(endTime) || dateHourTime.Equal(endTime) {
|
||||||
|
drivers = append(drivers, driver)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,6 @@ table "passengers" {
|
||||||
null = false
|
null = false
|
||||||
type = uuid
|
type = uuid
|
||||||
}
|
}
|
||||||
column "passenger_departure_route" {
|
|
||||||
null = false
|
|
||||||
type = jsonb
|
|
||||||
}
|
|
||||||
column "passenger_destination_route" {
|
|
||||||
null = false
|
|
||||||
type = jsonb
|
|
||||||
}
|
|
||||||
column "alias" {
|
column "alias" {
|
||||||
null = false
|
null = false
|
||||||
type = varchar(15)
|
type = varchar(15)
|
||||||
|
@ -45,10 +37,6 @@ table "passengers" {
|
||||||
null = true
|
null = true
|
||||||
type = jsonb
|
type = jsonb
|
||||||
}
|
}
|
||||||
column "passenger_pickup_date" {
|
|
||||||
null = false
|
|
||||||
type = int
|
|
||||||
}
|
|
||||||
primary_key {
|
primary_key {
|
||||||
columns = [column.passenger_id]
|
columns = [column.passenger_id]
|
||||||
}
|
}
|
||||||
|
@ -139,7 +127,27 @@ table "bookings" {
|
||||||
}
|
}
|
||||||
column "booking_status" {
|
column "booking_status" {
|
||||||
null = false
|
null = false
|
||||||
type = enum.booking_status
|
type = enum.bookingstatus
|
||||||
|
}
|
||||||
|
column "departure_address" {
|
||||||
|
null = false
|
||||||
|
type = jsonb
|
||||||
|
}
|
||||||
|
column "destination_address" {
|
||||||
|
null = false
|
||||||
|
type = jsonb
|
||||||
|
}
|
||||||
|
column "pickup_date" {
|
||||||
|
null = false
|
||||||
|
type = int
|
||||||
|
}
|
||||||
|
column "duration"{
|
||||||
|
null = false
|
||||||
|
type = int
|
||||||
|
}
|
||||||
|
column "distance"{
|
||||||
|
null = false
|
||||||
|
type = float
|
||||||
}
|
}
|
||||||
primary_key {
|
primary_key {
|
||||||
columns = [column.booking_id]
|
columns = [column.booking_id]
|
||||||
|
@ -153,8 +161,6 @@ table "bookings" {
|
||||||
ref_columns = [table.passengers.column.passenger_id]
|
ref_columns = [table.passengers.column.passenger_id]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum "booking_status" {
|
enum "booking_status" {
|
||||||
schema = schema.solidarity_service
|
schema = schema.solidarity_service
|
||||||
values = ["INITIATED", "WAITING_PASSENGER_CONFIRMATION", "WAITING_DRIVER_CONFIRMATION", "CONFIRMED", "CANCELLED", "COMPLETED_PENDING_VALIDATION", "VALIDATED"]
|
values = ["INITIATED", "WAITING_PASSENGER_CONFIRMATION", "WAITING_DRIVER_CONFIRMATION", "CONFIRMED", "CANCELLED", "COMPLETED_PENDING_VALIDATION", "VALIDATED"]
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
import "math"
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
"math"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
func Haversine(lat1, lon1, lat2, lon2 float64) float64 {
|
func Haversine(lat1, lon1, lat2, lon2 float64) float64 {
|
||||||
// Radius of the Earth in kilometers
|
|
||||||
R := 6371.0
|
R := 6371.0
|
||||||
|
|
||||||
lat1 = lat1 * math.Pi / 180
|
lat1 = lat1 * math.Pi / 180
|
||||||
|
@ -20,3 +28,51 @@ func Haversine(lat1, lon1, lat2, lon2 float64) float64 {
|
||||||
distance := R * c
|
distance := R * c
|
||||||
return distance
|
return distance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CalculateDurationBetweenFeatures(feature1, feature2 *geojson.Feature) (int64, error) {
|
||||||
|
coords1 := feature1.Point()
|
||||||
|
coords2 := feature2.Point()
|
||||||
|
v := viper.New()
|
||||||
|
v.SetConfigName("config")
|
||||||
|
v.AddConfigPath(".")
|
||||||
|
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||||
|
v.AutomaticEnv()
|
||||||
|
_ = v.ReadInConfig()
|
||||||
|
routingBaseUrl := v.GetString("routing.valhalla.base_url")
|
||||||
|
url := fmt.Sprintf("%sroute?json=%s", routingBaseUrl, createJSONROUTERequest(coords1.X(), coords1.Y(), coords2.X(), coords2.Y()))
|
||||||
|
response, err := http.Get(url)
|
||||||
|
if err != nil {
|
||||||
|
return 0, errors.New("routing service error")
|
||||||
|
}
|
||||||
|
var result map[string]interface{}
|
||||||
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
if err := decoder.Decode(&result); err != nil {
|
||||||
|
return 0, errors.New("routing response decoding error")
|
||||||
|
}
|
||||||
|
trip, ok := result["trip"].(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
return 0, errors.New("routing response decoding error")
|
||||||
|
}
|
||||||
|
summary, ok := trip["summary"].(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
return 0, errors.New("routing response decoding error")
|
||||||
|
}
|
||||||
|
duration, ok := summary["time"].(float64)
|
||||||
|
if !ok {
|
||||||
|
return 0, errors.New("routing response decoding error")
|
||||||
|
}
|
||||||
|
|
||||||
|
return int64(duration), nil
|
||||||
|
}
|
||||||
|
func createJSONROUTERequest(lat1, lon1, lat2, lon2 float64) string {
|
||||||
|
request := map[string]interface{}{
|
||||||
|
"locations": []map[string]float64{
|
||||||
|
{"lat": lat1, "lon": lon1},
|
||||||
|
{"lat": lat2, "lon": lon2},
|
||||||
|
},
|
||||||
|
"costing": "auto",
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonRequest, _ := json.Marshal(request)
|
||||||
|
return string(jsonRequest)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue