improvements
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 3m6s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 3m6s
This commit is contained in:
@@ -396,17 +396,19 @@ func (x *SolidarityTransportPrice) GetCurrency() string {
|
||||
}
|
||||
|
||||
type SolidarityTransportBooking struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
|
||||
DriverId string `protobuf:"bytes,3,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"`
|
||||
PassengerId string `protobuf:"bytes,4,opt,name=passenger_id,json=passengerId,proto3" json:"passenger_id,omitempty"`
|
||||
Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"`
|
||||
ReturnWaitingDuration int64 `protobuf:"varint,6,opt,name=return_waiting_duration,json=returnWaitingDuration,proto3" json:"return_waiting_duration,omitempty"`
|
||||
Data *structpb.Struct `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Journey *SolidarityTransportDriverJourney `protobuf:"bytes,10,opt,name=journey,proto3" json:"journey,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
|
||||
DriverId string `protobuf:"bytes,3,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"`
|
||||
PassengerId string `protobuf:"bytes,4,opt,name=passenger_id,json=passengerId,proto3" json:"passenger_id,omitempty"`
|
||||
Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"`
|
||||
ReturnWaitingDuration int64 `protobuf:"varint,6,opt,name=return_waiting_duration,json=returnWaitingDuration,proto3" json:"return_waiting_duration,omitempty"`
|
||||
Data *structpb.Struct `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
|
||||
DriverCompensationAmount float64 `protobuf:"fixed64,8,opt,name=driver_compensation_amount,json=driverCompensationAmount,proto3" json:"driver_compensation_amount,omitempty"`
|
||||
DriverCompensationCurrency string `protobuf:"bytes,9,opt,name=driver_compensation_currency,json=driverCompensationCurrency,proto3" json:"driver_compensation_currency,omitempty"`
|
||||
Journey *SolidarityTransportDriverJourney `protobuf:"bytes,10,opt,name=journey,proto3" json:"journey,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SolidarityTransportBooking) Reset() {
|
||||
@@ -488,6 +490,20 @@ func (x *SolidarityTransportBooking) GetData() *structpb.Struct {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SolidarityTransportBooking) GetDriverCompensationAmount() float64 {
|
||||
if x != nil {
|
||||
return x.DriverCompensationAmount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SolidarityTransportBooking) GetDriverCompensationCurrency() string {
|
||||
if x != nil {
|
||||
return x.DriverCompensationCurrency
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SolidarityTransportBooking) GetJourney() *SolidarityTransportDriverJourney {
|
||||
if x != nil {
|
||||
return x.Journey
|
||||
@@ -537,7 +553,7 @@ const file_solidarity_transport_types_proto_rawDesc = "" +
|
||||
"\x06_price\"N\n" +
|
||||
"\x18SolidarityTransportPrice\x12\x16\n" +
|
||||
"\x06amount\x18\x01 \x01(\x01R\x06amount\x12\x1a\n" +
|
||||
"\bcurrency\x18\x02 \x01(\tR\bcurrency\"\xc1\x02\n" +
|
||||
"\bcurrency\x18\x02 \x01(\tR\bcurrency\"\xc1\x03\n" +
|
||||
"\x1aSolidarityTransportBooking\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x19\n" +
|
||||
"\bgroup_id\x18\x02 \x01(\tR\agroupId\x12\x1b\n" +
|
||||
@@ -545,7 +561,9 @@ const file_solidarity_transport_types_proto_rawDesc = "" +
|
||||
"\fpassenger_id\x18\x04 \x01(\tR\vpassengerId\x12\x16\n" +
|
||||
"\x06status\x18\x05 \x01(\tR\x06status\x126\n" +
|
||||
"\x17return_waiting_duration\x18\x06 \x01(\x03R\x15returnWaitingDuration\x12+\n" +
|
||||
"\x04data\x18\a \x01(\v2\x17.google.protobuf.StructR\x04data\x12;\n" +
|
||||
"\x04data\x18\a \x01(\v2\x17.google.protobuf.StructR\x04data\x12<\n" +
|
||||
"\x1adriver_compensation_amount\x18\b \x01(\x01R\x18driverCompensationAmount\x12@\n" +
|
||||
"\x1cdriver_compensation_currency\x18\t \x01(\tR\x1adriverCompensationCurrency\x12;\n" +
|
||||
"\ajourney\x18\n" +
|
||||
" \x01(\v2!.SolidarityTransportDriverJourneyR\ajourneyBKZIgit.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/genb\x06proto3"
|
||||
|
||||
|
||||
@@ -608,16 +608,18 @@ func (x *GetDriverJourneyResponse) GetDriverJourney() *SolidarityTransportDriver
|
||||
}
|
||||
|
||||
type BookDriverJourneyRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PassengerId string `protobuf:"bytes,1,opt,name=passenger_id,json=passengerId,proto3" json:"passenger_id,omitempty"`
|
||||
DriverId string `protobuf:"bytes,2,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"`
|
||||
DriverJourneyId string `protobuf:"bytes,3,opt,name=driver_journey_id,json=driverJourneyId,proto3" json:"driver_journey_id,omitempty"`
|
||||
ReturnWaitingDuration int64 `protobuf:"varint,4,opt,name=return_waiting_duration,json=returnWaitingDuration,proto3" json:"return_waiting_duration,omitempty"`
|
||||
PriceAmount float64 `protobuf:"fixed64,5,opt,name=price_amount,json=priceAmount,proto3" json:"price_amount,omitempty"`
|
||||
PriceCurrency string `protobuf:"bytes,6,opt,name=price_currency,json=priceCurrency,proto3" json:"price_currency,omitempty"`
|
||||
Data *structpb.Struct `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PassengerId string `protobuf:"bytes,1,opt,name=passenger_id,json=passengerId,proto3" json:"passenger_id,omitempty"`
|
||||
DriverId string `protobuf:"bytes,2,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"`
|
||||
DriverJourneyId string `protobuf:"bytes,3,opt,name=driver_journey_id,json=driverJourneyId,proto3" json:"driver_journey_id,omitempty"`
|
||||
ReturnWaitingDuration int64 `protobuf:"varint,4,opt,name=return_waiting_duration,json=returnWaitingDuration,proto3" json:"return_waiting_duration,omitempty"`
|
||||
PriceAmount float64 `protobuf:"fixed64,5,opt,name=price_amount,json=priceAmount,proto3" json:"price_amount,omitempty"`
|
||||
PriceCurrency string `protobuf:"bytes,6,opt,name=price_currency,json=priceCurrency,proto3" json:"price_currency,omitempty"`
|
||||
Data *structpb.Struct `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
|
||||
DriverCompensationAmount float64 `protobuf:"fixed64,8,opt,name=driver_compensation_amount,json=driverCompensationAmount,proto3" json:"driver_compensation_amount,omitempty"`
|
||||
DriverCompensationCurrency string `protobuf:"bytes,9,opt,name=driver_compensation_currency,json=driverCompensationCurrency,proto3" json:"driver_compensation_currency,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *BookDriverJourneyRequest) Reset() {
|
||||
@@ -699,6 +701,20 @@ func (x *BookDriverJourneyRequest) GetData() *structpb.Struct {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *BookDriverJourneyRequest) GetDriverCompensationAmount() float64 {
|
||||
if x != nil {
|
||||
return x.DriverCompensationAmount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *BookDriverJourneyRequest) GetDriverCompensationCurrency() string {
|
||||
if x != nil {
|
||||
return x.DriverCompensationCurrency
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type BookDriverJourneyResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Booking *SolidarityTransportBooking `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"`
|
||||
@@ -1246,7 +1262,7 @@ const file_solidarity_transport_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"journey_id\x18\x02 \x01(\tR\tjourneyId\"d\n" +
|
||||
"\x18GetDriverJourneyResponse\x12H\n" +
|
||||
"\x0edriver_journey\x18\x01 \x01(\v2!.SolidarityTransportDriverJourneyR\rdriverJourney\"\xb5\x02\n" +
|
||||
"\x0edriver_journey\x18\x01 \x01(\v2!.SolidarityTransportDriverJourneyR\rdriverJourney\"\xb5\x03\n" +
|
||||
"\x18BookDriverJourneyRequest\x12!\n" +
|
||||
"\fpassenger_id\x18\x01 \x01(\tR\vpassengerId\x12\x1b\n" +
|
||||
"\tdriver_id\x18\x02 \x01(\tR\bdriverId\x12*\n" +
|
||||
@@ -1254,7 +1270,9 @@ const file_solidarity_transport_proto_rawDesc = "" +
|
||||
"\x17return_waiting_duration\x18\x04 \x01(\x03R\x15returnWaitingDuration\x12!\n" +
|
||||
"\fprice_amount\x18\x05 \x01(\x01R\vpriceAmount\x12%\n" +
|
||||
"\x0eprice_currency\x18\x06 \x01(\tR\rpriceCurrency\x12+\n" +
|
||||
"\x04data\x18\a \x01(\v2\x17.google.protobuf.StructR\x04data\"R\n" +
|
||||
"\x04data\x18\a \x01(\v2\x17.google.protobuf.StructR\x04data\x12<\n" +
|
||||
"\x1adriver_compensation_amount\x18\b \x01(\x01R\x18driverCompensationAmount\x12@\n" +
|
||||
"\x1cdriver_compensation_currency\x18\t \x01(\tR\x1adriverCompensationCurrency\"R\n" +
|
||||
"\x19BookDriverJourneyResponse\x125\n" +
|
||||
"\abooking\x18\x01 \x01(\v2\x1b.SolidarityTransportBookingR\abooking\"\xef\x01\n" +
|
||||
"%GetSolidarityTransportBookingsRequest\x129\n" +
|
||||
|
||||
@@ -51,6 +51,8 @@ message SolidarityTransportBooking {
|
||||
string status = 5;
|
||||
int64 return_waiting_duration = 6;
|
||||
google.protobuf.Struct data = 7;
|
||||
double driver_compensation_amount = 8;
|
||||
string driver_compensation_currency = 9;
|
||||
|
||||
SolidarityTransportDriverJourney journey = 10;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,8 @@ message BookDriverJourneyRequest {
|
||||
double price_amount = 5;
|
||||
string price_currency = 6;
|
||||
google.protobuf.Struct data = 7;
|
||||
double driver_compensation_amount = 8;
|
||||
string driver_compensation_currency = 9;
|
||||
}
|
||||
|
||||
message BookDriverJourneyResponse {
|
||||
|
||||
@@ -17,10 +17,12 @@ func (s SolidarityTransportServerImpl) BookDriverJourney(ctx context.Context, re
|
||||
journeyId := req.DriverJourneyId
|
||||
priceAmount := req.PriceAmount
|
||||
priceCurrency := req.PriceCurrency
|
||||
driverCompensationAmount := req.DriverCompensationAmount
|
||||
driverCompensationCurrency := req.DriverCompensationCurrency
|
||||
returnWaitingDuration := time.Duration(req.ReturnWaitingDuration)
|
||||
data := req.Data.AsMap()
|
||||
|
||||
booking, err := s.Handler.BookDriverJourney(passengerId, driverId, journeyId, returnWaitingDuration, priceAmount, priceCurrency, data)
|
||||
booking, err := s.Handler.BookDriverJourney(passengerId, driverId, journeyId, returnWaitingDuration, priceAmount, priceCurrency, driverCompensationAmount, driverCompensationCurrency, data)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("issue in BookDriverJourney handler")
|
||||
return nil, status.Errorf(codes.Internal, "could not create booking : %v", err)
|
||||
|
||||
@@ -20,14 +20,16 @@ func BookingTypeToProto(booking *types.Booking) (*gen.SolidarityTransportBooking
|
||||
}
|
||||
|
||||
return &gen.SolidarityTransportBooking{
|
||||
Id: booking.Id,
|
||||
GroupId: booking.GroupId,
|
||||
DriverId: booking.DriverId,
|
||||
PassengerId: booking.PassengerId,
|
||||
Status: booking.Status,
|
||||
ReturnWaitingDuration: int64(booking.ReturnWaitingDuration),
|
||||
Journey: journey,
|
||||
Data: data,
|
||||
Id: booking.Id,
|
||||
GroupId: booking.GroupId,
|
||||
DriverId: booking.DriverId,
|
||||
PassengerId: booking.PassengerId,
|
||||
Status: booking.Status,
|
||||
ReturnWaitingDuration: int64(booking.ReturnWaitingDuration),
|
||||
Journey: journey,
|
||||
Data: data,
|
||||
DriverCompensationAmount: booking.DriverCompensationAmount,
|
||||
DriverCompensationCurrency: booking.DriverCompensationCurrency,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -37,13 +39,15 @@ func BookingProtoToType(booking *gen.SolidarityTransportBooking) (*types.Booking
|
||||
return nil, err
|
||||
}
|
||||
return &types.Booking{
|
||||
Id: booking.Id,
|
||||
GroupId: booking.GroupId,
|
||||
DriverId: booking.DriverId,
|
||||
PassengerId: booking.PassengerId,
|
||||
Status: booking.Status,
|
||||
ReturnWaitingDuration: time.Duration(booking.ReturnWaitingDuration),
|
||||
Journey: journey,
|
||||
Data: booking.Data.AsMap(),
|
||||
Id: booking.Id,
|
||||
GroupId: booking.GroupId,
|
||||
DriverId: booking.DriverId,
|
||||
PassengerId: booking.PassengerId,
|
||||
Status: booking.Status,
|
||||
ReturnWaitingDuration: time.Duration(booking.ReturnWaitingDuration),
|
||||
Journey: journey,
|
||||
Data: booking.Data.AsMap(),
|
||||
DriverCompensationAmount: booking.DriverCompensationAmount,
|
||||
DriverCompensationCurrency: booking.DriverCompensationCurrency,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user