Add motivation field to organized carpool bookings
Build and Push Docker Image / build_and_push (push) Failing after 3m0s
Details
Build and Push Docker Image / build_and_push (push) Failing after 3m0s
Details
This commit is contained in:
parent
b431d460bf
commit
38cb3c5ad9
Binary file not shown.
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Book handles the booking flow
|
// Book handles the booking flow
|
||||||
func (h *CarpoolServiceHandler) Book(booking ocss.Booking) (*internal.Booking, error) {
|
func (h *CarpoolServiceHandler) Book(booking ocss.Booking, motivation *string) (*internal.Booking, error) {
|
||||||
log.Debug().Any("booking", booking).Msg("handler - Book")
|
log.Debug().Any("booking", booking).Msg("handler - Book")
|
||||||
log.Debug().Str("passengerPickupDate", booking.PassengerPickupDate.ToTime().Format(time.RFC3339)).Msg("handler - Book")
|
log.Debug().Str("passengerPickupDate", booking.PassengerPickupDate.ToTime().Format(time.RFC3339)).Msg("handler - Book")
|
||||||
log.Debug().Str("internal_operator_id", h.InternalOperatorID).Str("driver_operator", booking.Driver.Operator).Str("passenger_operator", booking.Passenger.Operator).Msg("operator comparison")
|
log.Debug().Str("internal_operator_id", h.InternalOperatorID).Str("driver_operator", booking.Driver.Operator).Str("passenger_operator", booking.Passenger.Operator).Msg("operator comparison")
|
||||||
|
@ -62,6 +62,7 @@ func (h *CarpoolServiceHandler) Book(booking ocss.Booking) (*internal.Booking, e
|
||||||
}
|
}
|
||||||
|
|
||||||
futureBooking.Booking = booking
|
futureBooking.Booking = booking
|
||||||
|
futureBooking.Motivation = motivation
|
||||||
|
|
||||||
err := h.Storage.CreateBooking(futureBooking)
|
err := h.Storage.CreateBooking(futureBooking)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -11,4 +11,5 @@ type Booking struct {
|
||||||
|
|
||||||
DriverRoute *geojson.FeatureCollection `bson:"driver_route,omitempty"`
|
DriverRoute *geojson.FeatureCollection `bson:"driver_route,omitempty"`
|
||||||
PassengerRoute *geojson.FeatureCollection `bson:"passenger_route,omitempty"`
|
PassengerRoute *geojson.FeatureCollection `bson:"passenger_route,omitempty"`
|
||||||
|
Motivation *string `bson:"motivation,omitempty" json:"motivation,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1278,6 +1278,7 @@ type CarpoolServiceBooking struct {
|
||||||
DriverDepartureDate *timestamppb.Timestamp `protobuf:"bytes,32,opt,name=driverDepartureDate,proto3,oneof" json:"driverDepartureDate,omitempty"`
|
DriverDepartureDate *timestamppb.Timestamp `protobuf:"bytes,32,opt,name=driverDepartureDate,proto3,oneof" json:"driverDepartureDate,omitempty"`
|
||||||
DriverCompensationAmount *float64 `protobuf:"fixed64,33,opt,name=driver_compensation_amount,json=driverCompensationAmount,proto3,oneof" json:"driver_compensation_amount,omitempty"`
|
DriverCompensationAmount *float64 `protobuf:"fixed64,33,opt,name=driver_compensation_amount,json=driverCompensationAmount,proto3,oneof" json:"driver_compensation_amount,omitempty"`
|
||||||
DriverCompensationCurrency *string `protobuf:"bytes,34,opt,name=driver_compensation_currency,json=driverCompensationCurrency,proto3,oneof" json:"driver_compensation_currency,omitempty"`
|
DriverCompensationCurrency *string `protobuf:"bytes,34,opt,name=driver_compensation_currency,json=driverCompensationCurrency,proto3,oneof" json:"driver_compensation_currency,omitempty"`
|
||||||
|
Motivation *string `protobuf:"bytes,35,opt,name=motivation,proto3,oneof" json:"motivation,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
@ -1473,6 +1474,13 @@ func (x *CarpoolServiceBooking) GetDriverCompensationCurrency() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *CarpoolServiceBooking) GetMotivation() string {
|
||||||
|
if x != nil && x.Motivation != nil {
|
||||||
|
return *x.Motivation
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type CarpoolServicePreferences struct {
|
type CarpoolServicePreferences struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Smoking *bool `protobuf:"varint,1,opt,name=smoking,proto3,oneof" json:"smoking,omitempty"`
|
Smoking *bool `protobuf:"varint,1,opt,name=smoking,proto3,oneof" json:"smoking,omitempty"`
|
||||||
|
@ -2107,7 +2115,7 @@ const file_carpool_service_types_proto_rawDesc = "" +
|
||||||
"\x11_journey_polylineB\n" +
|
"\x11_journey_polylineB\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\b_web_urlB\x0e\n" +
|
"\b_web_urlB\x0e\n" +
|
||||||
"\f_preferences\"\xa8\v\n" +
|
"\f_preferences\"\xdc\v\n" +
|
||||||
"\x15CarpoolServiceBooking\x12\x0e\n" +
|
"\x15CarpoolServiceBooking\x12\x0e\n" +
|
||||||
"\x02id\x18\x01 \x01(\tR\x02id\x12+\n" +
|
"\x02id\x18\x01 \x01(\tR\x02id\x12+\n" +
|
||||||
"\x06driver\x18\x02 \x01(\v2\x13.CarpoolServiceUserR\x06driver\x121\n" +
|
"\x06driver\x18\x02 \x01(\v2\x13.CarpoolServiceUserR\x06driver\x121\n" +
|
||||||
|
@ -2133,7 +2141,10 @@ const file_carpool_service_types_proto_rawDesc = "" +
|
||||||
"\x13driverDepartureDate\x18 \x01(\v2\x1a.google.protobuf.TimestampH\bR\x13driverDepartureDate\x88\x01\x01\x12A\n" +
|
"\x13driverDepartureDate\x18 \x01(\v2\x1a.google.protobuf.TimestampH\bR\x13driverDepartureDate\x88\x01\x01\x12A\n" +
|
||||||
"\x1adriver_compensation_amount\x18! \x01(\x01H\tR\x18driverCompensationAmount\x88\x01\x01\x12E\n" +
|
"\x1adriver_compensation_amount\x18! \x01(\x01H\tR\x18driverCompensationAmount\x88\x01\x01\x12E\n" +
|
||||||
"\x1cdriver_compensation_currency\x18\" \x01(\tH\n" +
|
"\x1cdriver_compensation_currency\x18\" \x01(\tH\n" +
|
||||||
"R\x1adriverCompensationCurrency\x88\x01\x01B\x1b\n" +
|
"R\x1adriverCompensationCurrency\x88\x01\x01\x12#\n" +
|
||||||
|
"\n" +
|
||||||
|
"motivation\x18# \x01(\tH\vR\n" +
|
||||||
|
"motivation\x88\x01\x01B\x1b\n" +
|
||||||
"\x19_passenger_pickup_addressB\x19\n" +
|
"\x19_passenger_pickup_addressB\x19\n" +
|
||||||
"\x17_passenger_drop_addressB\v\n" +
|
"\x17_passenger_drop_addressB\v\n" +
|
||||||
"\t_distanceB\v\n" +
|
"\t_distanceB\v\n" +
|
||||||
|
@ -2145,7 +2156,8 @@ const file_carpool_service_types_proto_rawDesc = "" +
|
||||||
"\x10_passenger_routeB\x16\n" +
|
"\x10_passenger_routeB\x16\n" +
|
||||||
"\x14_driverDepartureDateB\x1d\n" +
|
"\x14_driverDepartureDateB\x1d\n" +
|
||||||
"\x1b_driver_compensation_amountB\x1f\n" +
|
"\x1b_driver_compensation_amountB\x1f\n" +
|
||||||
"\x1d_driver_compensation_currency\"\xff\x01\n" +
|
"\x1d_driver_compensation_currencyB\r\n" +
|
||||||
|
"\v_motivation\"\xff\x01\n" +
|
||||||
"\x19CarpoolServicePreferences\x12\x1d\n" +
|
"\x19CarpoolServicePreferences\x12\x1d\n" +
|
||||||
"\asmoking\x18\x01 \x01(\bH\x00R\asmoking\x88\x01\x01\x12\x1d\n" +
|
"\asmoking\x18\x01 \x01(\bH\x00R\asmoking\x88\x01\x01\x12\x1d\n" +
|
||||||
"\aanimals\x18\x02 \x01(\bH\x01R\aanimals\x88\x01\x01\x12\x19\n" +
|
"\aanimals\x18\x02 \x01(\bH\x01R\aanimals\x88\x01\x01\x12\x19\n" +
|
||||||
|
|
|
@ -156,6 +156,7 @@ message CarpoolServiceBooking {
|
||||||
optional google.protobuf.Timestamp driverDepartureDate = 32;
|
optional google.protobuf.Timestamp driverDepartureDate = 32;
|
||||||
optional double driver_compensation_amount = 33;
|
optional double driver_compensation_amount = 33;
|
||||||
optional string driver_compensation_currency = 34;
|
optional string driver_compensation_currency = 34;
|
||||||
|
optional string motivation = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CarpoolServicePreferences {
|
message CarpoolServicePreferences {
|
||||||
|
|
|
@ -378,6 +378,8 @@ func BookingFromInternal(b internal.Booking) *CarpoolServiceBooking {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
booking.Motivation = b.Motivation
|
||||||
|
|
||||||
return booking
|
return booking
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) CreateBooking(ctx context.Context, req *proto.CreateCarpoolBookingRequest) (*proto.CreateCarpoolBookingResponse, error) {
|
func (s *CarpoolServiceServerImpl) CreateBooking(ctx context.Context, req *proto.CreateCarpoolBookingRequest) (*proto.CreateCarpoolBookingResponse, error) {
|
||||||
booking := req.Booking.ToOCSS()
|
booking := req.Booking.ToOCSS()
|
||||||
createdBooking, err := s.Handler.Book(booking)
|
createdBooking, err := s.Handler.Book(booking, req.Booking.Motivation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "could not create booking - %s", err.Error())
|
return nil, status.Errorf(codes.Internal, "could not create booking - %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *OCSSApiService) PostBookings(ctx context.Context, booking ocss.Booking) (*ocss.Booking, error) {
|
func (s *OCSSApiService) PostBookings(ctx context.Context, booking ocss.Booking) (*ocss.Booking, error) {
|
||||||
result, err := s.Handler.Book(booking)
|
result, err := s.Handler.Book(booking, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("issue in booking")
|
log.Error().Err(err).Msg("issue in booking")
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue