refactoring

This commit is contained in:
sbouaram 2023-12-08 07:31:41 +01:00
parent d12c55d740
commit 150c913feb
19 changed files with 1175 additions and 814 deletions

View File

@ -20,6 +20,7 @@ storage:
services:
grpc:
ip: 0.0.0.0
enable: true
port: 8089
solidarity-api:

View File

@ -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) {
driver.Driver.Operator = "internal-grpc"
err = s.Storage.CreateDriver(driver)
if err != nil {
return err
}
return nil
}
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
}
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)
if err != nil {
return internal.Booking{}, internal.Passenger{}, internal.Driver{}, err
return internal.Booking{}, err
}
passenger, err = s.Storage.GetPassenger(booking.Passenger.ID)
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
return booking, nil
}
func (s *SolidarityServiceHandler) GetBookingsByStatus(ctx context.Context, status string, filterType string, id string) (bookings []internal.Booking, err error) {

View File

@ -17,9 +17,6 @@ const (
)
type Passenger struct {
Passenger_departure_address *geojson.Feature
Passenger_destination_address *geojson.Feature
Passenger_pickup_date int64
Passenger User
Preferences Preferences
}
@ -70,6 +67,11 @@ type BookingRequest struct {
Status BookingStatus `json:"booking_status"`
Details map[string]any `json:"booking_details"`
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 {
@ -80,6 +82,9 @@ type Booking struct {
PassengerDropAddress *geojson.Feature
Status BookingStatus `json:"booking_status"`
Details map[string]any `json:"booking_details"`
Pickup_date int64 `json:"pickup_date"`
Duration int64 `json:"duration"`
Distance float64 `json:"distance"`
}
type RegularAvailabilities struct {

View File

@ -11,7 +11,6 @@ package openapi
import (
"context"
"fmt"
"github.com/spf13/viper"
"net/http"
"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) {
bookings, err := s.storage.FilterUserBookingsByStatus(filterType, internal.BookingStatus(status), id)
if err != nil {
fmt.Println(err)
if strings.Contains(err.Error(), " no rows in result set") {
return Response(http.StatusBadRequest, "no related data recheck your parameters"), nil
} else {
@ -51,55 +49,48 @@ func (s *BookingsFilterAPIService) FilterBookingsByStatus(ctx context.Context, o
}
responses := []Booking{}
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)
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
return Response(http.StatusInternalServerError, err.Error()), err
}
car := driver.Car
responses = append(responses, Booking{
Id: v.ID,
Status: BookingStatus(v.Status),
Driver: User{
Id: v.Driver.ID,
Operator: driver.Driver.Operator,
Alias: driver.Driver.Alias,
FirstName: driver.Driver.FirstName,
LastName: driver.Driver.LastName,
Grade: int32(driver.Driver.Grade),
Picture: driver.Driver.Picture,
Gender: driver.Driver.Gender,
VerifiedIdentity: driver.Driver.VerifiedIdentity,
Operator: v.Driver.Operator,
Alias: v.Driver.Alias,
FirstName: v.Driver.FirstName,
LastName: v.Driver.LastName,
Grade: int32(v.Driver.Grade),
Picture: v.Driver.Picture,
Gender: v.Driver.Gender,
VerifiedIdentity: v.Driver.VerifiedIdentity,
},
Passenger: User{
Id: v.Passenger.ID,
Operator: passenger.Passenger.Operator,
Alias: passenger.Passenger.Alias,
FirstName: passenger.Passenger.FirstName,
LastName: passenger.Passenger.LastName,
Grade: int32(passenger.Passenger.Grade),
Picture: passenger.Passenger.Picture,
Gender: passenger.Passenger.Gender,
VerifiedIdentity: passenger.Passenger.VerifiedIdentity,
Operator: v.Passenger.Operator,
Alias: v.Passenger.Alias,
FirstName: v.Passenger.FirstName,
LastName: v.Passenger.LastName,
Grade: int32(v.Passenger.Grade),
Picture: v.Passenger.Picture,
Gender: v.Passenger.Gender,
VerifiedIdentity: v.Passenger.VerifiedIdentity,
},
PassengerPickupDate: int32(passenger.Passenger_pickup_date),
PassengerPickupLat: passenger.Passenger_departure_address.Point().X(),
PassengerPickupLng: passenger.Passenger_departure_address.Point().Y(),
PassengerPickupAddress: passenger.Passenger_departure_address.Properties.MustString("name"),
PassengerDropLat: passenger.Passenger_destination_address.Point().X(),
PassengerDropLng: passenger.Passenger_destination_address.Point().Y(),
PassengerDropAddress: passenger.Passenger_destination_address.Properties.MustString("name"),
Duration: int32(duration),
Distance: int32(s.handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)),
PassengerPickupDate: int32(v.Pickup_date),
PassengerPickupLat: v.PassengerPickupAddress.Point().X(),
PassengerPickupLng: v.PassengerPickupAddress.Point().Y(),
PassengerPickupAddress: v.PassengerPickupAddress.Properties.MustString("name"),
PassengerDropLat: v.PassengerDropAddress.Point().X(),
PassengerDropLng: v.PassengerDropAddress.Point().Y(),
PassengerDropAddress: v.PassengerDropAddress.Properties.MustString("name"),
Duration: int32(v.Duration),
Distance: int32(v.Distance),
Car: Car{
Model: driver.Car.Model,
Brand: driver.Car.Brand,
Model: car.Model,
Brand: car.Brand,
},
Price: Price{
Type: "FREE",

View File

@ -19,8 +19,6 @@ import (
"solidarity-service/handler"
"solidarity-service/internal"
"solidarity-service/storage"
"solidarity-service/utils"
"strings"
)
// 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
err := s.storage.CreateDriver(driver)
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")
} else {
return Response(201, "Punctual driver availabilities set successfully"), nil
@ -125,9 +120,6 @@ func (s *DriverAvailabilityAndScheduleAPIService) DriverRegularAvailabilitiesPos
driver.Car.Model = driverRegularAvailabilitiesRequest.Car.Model
err := s.storage.CreateDriver(driver)
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")
} else {
return Response(201, "Regular driver availabilities set successfully"), nil

View File

@ -13,6 +13,8 @@ import (
"context"
"errors"
"fmt"
"github.com/paulmach/orb"
"github.com/paulmach/orb/geojson"
"github.com/spf13/viper"
"net/http"
"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")
}
}
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{
Id: booking.ID,
Driver: User{
Id: driver.Driver.ID,
Operator: driver.Driver.Operator,
Alias: driver.Driver.Alias,
FirstName: driver.Driver.FirstName,
LastName: driver.Driver.LastName,
Grade: int32(driver.Driver.Grade),
Picture: driver.Driver.Picture,
Gender: driver.Driver.Gender,
VerifiedIdentity: driver.Driver.VerifiedIdentity,
Id: booking.Driver.ID,
Operator: booking.Driver.Operator,
Alias: booking.Driver.Alias,
FirstName: booking.Driver.FirstName,
LastName: booking.Driver.LastName,
Grade: int32(booking.Driver.Grade),
Picture: booking.Driver.Picture,
Gender: booking.Driver.Gender,
VerifiedIdentity: booking.Driver.VerifiedIdentity,
},
Passenger: User{
Id: passenger.Passenger.ID,
Operator: passenger.Passenger.Operator,
Alias: passenger.Passenger.Alias,
FirstName: passenger.Passenger.FirstName,
LastName: passenger.Passenger.LastName,
Grade: int32(passenger.Passenger.Grade),
Picture: passenger.Passenger.Picture,
Gender: passenger.Passenger.Gender,
VerifiedIdentity: passenger.Passenger.VerifiedIdentity,
Id: booking.Passenger.ID,
Operator: booking.Passenger.Operator,
Alias: booking.Passenger.Alias,
FirstName: booking.Passenger.FirstName,
LastName: booking.Passenger.LastName,
Grade: int32(booking.Passenger.Grade),
Picture: booking.Passenger.Picture,
Gender: booking.Passenger.Gender,
VerifiedIdentity: booking.Passenger.VerifiedIdentity,
},
PassengerPickupDate: int32(passenger.Passenger_pickup_date),
PassengerPickupLat: passenger.Passenger_departure_address.Point().X(),
PassengerPickupLng: passenger.Passenger_departure_address.Point().Y(),
PassengerPickupAddress: passenger.Passenger_departure_address.Properties.MustString("name"),
PassengerDropLat: passenger.Passenger_destination_address.Point().X(),
PassengerDropLng: passenger.Passenger_destination_address.Point().Y(),
PassengerDropAddress: passenger.Passenger_destination_address.Properties.MustString("name"),
PassengerPickupDate: int32(booking.Pickup_date),
PassengerPickupLat: booking.PassengerPickupAddress.Point().X(),
PassengerPickupLng: booking.PassengerPickupAddress.Point().Y(),
PassengerPickupAddress: booking.PassengerPickupAddress.Properties.MustString("name"),
PassengerDropLat: booking.PassengerDropAddress.Point().X(),
PassengerDropLng: booking.PassengerDropAddress.Point().Y(),
PassengerDropAddress: booking.PassengerDropAddress.Properties.MustString("name"),
Status: BookingStatus(booking.Status),
Duration: int32(duration),
Distance: int32(s.handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)),
Car: Car{
Model: driver.Car.Model,
Brand: driver.Car.Brand,
},
Duration: int32(booking.Duration),
Distance: int32(booking.Distance),
Price: Price{
Type: "FREE",
},
}
fmt.Println(response)
return Response(200, response), nil
}
// 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.Passenger_id = bookingRequest.PassengerId
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)
if err != nil {
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
@ -145,7 +144,7 @@ func (s *InteractAPIService) PostBookings(ctx context.Context, bookingRequest Bo
if err != nil {
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 {
duration = 0
}
@ -173,16 +172,16 @@ func (s *InteractAPIService) PostBookings(ctx context.Context, bookingRequest Bo
Gender: passenger.Passenger.Gender,
VerifiedIdentity: passenger.Passenger.VerifiedIdentity,
},
PassengerPickupDate: int32(passenger.Passenger_pickup_date),
PassengerPickupLat: passenger.Passenger_departure_address.Point().X(),
PassengerPickupLng: passenger.Passenger_departure_address.Point().Y(),
PassengerPickupAddress: passenger.Passenger_departure_address.Properties.MustString("name"),
PassengerDropLat: passenger.Passenger_destination_address.Point().X(),
PassengerDropLng: passenger.Passenger_destination_address.Point().Y(),
PassengerDropAddress: passenger.Passenger_destination_address.Properties.MustString("name"),
PassengerPickupDate: int32(booking.Pickup_date),
PassengerPickupLat: booking.Departure_address.Point().X(),
PassengerPickupLng: booking.Departure_address.Point().Y(),
PassengerPickupAddress: booking.Departure_address.Properties.MustString("name"),
PassengerDropLat: booking.Destination_address.Point().X(),
PassengerDropLng: booking.Destination_address.Point().Y(),
PassengerDropAddress: booking.Destination_address.Properties.MustString("name"),
Status: bookingRequest.Status,
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{
Model: driver.Car.Model,
Brand: driver.Car.Brand,

View File

@ -12,15 +12,11 @@ package openapi
import (
"context"
"errors"
"github.com/paulmach/orb"
"github.com/paulmach/orb/geojson"
"github.com/spf13/viper"
"net/http"
"solidarity-service/handler"
"solidarity-service/internal"
"solidarity-service/storage"
"solidarity-service/utils"
"strings"
)
// 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
func (s *PassengerTripRequestAPIService) PassengerPost(ctx context.Context, passengerTripRequest PassengerTripRequest) (ImplResponse, error) {
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.Operator = passengerTripRequest.User.Operator
passenger.Passenger.Alias = passengerTripRequest.User.Alias
@ -75,9 +56,6 @@ func (s *PassengerTripRequestAPIService) PassengerPost(ctx context.Context, pass
passenger.Preferences.Music = passengerTripRequest.Preferences.Music
err := s.storage.CreatePassenger(passenger)
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")
} else {
return Response(201, "Trip request created"), nil

View File

@ -21,6 +21,14 @@ type BookingRequest struct {
Status BookingStatus `json:"status"`
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
@ -31,6 +39,13 @@ func AssertBookingRequestRequired(obj BookingRequest) error {
"driverId": obj.DriverId,
"status": obj.Status,
"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 {
if isZero := IsZeroValue(el); isZero {

View File

@ -11,22 +11,6 @@ package openapi
type PassengerTripRequest struct {
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"`
}
@ -34,13 +18,6 @@ type PassengerTripRequest struct {
func AssertPassengerTripRequestRequired(obj PassengerTripRequest) error {
elements := map[string]interface{}{
"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 {
if isZero := IsZeroValue(el); isZero {

18
main.go
View File

@ -19,19 +19,19 @@ func main() {
}
var (
service_name = cfg.GetString("name")
grpc_enable = cfg.GetBool("services.grpc.enable")
solidarity_api_enable = cfg.GetBool("services.solidarity-api.enable")
routing_service_type = cfg.GetString("routing.type")
valhalla_base_url = cfg.GetString("routing.valhalla.base_url")
serviceName = cfg.GetString("name")
grpcEnable = cfg.GetBool("services.grpc.enable")
solidarityApiEnable = cfg.GetBool("services.solidarity-api.enable")
routingServiceType = cfg.GetString("routing.type")
valhallaBaseUrl = cfg.GetString("routing.valhalla.base_url")
)
log.Info().Msg("Running " + service_name)
log.Info().Msg("Running " + serviceName)
storageService, err := storage.NewStorage(cfg)
if err != nil {
log.Fatal().Err(err).Msg("Could not initiate the storage service")
return
}
routing, err := routing.NewRoutingService(routing_service_type, valhalla_base_url)
routing, err := routing.NewRoutingService(routingServiceType, valhallaBaseUrl)
if err != nil {
log.Fatal().Err(err).Msg("Could not initiate the routing service")
return
@ -43,12 +43,12 @@ func main() {
}
failed := make(chan error)
if grpc_enable {
if grpcEnable {
log.Info().Msg("Running gRPC server")
go grpcserver.Run(failed, cfg, handler)
}
if solidarity_api_enable {
if solidarityApiEnable {
log.Info().Msg("Running Interoperability REST API")
go api.Run(cfg, handler, storageService)
}

View File

@ -730,6 +730,9 @@ type BookingRequest struct {
PassengerId string `protobuf:"bytes,2,opt,name=passengerId,proto3" json:"passengerId,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"`
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() {
@ -792,6 +795,27 @@ func (x *BookingRequest) GetStatus() BookingStatus {
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 {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -808,6 +832,7 @@ type Booking struct {
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"`
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() {
@ -919,6 +944,13 @@ func (x *Booking) GetCar() *Car {
return nil
}
func (x *Booking) GetPickupDate() *timestamp.Timestamp {
if x != nil {
return x.PickupDate
}
return nil
}
type Car struct {
state protoimpl.MessageState
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,
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,
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,
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,
@ -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,
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,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x82, 0x04, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x64, 0x12, 0x1d, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65,
0x72, 0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61, 0x73,
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e,
0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 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,
0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70,
0x44, 0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74,
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72,
0x65, 0x52, 0x17, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61,
0x72, 0x74, 0x75, 0x72, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x1b, 0x70, 0x61,
0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65,
0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x6f, 0x75, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07,
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, 0x1f, 0x0a, 0x08,
0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00,
0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a,
0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x48,
0x01, 0x52, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1c,
0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e,
0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x03,
0x63, 0x61, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x43, 0x61, 0x72, 0x48,
0x02, 0x52, 0x03, 0x63, 0x61, 0x72, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61,
0x6e, 0x63, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x63, 0x61, 0x72, 0x22, 0x4f, 0x0a, 0x03, 0x43,
0x61, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a,
0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05,
0x62, 0x72, 0x61, 0x6e, 0x64, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x6f, 0x64,
0x65, 0x6c, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x22, 0xf1, 0x01, 0x0a,
0x0b, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x07,
0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52,
0x07, 0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x61,
0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x07,
0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x6d, 0x75,
0x73, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x05, 0x6d, 0x75, 0x73,
0x69, 0x63, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b,
0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x03, 0x52, 0x08, 0x69, 0x73, 0x54, 0x61,
0x6c, 0x6b, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, 0x6c, 0x75, 0x67, 0x67, 0x61,
0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x04, 0x52,
0x0b, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x88, 0x01, 0x01, 0x42,
0x0a, 0x0a, 0x08, 0x5f, 0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x75, 0x73, 0x69,
0x63, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x42,
0x0f, 0x0a, 0x0d, 0x5f, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65,
0x22, 0x8b, 0x01, 0x0a, 0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12,
0x1b, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48,
0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08,
0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02,
0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a,
0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e,
0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xcf,
0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x22, 0x0a,
0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x48, 0x00, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01,
0x01, 0x12, 0x20, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65,
0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01,
0x28, 0x03, 0x48, 0x02, 0x52, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d,
0x0a, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48,
0x03, 0x52, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a,
0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52,
0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x11, 0x76, 0x65,
0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18,
0x08, 0x20, 0x01, 0x28, 0x08, 0x48, 0x05, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65,
0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b,
0x5f, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f,
0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x67, 0x72,
0x61, 0x64, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x42,
0x09, 0x0a, 0x07, 0x5f, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x76,
0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
0x2a, 0x4a, 0x0a, 0x09, 0x44, 0x61, 0x79, 0x4f, 0x66, 0x57, 0x65, 0x65, 0x6b, 0x12, 0x07, 0x0a,
0x03, 0x4d, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x55, 0x45, 0x10, 0x01, 0x12,
0x07, 0x0a, 0x03, 0x57, 0x45, 0x44, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x48, 0x55, 0x10,
0x04, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x52, 0x49, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x41,
0x54, 0x10, 0x06, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x55, 0x4e, 0x10, 0x07, 0x2a, 0x2e, 0x0a, 0x09,
0x50, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x52, 0x45,
0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12,
0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0xb2, 0x01, 0x0a,
0x0d, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d,
0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1f, 0x0a,
0x1b, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x5f,
0x43, 0x4f, 0x4e, 0x46, 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,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x11, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74,
0x75, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x10, 0x64, 0x65, 0x70,
0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x39, 0x0a,
0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64,
0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61,
0x74, 0x75, 0x72, 0x65, 0x52, 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b,
0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 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, 0x0a, 0x70, 0x69, 0x63, 0x6b, 0x75,
0x70, 0x44, 0x61, 0x74, 0x65, 0x22, 0xbf, 0x04, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
0x64, 0x12, 0x1d, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72,
0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73,
0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 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, 0x13,
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44,
0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72,
0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
0x52, 0x17, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72,
0x74, 0x75, 0x72, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x1b, 0x70, 0x61, 0x73,
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08,
0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e,
0x67, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f,
0x75, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 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, 0x1f, 0x0a, 0x08, 0x64,
0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52,
0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08,
0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01,
0x52, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1c, 0x0a,
0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x50,
0x72, 0x69, 0x63, 0x65, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x63,
0x61, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x43, 0x61, 0x72, 0x48, 0x02,
0x52, 0x03, 0x63, 0x61, 0x72, 0x88, 0x01, 0x01, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b,
0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0c, 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, 0x0a, 0x70, 0x69, 0x63, 0x6b, 0x75,
0x70, 0x44, 0x61, 0x74, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x42,
0x06, 0x0a, 0x04, 0x5f, 0x63, 0x61, 0x72, 0x22, 0x4f, 0x0a, 0x03, 0x43, 0x61, 0x72, 0x12, 0x19,
0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x62, 0x72, 0x61,
0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x62, 0x72, 0x61, 0x6e,
0x64, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x42, 0x08,
0x0a, 0x06, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x22, 0xf1, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x65,
0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x73, 0x6d, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x73, 0x6d, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x61, 0x6e, 0x69, 0x6d, 0x61,
0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x07, 0x61, 0x6e, 0x69, 0x6d,
0x61, 0x6c, 0x73, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x88, 0x01,
0x01, 0x12, 0x20, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x18, 0x04,
0x20, 0x01, 0x28, 0x08, 0x48, 0x03, 0x52, 0x08, 0x69, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, 0x72,
0x88, 0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73,
0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x04, 0x52, 0x0b, 0x6c, 0x75, 0x67,
0x67, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x6e, 0x69, 0x6d,
0x61, 0x6c, 0x73, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x42, 0x0c, 0x0a,
0x0a, 0x5f, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x42, 0x0f, 0x0a, 0x0d, 0x5f,
0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x8b, 0x01, 0x0a,
0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x48, 0x00, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x01, 0x52, 0x06, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72,
0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x08, 0x63, 0x75,
0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0b, 0x0a,
0x09, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xcf, 0x02, 0x0a, 0x04, 0x55,
0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x22, 0x0a, 0x0a, 0x66, 0x69, 0x72,
0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a,
0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x48, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12,
0x19, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x02,
0x52, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x70, 0x69,
0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x07, 0x70,
0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x67, 0x65, 0x6e,
0x64, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x06, 0x67, 0x65, 0x6e,
0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69,
0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28,
0x08, 0x48, 0x05, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x49, 0x64, 0x65,
0x6e, 0x74, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x66, 0x69, 0x72,
0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6c, 0x61, 0x73, 0x74,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x67, 0x72, 0x61, 0x64, 0x65, 0x42,
0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f,
0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66,
0x69, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2a, 0x4a, 0x0a, 0x09,
0x44, 0x61, 0x79, 0x4f, 0x66, 0x57, 0x65, 0x65, 0x6b, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x4f, 0x4e,
0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x55, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x57,
0x45, 0x44, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x48, 0x55, 0x10, 0x04, 0x12, 0x07, 0x0a,
0x03, 0x46, 0x52, 0x49, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x41, 0x54, 0x10, 0x06, 0x12,
0x07, 0x0a, 0x03, 0x53, 0x55, 0x4e, 0x10, 0x07, 0x2a, 0x2e, 0x0a, 0x09, 0x50, 0x72, 0x69, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x52, 0x45, 0x45, 0x10, 0x00, 0x12,
0x0a, 0x0a, 0x06, 0x50, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55,
0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0xb2, 0x01, 0x0a, 0x0d, 0x42, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e,
0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x57, 0x41, 0x49,
0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x46,
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 (
@ -1478,20 +1525,24 @@ var file_solidarity_api_types_proto_depIdxs = []int32{
17, // 12: PunctualAvailabilitySlot.date:type_name -> google.protobuf.Timestamp
0, // 13: RegularAvailabilitySlot.dayOfWeek:type_name -> DayOfWeek
2, // 14: BookingRequest.status:type_name -> BookingStatus
16, // 15: Booking.driver:type_name -> User
16, // 16: Booking.passenger:type_name -> User
17, // 17: Booking.passengerPickupDate:type_name -> google.protobuf.Timestamp
4, // 18: Booking.passenger_departure_route:type_name -> Feature
4, // 19: Booking.passenger_destination_route:type_name -> Feature
2, // 20: Booking.status:type_name -> BookingStatus
15, // 21: Booking.price:type_name -> Price
13, // 22: Booking.car:type_name -> Car
1, // 23: Price.type:type_name -> PriceType
24, // [24:24] is the sub-list for method output_type
24, // [24:24] is the sub-list for method input_type
24, // [24:24] is the sub-list for extension type_name
24, // [24:24] is the sub-list for extension extendee
0, // [0:24] is the sub-list for field type_name
4, // 15: BookingRequest.departure_address:type_name -> Feature
4, // 16: BookingRequest.destination_address:type_name -> Feature
17, // 17: BookingRequest.pickup_date:type_name -> google.protobuf.Timestamp
16, // 18: Booking.driver:type_name -> User
16, // 19: Booking.passenger:type_name -> User
17, // 20: Booking.passengerPickupDate:type_name -> google.protobuf.Timestamp
4, // 21: Booking.passenger_departure_route:type_name -> Feature
4, // 22: Booking.passenger_destination_route:type_name -> Feature
2, // 23: Booking.status:type_name -> BookingStatus
15, // 24: Booking.price:type_name -> Price
13, // 25: Booking.car:type_name -> Car
17, // 26: Booking.pickup_date:type_name -> google.protobuf.Timestamp
1, // 27: Price.type:type_name -> PriceType
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() }

View File

@ -63,6 +63,9 @@ message BookingRequest {
string passengerId = 2;
string driverId = 3;
BookingStatus status = 4;
Feature departure_address =5;
Feature destination_address = 6;
google.protobuf.Timestamp pickup_date = 7;
}
message Booking {
@ -77,6 +80,7 @@ message Booking {
optional int64 distance = 9;
Price price = 10;
optional Car car = 11;
google.protobuf.Timestamp pickup_date = 12;
}

View File

@ -26,11 +26,8 @@ type PassengerTripRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PassengerDepartureAddress *Feature `protobuf:"bytes,1,opt,name=passenger_departure_address,json=passengerDepartureAddress,proto3" json:"passenger_departure_address,omitempty"`
PassengerDestinationAddress *Feature `protobuf:"bytes,2,opt,name=passenger_destination_address,json=passengerDestinationAddress,proto3" json:"passenger_destination_address,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"`
Passenger *User `protobuf:"bytes,1,opt,name=passenger,proto3" json:"passenger,omitempty"`
Preferences *Preferences `protobuf:"bytes,2,opt,name=preferences,proto3,oneof" json:"preferences,omitempty"`
}
func (x *PassengerTripRequest) Reset() {
@ -65,27 +62,6 @@ func (*PassengerTripRequest) Descriptor() ([]byte, []int) {
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 {
if x != nil {
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,
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,
0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x02, 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,
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74,
0x75, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73,
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x41,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4c, 0x0a, 0x1d, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e,
0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e,
0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x1b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64,
0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x15, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
0x72, 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 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,
0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70,
0x44, 0x61, 0x74, 0x65, 0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09,
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x0b, 0x70, 0x72, 0x65,
0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c,
0x2e, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0b,
0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0e,
0x0a, 0x0c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, 0xa3,
0x01, 0x0a, 0x1b, 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, 0x35,
0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52,
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,
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, 0x23, 0x0a, 0x09,
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
0x72, 0x12, 0x33, 0x0a, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65,
0x6e, 0x63, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
0x63, 0x65, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x65,
0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, 0xa3, 0x01, 0x0a, 0x1b, 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, 0x35, 0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72,
0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 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, 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, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41,
0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x35, 0x0a,
0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 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, 0x19, 0x2e, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76,
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,
0x74, 0x69, 0x65, 0x73, 0x22, 0xa5, 0x01, 0x0a, 0x1c, 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, 0x35, 0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f,
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x64,
0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 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, 0x19, 0x2e, 0x50, 0x75,
0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76, 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, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5c, 0x0a, 0x15,
0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12,
0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a,
0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x63, 0x0a, 0x1c, 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, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63,
0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22,
0x41, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x22, 0x3b, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 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,
0x88, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x18, 0x02, 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, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a,
0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5c, 0x0a, 0x15, 0x55, 0x70,
0x74, 0x69, 0x65, 0x73, 0x22, 0x5c, 0x0a, 0x15, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65,
0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x22, 0x63, 0x0a, 0x1c, 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, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x41, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x29, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0f, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x3b, 0x0a, 0x15, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 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, 0x88, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12,
0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 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, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x22, 0x5c, 0x0a, 0x15, 0x55, 0x70, 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, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x22, 0x32, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
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,
0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a,
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,
0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08,
0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x32, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42,
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a,
0x0a, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x12,
0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 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, 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,
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 (
@ -1033,60 +994,57 @@ var file_solidarity_api_proto_goTypes = []interface{}{
(*DriverJourneysRequest)(nil), // 12: DriverJourneysRequest
(*DriverJourneysResponse)(nil), // 13: DriverJourneysResponse
(*GetBookingsByStatusResponse)(nil), // 14: GetBookingsByStatusResponse
(*Feature)(nil), // 15: Feature
(*timestamp.Timestamp)(nil), // 16: google.protobuf.Timestamp
(*User)(nil), // 17: User
(*Preferences)(nil), // 18: Preferences
(*DriverRequest)(nil), // 19: DriverRequest
(*RegularAvailabilitySlot)(nil), // 20: RegularAvailabilitySlot
(*PunctualAvailabilitySlot)(nil), // 21: PunctualAvailabilitySlot
(*BookingRequest)(nil), // 22: BookingRequest
(*Booking)(nil), // 23: Booking
(BookingStatus)(0), // 24: BookingStatus
(UserType)(0), // 25: UserType
(*User)(nil), // 15: User
(*Preferences)(nil), // 16: Preferences
(*DriverRequest)(nil), // 17: DriverRequest
(*RegularAvailabilitySlot)(nil), // 18: RegularAvailabilitySlot
(*PunctualAvailabilitySlot)(nil), // 19: PunctualAvailabilitySlot
(*BookingRequest)(nil), // 20: BookingRequest
(*Booking)(nil), // 21: Booking
(BookingStatus)(0), // 22: BookingStatus
(UserType)(0), // 23: UserType
(*Feature)(nil), // 24: Feature
(*timestamp.Timestamp)(nil), // 25: google.protobuf.Timestamp
(*DriverJourney)(nil), // 26: DriverJourney
}
var file_solidarity_api_proto_depIdxs = []int32{
15, // 0: PassengerTripRequest.passenger_departure_address:type_name -> Feature
15, // 1: PassengerTripRequest.passenger_destination_address:type_name -> Feature
16, // 2: PassengerTripRequest.passenger_pickup_date:type_name -> google.protobuf.Timestamp
17, // 3: PassengerTripRequest.passenger:type_name -> User
18, // 4: PassengerTripRequest.preferences:type_name -> Preferences
19, // 5: DriverRegularAvailabilities.driver_request:type_name -> DriverRequest
20, // 6: DriverRegularAvailabilities.driver_availabilities:type_name -> RegularAvailabilitySlot
19, // 7: DriverPunctualAvailabilities.driver_request:type_name -> DriverRequest
21, // 8: DriverPunctualAvailabilities.driver_availabilities:type_name -> PunctualAvailabilitySlot
22, // 9: CreateBookingRequest.booking:type_name -> BookingRequest
23, // 10: CreateBookingResponse.booking:type_name -> Booking
24, // 11: UpdateBookingRequest.status:type_name -> BookingStatus
23, // 12: GetBookingResponse.booking:type_name -> Booking
24, // 13: GetBookingsByStatusRequest.status:type_name -> BookingStatus
25, // 14: GetBookingsByStatusRequest.type:type_name -> UserType
15, // 15: DriverJourneysRequest.departure:type_name -> Feature
16, // 16: DriverJourneysRequest.departure_date:type_name -> google.protobuf.Timestamp
26, // 17: DriverJourneysResponse.driver_journeys:type_name -> DriverJourney
23, // 18: GetBookingsByStatusResponse.booking:type_name -> Booking
1, // 19: SolidarityService.SetDriverRegularAvailabilities:input_type -> DriverRegularAvailabilities
2, // 20: SolidarityService.SetDriverPunctualAvailabilities:input_type -> DriverPunctualAvailabilities
5, // 21: SolidarityService.CreateBooking:input_type -> CreateBookingRequest
7, // 22: SolidarityService.UpdateBooking:input_type -> UpdateBookingRequest
9, // 23: SolidarityService.GetBooking:input_type -> GetBookingRequest
11, // 24: SolidarityService.GetBookingsByStatus:input_type -> GetBookingsByStatusRequest
12, // 25: SolidarityService.DriverJourneys:input_type -> DriverJourneysRequest
0, // 26: SolidarityService.SetPassengerTrip:input_type -> PassengerTripRequest
4, // 27: SolidarityService.SetDriverRegularAvailabilities:output_type -> DriverAvailabilitiesResponse
4, // 28: SolidarityService.SetDriverPunctualAvailabilities:output_type -> DriverAvailabilitiesResponse
6, // 29: SolidarityService.CreateBooking:output_type -> CreateBookingResponse
8, // 30: SolidarityService.UpdateBooking:output_type -> UpdateBookingResponse
10, // 31: SolidarityService.GetBooking:output_type -> GetBookingResponse
14, // 32: SolidarityService.GetBookingsByStatus:output_type -> GetBookingsByStatusResponse
13, // 33: SolidarityService.DriverJourneys:output_type -> DriverJourneysResponse
3, // 34: SolidarityService.SetPassengerTrip:output_type -> PassengerTripResponse
27, // [27:35] is the sub-list for method output_type
19, // [19:27] is the sub-list for method input_type
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
15, // 0: PassengerTripRequest.passenger:type_name -> User
16, // 1: PassengerTripRequest.preferences:type_name -> Preferences
17, // 2: DriverRegularAvailabilities.driver_request:type_name -> DriverRequest
18, // 3: DriverRegularAvailabilities.driver_availabilities:type_name -> RegularAvailabilitySlot
17, // 4: DriverPunctualAvailabilities.driver_request:type_name -> DriverRequest
19, // 5: DriverPunctualAvailabilities.driver_availabilities:type_name -> PunctualAvailabilitySlot
20, // 6: CreateBookingRequest.booking:type_name -> BookingRequest
21, // 7: CreateBookingResponse.booking:type_name -> Booking
22, // 8: UpdateBookingRequest.status:type_name -> BookingStatus
21, // 9: GetBookingResponse.booking:type_name -> Booking
22, // 10: GetBookingsByStatusRequest.status:type_name -> BookingStatus
23, // 11: GetBookingsByStatusRequest.type:type_name -> UserType
24, // 12: DriverJourneysRequest.departure:type_name -> Feature
25, // 13: DriverJourneysRequest.departure_date:type_name -> google.protobuf.Timestamp
26, // 14: DriverJourneysResponse.driver_journeys:type_name -> DriverJourney
21, // 15: GetBookingsByStatusResponse.booking:type_name -> Booking
1, // 16: SolidarityService.SetDriverRegularAvailabilities:input_type -> DriverRegularAvailabilities
2, // 17: SolidarityService.SetDriverPunctualAvailabilities:input_type -> DriverPunctualAvailabilities
5, // 18: SolidarityService.CreateBooking:input_type -> CreateBookingRequest
7, // 19: SolidarityService.UpdateBooking:input_type -> UpdateBookingRequest
9, // 20: SolidarityService.GetBooking:input_type -> GetBookingRequest
11, // 21: SolidarityService.GetBookingsByStatus:input_type -> GetBookingsByStatusRequest
12, // 22: SolidarityService.DriverJourneys:input_type -> DriverJourneysRequest
0, // 23: SolidarityService.SetPassengerTrip:input_type -> PassengerTripRequest
4, // 24: SolidarityService.SetDriverRegularAvailabilities:output_type -> DriverAvailabilitiesResponse
4, // 25: SolidarityService.SetDriverPunctualAvailabilities:output_type -> DriverAvailabilitiesResponse
6, // 26: SolidarityService.CreateBooking:output_type -> CreateBookingResponse
8, // 27: SolidarityService.UpdateBooking:output_type -> UpdateBookingResponse
10, // 28: SolidarityService.GetBooking:output_type -> GetBookingResponse
14, // 29: SolidarityService.GetBookingsByStatus:output_type -> GetBookingsByStatusResponse
13, // 30: SolidarityService.DriverJourneys:output_type -> DriverJourneysResponse
3, // 31: SolidarityService.SetPassengerTrip:output_type -> PassengerTripResponse
24, // [24:32] is the sub-list for method output_type
16, // [16:24] is the sub-list for method input_type
16, // [16:16] is the sub-list for extension type_name
16, // [16:16] is the sub-list for extension extendee
0, // [0:16] is the sub-list for field type_name
}
func init() { file_solidarity_api_proto_init() }

View File

@ -16,11 +16,9 @@ service SolidarityService {
message PassengerTripRequest{
Feature passenger_departure_address = 1;
Feature passenger_destination_address = 2;
google.protobuf.Timestamp passenger_pickup_date = 3;
User passenger = 4;
optional Preferences preferences = 5;
User passenger = 1;
optional Preferences preferences = 2;
}
message DriverRegularAvailabilities{

View File

@ -23,7 +23,7 @@ func NewSolidarityServiceServer(handler *handler.SolidarityServiceHandler) *Soli
func Run(done chan error, cfg *viper.Viper, handler *handler.SolidarityServiceHandler) {
var (
address = ":" + cfg.GetString("services.grpc.port")
address = cfg.GetString("services.grpc.ip") + ":" + cfg.GetString("services.grpc.port")
)
server := grpc.NewServer()

View File

@ -6,10 +6,12 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/paulmach/orb"
"github.com/paulmach/orb/geojson"
"github.com/rs/zerolog/log"
"solidarity-service/internal"
"solidarity-service/servers/grpc/proto"
"solidarity-service/utils"
"strings"
"sync"
)
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)
if err != nil {
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
err = errors.New("ID is already used")
}
return &proto.DriverAvailabilitiesResponse{
Success: false,
}, err
@ -156,9 +155,6 @@ func (s *SolidarityServiceServerImpl) SetDriverPunctualAvailabilities(ctx contex
err = s.Handler.SetDriverAvailabilities(context.Background(), driver)
if err != nil {
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
err = errors.New("ID is already used")
}
return &proto.DriverAvailabilitiesResponse{
Success: false,
}, 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) {
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")
}
bookingRequest := internal.BookingRequest{
@ -177,6 +173,21 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
Passenger_id: req.Booking.PassengerId,
Driver_id: req.Booking.DriverId,
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)
if err != nil {
@ -185,11 +196,11 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
}
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 {
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
resp = &proto.CreateBookingResponse{
Booking: &proto.Booking{},
@ -217,17 +228,17 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
VerifiedIdentity: &passenger.Passenger.VerifiedIdentity,
},
PassengerPickupDate: &timestamp.Timestamp{
Seconds: passenger.Passenger_pickup_date,
Seconds: bookingRequest.Pickup_date,
},
PassengerDepartureRoute: &proto.Feature{
Lat: passenger.Passenger_departure_address.Point().Lat(),
Long: passenger.Passenger_departure_address.Point().Lon(),
Address: passenger.Passenger_departure_address.Properties.MustString("name"),
Lat: bookingRequest.Departure_address.Point().Lat(),
Long: bookingRequest.Departure_address.Point().Lon(),
Address: bookingRequest.Departure_address.Properties.MustString("name"),
},
PassengerDestinationRoute: &proto.Feature{
Lat: passenger.Passenger_destination_address.Point().Lat(),
Long: passenger.Passenger_destination_address.Point().Lon(),
Address: passenger.Passenger_destination_address.Properties.MustString("name"),
Lat: bookingRequest.Destination_address.Point().Lat(),
Long: bookingRequest.Destination_address.Point().Lon(),
Address: bookingRequest.Destination_address.Properties.MustString("name"),
},
Status: ConvertInternalToProtoBookingStatus(bookingRequest.Status),
Duration: &duration,
@ -268,155 +279,211 @@ func (s *SolidarityServiceServerImpl) GetBooking(ctx context.Context, req *proto
if req.BookingId == "" {
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 strings.Contains(err.Error(), utils.SQL_NO_ROWS) {
err = errors.New("invalid ID")
}
return nil, err
}
duration, err := s.Handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
if err != nil {
duration = 0
}
resp = &proto.GetBookingResponse{
Booking: &proto.Booking{},
}
distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
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{
Id: booking.ID,
Driver: &proto.User{
Id: driver.Driver.ID,
Alias: driver.Driver.Alias,
FirstName: &driver.Driver.FirstName,
LastName: &driver.Driver.LastName,
Grade: &driver.Driver.Grade,
Picture: &driver.Driver.Picture,
Gender: &driver.Driver.Gender,
VerifiedIdentity: &driver.Driver.VerifiedIdentity,
Id: booking.Driver.ID,
Alias: booking.Driver.Alias,
FirstName: &booking.Driver.FirstName,
LastName: &booking.Driver.LastName,
Grade: &booking.Driver.Grade,
Picture: &booking.Driver.Picture,
Gender: &booking.Driver.Gender,
VerifiedIdentity: &booking.Driver.VerifiedIdentity,
},
Passenger: &proto.User{
Id: passenger.Passenger.ID,
Alias: passenger.Passenger.Alias,
FirstName: &passenger.Passenger.FirstName,
LastName: &passenger.Passenger.LastName,
Grade: &passenger.Passenger.Grade,
Picture: &passenger.Passenger.Picture,
Gender: &passenger.Passenger.Gender,
VerifiedIdentity: &passenger.Passenger.VerifiedIdentity,
Id: booking.Passenger.ID,
Alias: booking.Passenger.Alias,
FirstName: &booking.Passenger.FirstName,
LastName: &booking.Passenger.LastName,
Grade: &booking.Passenger.Grade,
Picture: &booking.Passenger.Picture,
Gender: &booking.Passenger.Gender,
VerifiedIdentity: &booking.Passenger.VerifiedIdentity,
},
PassengerPickupDate: &timestamp.Timestamp{
Seconds: passenger.Passenger_pickup_date,
Seconds: booking.Pickup_date,
},
PassengerDepartureRoute: &proto.Feature{
Lat: passenger.Passenger_departure_address.Point().Lat(),
Long: passenger.Passenger_departure_address.Point().Lon(),
Address: passenger.Passenger_departure_address.Properties.MustString("name"),
Lat: booking.PassengerPickupAddress.Point().Lat(),
Long: booking.PassengerPickupAddress.Point().Lon(),
Address: booking.PassengerPickupAddress.Properties.MustString("name"),
},
PassengerDestinationRoute: &proto.Feature{
Lat: passenger.Passenger_destination_address.Point().Lat(),
Long: passenger.Passenger_destination_address.Point().Lon(),
Address: passenger.Passenger_destination_address.Properties.MustString("name"),
Lat: booking.PassengerDropAddress.Point().Lat(),
Long: booking.PassengerDropAddress.Point().Lon(),
Address: booking.PassengerDropAddress.Properties.MustString("name"),
},
Status: ConvertInternalToProtoBookingStatus(booking.Status),
Duration: &duration,
Duration: &booking.Duration,
Distance: &distance,
Car: &proto.Car{
Model: &car.Model,
Brand: &car.Brand,
},
Price: &proto.Price{
Type: &priceType,
},
Car: &proto.Car{
Model: &driver.Car.Model,
Brand: &driver.Car.Brand,
},
}
return resp, nil
}
func (s *SolidarityServiceServerImpl) GetBookingsByStatus(ctx context.Context, req *proto.GetBookingsByStatusRequest) (resp *proto.GetBookingsByStatusResponse, err error) {
if req.Type.String() == "" || req.Status.String() == "" || req.UserId == "" {
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 strings.Contains(err.Error(), utils.SQL_NO_ROWS) {
err = errors.New("invalid ID")
return nil, errors.New("invalid ID")
}
return nil, err
}
// 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: []*proto.Booking{},
Booking: convertedBookings,
}
responses := []*proto.Booking{}
return resp, nil
case <-ctx.Done():
// If the context is canceled, return an error
return nil, ctx.Err()
}
}
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 {
passenger, err := s.Handler.GetPassenger(context.Background(), v.Passenger.ID)
if err != nil {
return nil, err
}
driver, err := s.Handler.GetDriver(context.Background(), v.Driver.ID)
if err != nil {
return nil, err
}
duration, err := s.Handler.CalculateDurationBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
if err != nil {
duration = 0
wg.Add(1)
semaphore <- struct{}{}
go func(booking internal.Booking) {
defer func() {
<-semaphore
wg.Done()
}()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var driver internal.Driver
var driverErr error
driverCh := make(chan struct {
Driver internal.Driver
Err error
})
go func() {
d, err := s.Handler.GetDriver(ctx, booking.Driver.ID)
driverCh <- struct {
Driver internal.Driver
Err error
}{Driver: d, Err: err}
}()
driverRes := <-driverCh
driver = driverRes.Driver
driverErr = driverRes.Err
if driverErr != nil {
log.Error().Err(driverErr).Msg("Error getting driver")
return
}
car := driver.Car
priceType := proto.PriceType_FREE
distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
responses = append(responses, &proto.Booking{
Id: v.ID,
Status: ConvertInternalToProtoBookingStatus(v.Status),
Driver: &proto.User{
Id: v.Driver.ID,
Alias: driver.Driver.Alias,
FirstName: &driver.Driver.FirstName,
LastName: &driver.Driver.LastName,
Grade: &driver.Driver.Grade,
Picture: &driver.Driver.Picture,
Gender: &driver.Driver.Gender,
VerifiedIdentity: &driver.Driver.VerifiedIdentity,
},
Passenger: &proto.User{
Id: v.Passenger.ID,
Alias: passenger.Passenger.Alias,
FirstName: &passenger.Passenger.FirstName,
LastName: &passenger.Passenger.LastName,
Grade: &passenger.Passenger.Grade,
Picture: &passenger.Passenger.Picture,
Gender: &passenger.Passenger.Gender,
VerifiedIdentity: &passenger.Passenger.VerifiedIdentity,
},
distance := int64(booking.Distance)
protoBooking := &proto.Booking{
Id: booking.ID,
Status: ConvertInternalToProtoBookingStatus(booking.Status),
Driver: convertInternalUserToProtoUser(driver.Driver),
Passenger: convertInternalUserToProtoUser(booking.Passenger),
PassengerPickupDate: &timestamp.Timestamp{
Seconds: passenger.Passenger_pickup_date,
Seconds: booking.Pickup_date,
},
PassengerDepartureRoute: &proto.Feature{
Lat: passenger.Passenger_departure_address.Point().Lat(),
Long: passenger.Passenger_departure_address.Point().Lon(),
Address: passenger.Passenger_departure_address.Properties.MustString("name"),
},
PassengerDestinationRoute: &proto.Feature{
Lat: passenger.Passenger_destination_address.Point().Lat(),
Long: passenger.Passenger_destination_address.Point().Lon(),
Address: passenger.Passenger_destination_address.Properties.MustString("name"),
},
Duration: &duration,
PassengerDepartureRoute: convertInternalFeatureToProtoFeature(booking.PassengerPickupAddress),
PassengerDestinationRoute: convertInternalFeatureToProtoFeature(booking.PassengerDropAddress),
Duration: &booking.Duration,
Distance: &distance,
Car: &proto.Car{
Model: &driver.Car.Model,
Brand: &driver.Car.Brand,
Model: &car.Model,
Brand: &car.Brand,
},
Price: &proto.Price{
Type: &priceType,
},
})
}
resp.Booking = responses
return resp, nil
// 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"),
}
}
func (s *SolidarityServiceServerImpl) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (resp *proto.DriverJourneysResponse, err error) {
if req.DepartureDate.Seconds == 0 || req.Departure == nil {
return nil, errors.New("missing required fields")
}
@ -507,33 +574,14 @@ func (s *SolidarityServiceServerImpl) DriverJourneys(ctx context.Context, req *p
return resp, nil
}
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{
Success: false,
}, errors.New("missing required fields")
}
passenger := internal.Passenger{
Passenger_departure_address: &geojson.Feature{
Type: "Feature",
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,
},
}
passenger := internal.Passenger{}
passenger.Passenger.ID = req.Passenger.Id
passenger.Passenger.Alias = req.Passenger.Alias
if req.Passenger.FirstName != nil {
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)
if err != nil {
if strings.Contains(err.Error(), utils.SQL_DUPLICATE) {
err = errors.New("ID is already used")
}
return &proto.PassengerTripResponse{
Success: false,
}, err

View File

@ -15,6 +15,7 @@ import (
"solidarity-service/utils"
"strconv"
"strings"
"sync"
"time"
)
@ -66,11 +67,7 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er
log.Error().Err(err).Msg("Postgresql Storage CreatePassenger invalid ID")
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 == "" {
errMsg := "Postgresql Storage CreatePassenger empty alias or operator FQDN."
log.Error().Msg(errMsg)
@ -82,23 +79,8 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er
log.Error().Err(err).Msg(errMsg)
return errors.New(errMsg + err.Error())
}
departureJSON, err := json.Marshal(passenger.Passenger_departure_address)
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"]),
_, 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"]),
passenger.Passenger.ID,
departureJSON,
destinationJSON,
passenger.Passenger.Alias,
passenger.Passenger.LastName,
passenger.Passenger.FirstName,
@ -106,24 +88,72 @@ func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err er
passenger.Passenger.Picture,
passenger.Passenger.VerifiedIdentity,
passenger.Passenger.Operator,
preferencesJSON,
passenger.Passenger_pickup_date)
preferencesJSON)
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"
log.Error().Err(err).Msg(errMsg)
return errors.New(errMsg + err.Error())
}
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) {
var preferencesJSON []byte
var departure_address []byte
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).
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).
Scan(
&departure_address,
&destination_address,
&passenger.Passenger.Alias,
&passenger.Passenger.LastName,
&passenger.Passenger.FirstName,
@ -132,11 +162,9 @@ func (s PostgresqlStorage) GetPassenger(passengerID string) (passenger internal.
&passenger.Passenger.VerifiedIdentity,
&passenger.Passenger.Operator,
&preferencesJSON,
&passenger.Passenger_pickup_date,
&passenger.Passenger.ID,
)
if err != nil {
fmt.Println(err)
errMsg := "Postgresql Storage GetPassenger Error querying data from the database"
log.Error().Err(err).Msg(errMsg)
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)
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
}
@ -236,13 +252,116 @@ func (s PostgresqlStorage) CreateDriver(driver internal.Driver) (err error) {
carJSON,
)
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"
log.Error().Err(err).Msg(errMsg)
return errors.New(errMsg + err.Error())
}
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) {
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")
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.Passenger_id,
booking.Driver_id,
booking.Operator,
booking.Status,
departureJSON,
destinationJSON,
booking.Pickup_date,
booking.Duration,
booking.Distance,
)
if err != nil {
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) {
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(
&booking.ID,
&booking.Passenger.ID,
&booking.Driver.ID,
&booking.Status,
&departureAddress,
&destinationAddress,
&booking.Pickup_date,
&booking.Duration,
&booking.Distance,
)
if err != nil {
errMsg := "Postgresql Storage GetBooking Error getting booking"
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)
if err != nil {
@ -371,8 +535,6 @@ func (s PostgresqlStorage) GetBooking(id string) (booking internal.Booking, err
return booking, errors.New(errMsg + err.Error())
}
booking.Passenger = passenger.Passenger
booking.PassengerPickupAddress = passenger.Passenger_departure_address
booking.PassengerDropAddress = passenger.Passenger_destination_address
driver, err := s.GetDriver(booking.Driver.ID)
if err != nil {
errMsg := "Postgresql Storage GetBooking Error getting driver"
@ -404,55 +566,147 @@ func (s PostgresqlStorage) UpdateBookingStatus(id string, status internal.Bookin
return nil
}
func (s PostgresqlStorage) FilterUserBookingsByStatus(user_type string, status internal.BookingStatus, user_id string) (bookings []internal.Booking, err error) {
_, err = uuid.Parse(user_id)
func (s PostgresqlStorage) FilterUserBookingsByStatus(userType string, status internal.BookingStatus, userID string) (bookings []internal.Booking, err error) {
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")
}
switch user_type {
case "driver":
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)
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(queryTemplate, userID, status)
if err != nil {
return nil, err
}
defer rows.Close()
var wg sync.WaitGroup
var mu sync.Mutex
for rows.Next() {
var departureAddress []byte
var destinationAddress []byte
var booking internal.Booking
if err := rows.Scan(&booking.ID, &booking.Passenger.ID, &booking.Driver.ID, &booking.Status); err != nil {
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 {
return nil, err
}
bookings = append(bookings, booking)
}
if err := rows.Err(); err != nil {
return nil, err
}
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)
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 {
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
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
}
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) {
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 {
@ -496,34 +750,76 @@ func (s PostgresqlStorage) GetAllDrivers(date int64) (drivers []internal.Driver,
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 err := json.Unmarshal(availabilitiesJSON, &driver.PunctualAvailabilities); err != nil {
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"))
year, month, day := time.Unix(date, 0).Date()
dateHour := time.Unix(date, 0).UTC().Local()
dateHour_string := dateHour.Format("3:04 PM")
for _, avail := range driver.PunctualAvailabilities {
// Extract the day part of the punctual driver's date and compare.
availDate := time.Unix(avail.Date, 0)
if strings.ToLower(availDate.Format("Mon")) == dayOfWeek {
drivers = append(drivers, driver)
break
availyear, availmonth, availday := time.Unix(avail.Date, 0).Date()
if availyear == year && availmonth == month && availday == day {
startTime, err := time.Parse("3:04 PM", avail.StartTime)
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)
}
}
}
// Check if the date and time match the punctual driver's availability.
}
} else if driver.AvailabilitiesType == internal.Regular {
if err := json.Unmarshal(availabilitiesJSON, &driver.RegularAvailabilities); err != nil {
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"))
fmt.Println(dayOfWeek)
dayOfWeek := strings.ToLower(time.Unix(date, 0).Local().Format("Mon"))
dateHour := time.Unix(date, 0).UTC().Local()
dateHour_string := dateHour.Format("3:04 PM")
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 {
startTime, err := time.Parse("3:04 PM", avail.StartTime)
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)
break
}
}
}
}
}

View File

@ -5,14 +5,6 @@ table "passengers" {
null = false
type = uuid
}
column "passenger_departure_route" {
null = false
type = jsonb
}
column "passenger_destination_route" {
null = false
type = jsonb
}
column "alias" {
null = false
type = varchar(15)
@ -45,10 +37,6 @@ table "passengers" {
null = true
type = jsonb
}
column "passenger_pickup_date" {
null = false
type = int
}
primary_key {
columns = [column.passenger_id]
}
@ -139,7 +127,27 @@ table "bookings" {
}
column "booking_status" {
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 {
columns = [column.booking_id]
@ -153,8 +161,6 @@ table "bookings" {
ref_columns = [table.passengers.column.passenger_id]
}
}
enum "booking_status" {
schema = schema.solidarity_service
values = ["INITIATED", "WAITING_PASSENGER_CONFIRMATION", "WAITING_DRIVER_CONFIRMATION", "CONFIRMED", "CANCELLED", "COMPLETED_PENDING_VALIDATION", "VALIDATED"]

View File

@ -1,9 +1,17 @@
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 {
// Radius of the Earth in kilometers
R := 6371.0
lat1 = lat1 * math.Pi / 180
@ -20,3 +28,51 @@ func Haversine(lat1, lon1, lat2, lon2 float64) float64 {
distance := R * c
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)
}