initial commit

This commit is contained in:
2025-03-05 00:30:53 +01:00
commit 9da7b99e5d
32 changed files with 4541 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Protocol buffer definition
From this directory, generate protocol buffer server and client boilerplate using :
protoc --go_out=paths=source_relative:./gen --go-grpc_out=paths=source_relative:./gen ./*.proto
(You need some dependencies like protoc, protoc-gen-go ... To get them easily, you can use the <https://git.coopgo.io/coopgo-platform/dev-environment> nix shell)

View File

@@ -0,0 +1,727 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc v4.24.4
// source: solidarity-transport-types.proto
package gen
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GeoJsonFeature struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Serialized string `protobuf:"bytes,1,opt,name=serialized,proto3" json:"serialized,omitempty"`
}
func (x *GeoJsonFeature) Reset() {
*x = GeoJsonFeature{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_transport_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GeoJsonFeature) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GeoJsonFeature) ProtoMessage() {}
func (x *GeoJsonFeature) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_transport_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GeoJsonFeature.ProtoReflect.Descriptor instead.
func (*GeoJsonFeature) Descriptor() ([]byte, []int) {
return file_solidarity_transport_types_proto_rawDescGZIP(), []int{0}
}
func (x *GeoJsonFeature) GetSerialized() string {
if x != nil {
return x.Serialized
}
return ""
}
type GeoJsonFeatureCollection struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Serialized string `protobuf:"bytes,1,opt,name=serialized,proto3" json:"serialized,omitempty"`
}
func (x *GeoJsonFeatureCollection) Reset() {
*x = GeoJsonFeatureCollection{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_transport_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GeoJsonFeatureCollection) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GeoJsonFeatureCollection) ProtoMessage() {}
func (x *GeoJsonFeatureCollection) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_transport_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GeoJsonFeatureCollection.ProtoReflect.Descriptor instead.
func (*GeoJsonFeatureCollection) Descriptor() ([]byte, []int) {
return file_solidarity_transport_types_proto_rawDescGZIP(), []int{1}
}
func (x *GeoJsonFeatureCollection) GetSerialized() string {
if x != nil {
return x.Serialized
}
return ""
}
type DriverRegularAvailability struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
DriverId string `protobuf:"bytes,2,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"`
Day int32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"`
StartTime string `protobuf:"bytes,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
EndTime string `protobuf:"bytes,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
Address *GeoJsonFeature `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty"`
}
func (x *DriverRegularAvailability) Reset() {
*x = DriverRegularAvailability{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_transport_types_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DriverRegularAvailability) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DriverRegularAvailability) ProtoMessage() {}
func (x *DriverRegularAvailability) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_transport_types_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DriverRegularAvailability.ProtoReflect.Descriptor instead.
func (*DriverRegularAvailability) Descriptor() ([]byte, []int) {
return file_solidarity_transport_types_proto_rawDescGZIP(), []int{2}
}
func (x *DriverRegularAvailability) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DriverRegularAvailability) GetDriverId() string {
if x != nil {
return x.DriverId
}
return ""
}
func (x *DriverRegularAvailability) GetDay() int32 {
if x != nil {
return x.Day
}
return 0
}
func (x *DriverRegularAvailability) GetStartTime() string {
if x != nil {
return x.StartTime
}
return ""
}
func (x *DriverRegularAvailability) GetEndTime() string {
if x != nil {
return x.EndTime
}
return ""
}
func (x *DriverRegularAvailability) GetAddress() *GeoJsonFeature {
if x != nil {
return x.Address
}
return nil
}
type SolidarityTransportDriverJourney struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
DriverId string `protobuf:"bytes,2,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"`
PassengerPickup *GeoJsonFeature `protobuf:"bytes,3,opt,name=passenger_pickup,json=passengerPickup,proto3" json:"passenger_pickup,omitempty"`
PassengerDrop *GeoJsonFeature `protobuf:"bytes,4,opt,name=passenger_drop,json=passengerDrop,proto3" json:"passenger_drop,omitempty"`
PassengerDistance int64 `protobuf:"varint,5,opt,name=passenger_distance,json=passengerDistance,proto3" json:"passenger_distance,omitempty"`
DriverDeparture *GeoJsonFeature `protobuf:"bytes,6,opt,name=driver_departure,json=driverDeparture,proto3" json:"driver_departure,omitempty"`
DriverArrival *GeoJsonFeature `protobuf:"bytes,7,opt,name=driver_arrival,json=driverArrival,proto3" json:"driver_arrival,omitempty"`
DriverDistance int64 `protobuf:"varint,8,opt,name=driver_distance,json=driverDistance,proto3" json:"driver_distance,omitempty"`
Duration int64 `protobuf:"varint,9,opt,name=duration,proto3" json:"duration,omitempty"`
JourneyPolyline *string `protobuf:"bytes,10,opt,name=journey_polyline,json=journeyPolyline,proto3,oneof" json:"journey_polyline,omitempty"`
PassengerPickupDate *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=passenger_pickup_date,json=passengerPickupDate,proto3" json:"passenger_pickup_date,omitempty"`
DriverDepartureDate *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=driver_departure_date,json=driverDepartureDate,proto3,oneof" json:"driver_departure_date,omitempty"`
Price *SolidarityTransportPrice `protobuf:"bytes,13,opt,name=price,proto3,oneof" json:"price,omitempty"`
}
func (x *SolidarityTransportDriverJourney) Reset() {
*x = SolidarityTransportDriverJourney{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_transport_types_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SolidarityTransportDriverJourney) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SolidarityTransportDriverJourney) ProtoMessage() {}
func (x *SolidarityTransportDriverJourney) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_transport_types_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SolidarityTransportDriverJourney.ProtoReflect.Descriptor instead.
func (*SolidarityTransportDriverJourney) Descriptor() ([]byte, []int) {
return file_solidarity_transport_types_proto_rawDescGZIP(), []int{3}
}
func (x *SolidarityTransportDriverJourney) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *SolidarityTransportDriverJourney) GetDriverId() string {
if x != nil {
return x.DriverId
}
return ""
}
func (x *SolidarityTransportDriverJourney) GetPassengerPickup() *GeoJsonFeature {
if x != nil {
return x.PassengerPickup
}
return nil
}
func (x *SolidarityTransportDriverJourney) GetPassengerDrop() *GeoJsonFeature {
if x != nil {
return x.PassengerDrop
}
return nil
}
func (x *SolidarityTransportDriverJourney) GetPassengerDistance() int64 {
if x != nil {
return x.PassengerDistance
}
return 0
}
func (x *SolidarityTransportDriverJourney) GetDriverDeparture() *GeoJsonFeature {
if x != nil {
return x.DriverDeparture
}
return nil
}
func (x *SolidarityTransportDriverJourney) GetDriverArrival() *GeoJsonFeature {
if x != nil {
return x.DriverArrival
}
return nil
}
func (x *SolidarityTransportDriverJourney) GetDriverDistance() int64 {
if x != nil {
return x.DriverDistance
}
return 0
}
func (x *SolidarityTransportDriverJourney) GetDuration() int64 {
if x != nil {
return x.Duration
}
return 0
}
func (x *SolidarityTransportDriverJourney) GetJourneyPolyline() string {
if x != nil && x.JourneyPolyline != nil {
return *x.JourneyPolyline
}
return ""
}
func (x *SolidarityTransportDriverJourney) GetPassengerPickupDate() *timestamppb.Timestamp {
if x != nil {
return x.PassengerPickupDate
}
return nil
}
func (x *SolidarityTransportDriverJourney) GetDriverDepartureDate() *timestamppb.Timestamp {
if x != nil {
return x.DriverDepartureDate
}
return nil
}
func (x *SolidarityTransportDriverJourney) GetPrice() *SolidarityTransportPrice {
if x != nil {
return x.Price
}
return nil
}
type SolidarityTransportPrice struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Amount float64 `protobuf:"fixed64,1,opt,name=amount,proto3" json:"amount,omitempty"`
Currency string `protobuf:"bytes,2,opt,name=currency,proto3" json:"currency,omitempty"`
}
func (x *SolidarityTransportPrice) Reset() {
*x = SolidarityTransportPrice{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_transport_types_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SolidarityTransportPrice) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SolidarityTransportPrice) ProtoMessage() {}
func (x *SolidarityTransportPrice) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_transport_types_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SolidarityTransportPrice.ProtoReflect.Descriptor instead.
func (*SolidarityTransportPrice) Descriptor() ([]byte, []int) {
return file_solidarity_transport_types_proto_rawDescGZIP(), []int{4}
}
func (x *SolidarityTransportPrice) GetAmount() float64 {
if x != nil {
return x.Amount
}
return 0
}
func (x *SolidarityTransportPrice) GetCurrency() string {
if x != nil {
return x.Currency
}
return ""
}
type SolidarityTransportBooking struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"`
Journey *SolidarityTransportDriverJourney `protobuf:"bytes,10,opt,name=journey,proto3" json:"journey,omitempty"`
}
func (x *SolidarityTransportBooking) Reset() {
*x = SolidarityTransportBooking{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_transport_types_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SolidarityTransportBooking) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SolidarityTransportBooking) ProtoMessage() {}
func (x *SolidarityTransportBooking) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_transport_types_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SolidarityTransportBooking.ProtoReflect.Descriptor instead.
func (*SolidarityTransportBooking) Descriptor() ([]byte, []int) {
return file_solidarity_transport_types_proto_rawDescGZIP(), []int{5}
}
func (x *SolidarityTransportBooking) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *SolidarityTransportBooking) GetGroupId() string {
if x != nil {
return x.GroupId
}
return ""
}
func (x *SolidarityTransportBooking) GetDriverId() string {
if x != nil {
return x.DriverId
}
return ""
}
func (x *SolidarityTransportBooking) GetPassengerId() string {
if x != nil {
return x.PassengerId
}
return ""
}
func (x *SolidarityTransportBooking) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
func (x *SolidarityTransportBooking) GetJourney() *SolidarityTransportDriverJourney {
if x != nil {
return x.Journey
}
return nil
}
var File_solidarity_transport_types_proto protoreflect.FileDescriptor
var file_solidarity_transport_types_proto_rawDesc = []byte{
0x0a, 0x20, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x74, 0x72, 0x61,
0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x30, 0x0a, 0x0e, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65,
0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69,
0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61,
0x6c, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x3a, 0x0a, 0x18, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e,
0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65,
0x64, 0x22, 0xbf, 0x01, 0x0a, 0x19, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75,
0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03,
0x64, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x1d,
0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a,
0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a,
0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x22, 0xef, 0x05, 0x0a, 0x20, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69,
0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65,
0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76,
0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69,
0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x10, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
0x65, 0x72, 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
0x52, 0x0f, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75,
0x70, 0x12, 0x36, 0x0a, 0x0e, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64,
0x72, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a,
0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x70, 0x61, 0x73, 0x73,
0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x72, 0x6f, 0x70, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x61, 0x73,
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72,
0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x10, 0x64, 0x72, 0x69, 0x76,
0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74,
0x75, 0x72, 0x65, 0x52, 0x0f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72,
0x74, 0x75, 0x72, 0x65, 0x12, 0x36, 0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x61,
0x72, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47,
0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x64,
0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x72, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x12, 0x27, 0x0a, 0x0f,
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18,
0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44, 0x69, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x2e, 0x0a, 0x10, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x5f, 0x70, 0x6f, 0x6c,
0x79, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0f, 0x6a,
0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x50, 0x6f, 0x6c, 0x79, 0x6c, 0x69, 0x6e, 0x65, 0x88, 0x01,
0x01, 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, 0x0b, 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, 0x53, 0x0a, 0x15, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, 0x61,
0x72, 0x74, 0x75, 0x72, 0x65, 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, 0x48, 0x01, 0x52, 0x13,
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x44,
0x61, 0x74, 0x65, 0x88, 0x01, 0x01, 0x12, 0x34, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18,
0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69,
0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65,
0x48, 0x02, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x42, 0x13, 0x0a, 0x11,
0x5f, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x5f, 0x70, 0x6f, 0x6c, 0x79, 0x6c, 0x69, 0x6e,
0x65, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x70,
0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f,
0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x4e, 0x0a, 0x18, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72,
0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x63,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72,
0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x75, 0x72,
0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xdc, 0x01, 0x0a, 0x1a, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61,
0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12,
0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c,
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x6a, 0x6f, 0x75, 0x72, 0x6e,
0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x53, 0x6f, 0x6c, 0x69, 0x64,
0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x72,
0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x07, 0x6a, 0x6f, 0x75,
0x72, 0x6e, 0x65, 0x79, 0x42, 0x4b, 0x5a, 0x49, 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, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65,
0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_solidarity_transport_types_proto_rawDescOnce sync.Once
file_solidarity_transport_types_proto_rawDescData = file_solidarity_transport_types_proto_rawDesc
)
func file_solidarity_transport_types_proto_rawDescGZIP() []byte {
file_solidarity_transport_types_proto_rawDescOnce.Do(func() {
file_solidarity_transport_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_solidarity_transport_types_proto_rawDescData)
})
return file_solidarity_transport_types_proto_rawDescData
}
var file_solidarity_transport_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_solidarity_transport_types_proto_goTypes = []interface{}{
(*GeoJsonFeature)(nil), // 0: GeoJsonFeature
(*GeoJsonFeatureCollection)(nil), // 1: GeoJsonFeatureCollection
(*DriverRegularAvailability)(nil), // 2: DriverRegularAvailability
(*SolidarityTransportDriverJourney)(nil), // 3: SolidarityTransportDriverJourney
(*SolidarityTransportPrice)(nil), // 4: SolidarityTransportPrice
(*SolidarityTransportBooking)(nil), // 5: SolidarityTransportBooking
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
}
var file_solidarity_transport_types_proto_depIdxs = []int32{
0, // 0: DriverRegularAvailability.address:type_name -> GeoJsonFeature
0, // 1: SolidarityTransportDriverJourney.passenger_pickup:type_name -> GeoJsonFeature
0, // 2: SolidarityTransportDriverJourney.passenger_drop:type_name -> GeoJsonFeature
0, // 3: SolidarityTransportDriverJourney.driver_departure:type_name -> GeoJsonFeature
0, // 4: SolidarityTransportDriverJourney.driver_arrival:type_name -> GeoJsonFeature
6, // 5: SolidarityTransportDriverJourney.passenger_pickup_date:type_name -> google.protobuf.Timestamp
6, // 6: SolidarityTransportDriverJourney.driver_departure_date:type_name -> google.protobuf.Timestamp
4, // 7: SolidarityTransportDriverJourney.price:type_name -> SolidarityTransportPrice
3, // 8: SolidarityTransportBooking.journey:type_name -> SolidarityTransportDriverJourney
9, // [9:9] is the sub-list for method output_type
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
}
func init() { file_solidarity_transport_types_proto_init() }
func file_solidarity_transport_types_proto_init() {
if File_solidarity_transport_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_solidarity_transport_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GeoJsonFeature); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_solidarity_transport_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GeoJsonFeatureCollection); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_solidarity_transport_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DriverRegularAvailability); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_solidarity_transport_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SolidarityTransportDriverJourney); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_solidarity_transport_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SolidarityTransportPrice); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_solidarity_transport_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SolidarityTransportBooking); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_solidarity_transport_types_proto_msgTypes[3].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_solidarity_transport_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_solidarity_transport_types_proto_goTypes,
DependencyIndexes: file_solidarity_transport_types_proto_depIdxs,
MessageInfos: file_solidarity_transport_types_proto_msgTypes,
}.Build()
File_solidarity_transport_types_proto = out.File
file_solidarity_transport_types_proto_rawDesc = nil
file_solidarity_transport_types_proto_goTypes = nil
file_solidarity_transport_types_proto_depIdxs = nil
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,448 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.24.4
// source: solidarity-transport.proto
package gen
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
SolidarityTransport_AddDriverRegularAvailability_FullMethodName = "/SolidarityTransport/AddDriverRegularAvailability"
SolidarityTransport_AddDriverRegularAvailabilities_FullMethodName = "/SolidarityTransport/AddDriverRegularAvailabilities"
SolidarityTransport_GetDriverRegularAvailabilities_FullMethodName = "/SolidarityTransport/GetDriverRegularAvailabilities"
SolidarityTransport_DeleteDriverRegularAvailability_FullMethodName = "/SolidarityTransport/DeleteDriverRegularAvailability"
SolidarityTransport_GetDriverJourneys_FullMethodName = "/SolidarityTransport/GetDriverJourneys"
SolidarityTransport_GetDriverJourney_FullMethodName = "/SolidarityTransport/GetDriverJourney"
SolidarityTransport_BookDriverJourney_FullMethodName = "/SolidarityTransport/BookDriverJourney"
SolidarityTransport_GetSolidarityTransportBookings_FullMethodName = "/SolidarityTransport/GetSolidarityTransportBookings"
SolidarityTransport_GetSolidarityTransportBooking_FullMethodName = "/SolidarityTransport/GetSolidarityTransportBooking"
SolidarityTransport_UpdateSolidarityTransportBookingStatus_FullMethodName = "/SolidarityTransport/UpdateSolidarityTransportBookingStatus"
)
// SolidarityTransportClient is the client API for SolidarityTransport service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SolidarityTransportClient interface {
// Availabilities management
AddDriverRegularAvailability(ctx context.Context, in *AddDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilityResponse, error)
AddDriverRegularAvailabilities(ctx context.Context, in *AddDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilitiesResponse, error)
GetDriverRegularAvailabilities(ctx context.Context, in *GetDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*GetDriverRegularAvailabilitiesResponse, error)
DeleteDriverRegularAvailability(ctx context.Context, in *DeleteDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*DeleteDriverRegularAvailabilityResponse, error)
// Search / Journeys
GetDriverJourneys(ctx context.Context, in *GetDriverJourneysRequest, opts ...grpc.CallOption) (*GetDriverJourneysResponse, error)
GetDriverJourney(ctx context.Context, in *GetDriverJourneyRequest, opts ...grpc.CallOption) (*GetDriverJourneyResponse, error)
// Booking flows
BookDriverJourney(ctx context.Context, in *BookDriverJourneyRequest, opts ...grpc.CallOption) (*BookDriverJourneyResponse, error)
GetSolidarityTransportBookings(ctx context.Context, in *GetSolidarityTransportBookingsRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingsResponse, error)
GetSolidarityTransportBooking(ctx context.Context, in *GetSolidarityTransportBookingRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingResponse, error)
UpdateSolidarityTransportBookingStatus(ctx context.Context, in *UpdateSolidarityTransportBookingStatusRequest, opts ...grpc.CallOption) (*UpdateSolidarityTransportBookingStatusResponse, error)
}
type solidarityTransportClient struct {
cc grpc.ClientConnInterface
}
func NewSolidarityTransportClient(cc grpc.ClientConnInterface) SolidarityTransportClient {
return &solidarityTransportClient{cc}
}
func (c *solidarityTransportClient) AddDriverRegularAvailability(ctx context.Context, in *AddDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilityResponse, error) {
out := new(AddDriverRegularAvailabilityResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_AddDriverRegularAvailability_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) AddDriverRegularAvailabilities(ctx context.Context, in *AddDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilitiesResponse, error) {
out := new(AddDriverRegularAvailabilitiesResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_AddDriverRegularAvailabilities_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) GetDriverRegularAvailabilities(ctx context.Context, in *GetDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*GetDriverRegularAvailabilitiesResponse, error) {
out := new(GetDriverRegularAvailabilitiesResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_GetDriverRegularAvailabilities_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) DeleteDriverRegularAvailability(ctx context.Context, in *DeleteDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*DeleteDriverRegularAvailabilityResponse, error) {
out := new(DeleteDriverRegularAvailabilityResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_DeleteDriverRegularAvailability_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) GetDriverJourneys(ctx context.Context, in *GetDriverJourneysRequest, opts ...grpc.CallOption) (*GetDriverJourneysResponse, error) {
out := new(GetDriverJourneysResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_GetDriverJourneys_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) GetDriverJourney(ctx context.Context, in *GetDriverJourneyRequest, opts ...grpc.CallOption) (*GetDriverJourneyResponse, error) {
out := new(GetDriverJourneyResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_GetDriverJourney_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) BookDriverJourney(ctx context.Context, in *BookDriverJourneyRequest, opts ...grpc.CallOption) (*BookDriverJourneyResponse, error) {
out := new(BookDriverJourneyResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_BookDriverJourney_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) GetSolidarityTransportBookings(ctx context.Context, in *GetSolidarityTransportBookingsRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingsResponse, error) {
out := new(GetSolidarityTransportBookingsResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_GetSolidarityTransportBookings_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) GetSolidarityTransportBooking(ctx context.Context, in *GetSolidarityTransportBookingRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingResponse, error) {
out := new(GetSolidarityTransportBookingResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_GetSolidarityTransportBooking_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityTransportClient) UpdateSolidarityTransportBookingStatus(ctx context.Context, in *UpdateSolidarityTransportBookingStatusRequest, opts ...grpc.CallOption) (*UpdateSolidarityTransportBookingStatusResponse, error) {
out := new(UpdateSolidarityTransportBookingStatusResponse)
err := c.cc.Invoke(ctx, SolidarityTransport_UpdateSolidarityTransportBookingStatus_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// SolidarityTransportServer is the server API for SolidarityTransport service.
// All implementations must embed UnimplementedSolidarityTransportServer
// for forward compatibility
type SolidarityTransportServer interface {
// Availabilities management
AddDriverRegularAvailability(context.Context, *AddDriverRegularAvailabilityRequest) (*AddDriverRegularAvailabilityResponse, error)
AddDriverRegularAvailabilities(context.Context, *AddDriverRegularAvailabilitiesRequest) (*AddDriverRegularAvailabilitiesResponse, error)
GetDriverRegularAvailabilities(context.Context, *GetDriverRegularAvailabilitiesRequest) (*GetDriverRegularAvailabilitiesResponse, error)
DeleteDriverRegularAvailability(context.Context, *DeleteDriverRegularAvailabilityRequest) (*DeleteDriverRegularAvailabilityResponse, error)
// Search / Journeys
GetDriverJourneys(context.Context, *GetDriverJourneysRequest) (*GetDriverJourneysResponse, error)
GetDriverJourney(context.Context, *GetDriverJourneyRequest) (*GetDriverJourneyResponse, error)
// Booking flows
BookDriverJourney(context.Context, *BookDriverJourneyRequest) (*BookDriverJourneyResponse, error)
GetSolidarityTransportBookings(context.Context, *GetSolidarityTransportBookingsRequest) (*GetSolidarityTransportBookingsResponse, error)
GetSolidarityTransportBooking(context.Context, *GetSolidarityTransportBookingRequest) (*GetSolidarityTransportBookingResponse, error)
UpdateSolidarityTransportBookingStatus(context.Context, *UpdateSolidarityTransportBookingStatusRequest) (*UpdateSolidarityTransportBookingStatusResponse, error)
mustEmbedUnimplementedSolidarityTransportServer()
}
// UnimplementedSolidarityTransportServer must be embedded to have forward compatible implementations.
type UnimplementedSolidarityTransportServer struct {
}
func (UnimplementedSolidarityTransportServer) AddDriverRegularAvailability(context.Context, *AddDriverRegularAvailabilityRequest) (*AddDriverRegularAvailabilityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddDriverRegularAvailability not implemented")
}
func (UnimplementedSolidarityTransportServer) AddDriverRegularAvailabilities(context.Context, *AddDriverRegularAvailabilitiesRequest) (*AddDriverRegularAvailabilitiesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddDriverRegularAvailabilities not implemented")
}
func (UnimplementedSolidarityTransportServer) GetDriverRegularAvailabilities(context.Context, *GetDriverRegularAvailabilitiesRequest) (*GetDriverRegularAvailabilitiesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDriverRegularAvailabilities not implemented")
}
func (UnimplementedSolidarityTransportServer) DeleteDriverRegularAvailability(context.Context, *DeleteDriverRegularAvailabilityRequest) (*DeleteDriverRegularAvailabilityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteDriverRegularAvailability not implemented")
}
func (UnimplementedSolidarityTransportServer) GetDriverJourneys(context.Context, *GetDriverJourneysRequest) (*GetDriverJourneysResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDriverJourneys not implemented")
}
func (UnimplementedSolidarityTransportServer) GetDriverJourney(context.Context, *GetDriverJourneyRequest) (*GetDriverJourneyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDriverJourney not implemented")
}
func (UnimplementedSolidarityTransportServer) BookDriverJourney(context.Context, *BookDriverJourneyRequest) (*BookDriverJourneyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BookDriverJourney not implemented")
}
func (UnimplementedSolidarityTransportServer) GetSolidarityTransportBookings(context.Context, *GetSolidarityTransportBookingsRequest) (*GetSolidarityTransportBookingsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSolidarityTransportBookings not implemented")
}
func (UnimplementedSolidarityTransportServer) GetSolidarityTransportBooking(context.Context, *GetSolidarityTransportBookingRequest) (*GetSolidarityTransportBookingResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSolidarityTransportBooking not implemented")
}
func (UnimplementedSolidarityTransportServer) UpdateSolidarityTransportBookingStatus(context.Context, *UpdateSolidarityTransportBookingStatusRequest) (*UpdateSolidarityTransportBookingStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateSolidarityTransportBookingStatus not implemented")
}
func (UnimplementedSolidarityTransportServer) mustEmbedUnimplementedSolidarityTransportServer() {}
// UnsafeSolidarityTransportServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SolidarityTransportServer will
// result in compilation errors.
type UnsafeSolidarityTransportServer interface {
mustEmbedUnimplementedSolidarityTransportServer()
}
func RegisterSolidarityTransportServer(s grpc.ServiceRegistrar, srv SolidarityTransportServer) {
s.RegisterService(&SolidarityTransport_ServiceDesc, srv)
}
func _SolidarityTransport_AddDriverRegularAvailability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddDriverRegularAvailabilityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).AddDriverRegularAvailability(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_AddDriverRegularAvailability_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).AddDriverRegularAvailability(ctx, req.(*AddDriverRegularAvailabilityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_AddDriverRegularAvailabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddDriverRegularAvailabilitiesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).AddDriverRegularAvailabilities(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_AddDriverRegularAvailabilities_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).AddDriverRegularAvailabilities(ctx, req.(*AddDriverRegularAvailabilitiesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_GetDriverRegularAvailabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDriverRegularAvailabilitiesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).GetDriverRegularAvailabilities(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_GetDriverRegularAvailabilities_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).GetDriverRegularAvailabilities(ctx, req.(*GetDriverRegularAvailabilitiesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_DeleteDriverRegularAvailability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteDriverRegularAvailabilityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).DeleteDriverRegularAvailability(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_DeleteDriverRegularAvailability_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).DeleteDriverRegularAvailability(ctx, req.(*DeleteDriverRegularAvailabilityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_GetDriverJourneys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDriverJourneysRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).GetDriverJourneys(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_GetDriverJourneys_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).GetDriverJourneys(ctx, req.(*GetDriverJourneysRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_GetDriverJourney_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDriverJourneyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).GetDriverJourney(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_GetDriverJourney_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).GetDriverJourney(ctx, req.(*GetDriverJourneyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_BookDriverJourney_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BookDriverJourneyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).BookDriverJourney(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_BookDriverJourney_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).BookDriverJourney(ctx, req.(*BookDriverJourneyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_GetSolidarityTransportBookings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSolidarityTransportBookingsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).GetSolidarityTransportBookings(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_GetSolidarityTransportBookings_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).GetSolidarityTransportBookings(ctx, req.(*GetSolidarityTransportBookingsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_GetSolidarityTransportBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSolidarityTransportBookingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).GetSolidarityTransportBooking(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_GetSolidarityTransportBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).GetSolidarityTransportBooking(ctx, req.(*GetSolidarityTransportBookingRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityTransport_UpdateSolidarityTransportBookingStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateSolidarityTransportBookingStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityTransportServer).UpdateSolidarityTransportBookingStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityTransport_UpdateSolidarityTransportBookingStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityTransportServer).UpdateSolidarityTransportBookingStatus(ctx, req.(*UpdateSolidarityTransportBookingStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
// SolidarityTransport_ServiceDesc is the grpc.ServiceDesc for SolidarityTransport service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SolidarityTransport_ServiceDesc = grpc.ServiceDesc{
ServiceName: "SolidarityTransport",
HandlerType: (*SolidarityTransportServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddDriverRegularAvailability",
Handler: _SolidarityTransport_AddDriverRegularAvailability_Handler,
},
{
MethodName: "AddDriverRegularAvailabilities",
Handler: _SolidarityTransport_AddDriverRegularAvailabilities_Handler,
},
{
MethodName: "GetDriverRegularAvailabilities",
Handler: _SolidarityTransport_GetDriverRegularAvailabilities_Handler,
},
{
MethodName: "DeleteDriverRegularAvailability",
Handler: _SolidarityTransport_DeleteDriverRegularAvailability_Handler,
},
{
MethodName: "GetDriverJourneys",
Handler: _SolidarityTransport_GetDriverJourneys_Handler,
},
{
MethodName: "GetDriverJourney",
Handler: _SolidarityTransport_GetDriverJourney_Handler,
},
{
MethodName: "BookDriverJourney",
Handler: _SolidarityTransport_BookDriverJourney_Handler,
},
{
MethodName: "GetSolidarityTransportBookings",
Handler: _SolidarityTransport_GetSolidarityTransportBookings_Handler,
},
{
MethodName: "GetSolidarityTransportBooking",
Handler: _SolidarityTransport_GetSolidarityTransportBooking_Handler,
},
{
MethodName: "UpdateSolidarityTransportBookingStatus",
Handler: _SolidarityTransport_UpdateSolidarityTransportBookingStatus_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "solidarity-transport.proto",
}

View File

@@ -0,0 +1,52 @@
syntax = "proto3";
option go_package = "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen";
import "google/protobuf/timestamp.proto";
message GeoJsonFeature {
string serialized = 1;
}
message GeoJsonFeatureCollection {
string serialized = 1;
}
message DriverRegularAvailability {
string id = 1;
string driver_id = 2;
int32 day = 3;
string start_time = 4;
string end_time = 5;
GeoJsonFeature address = 6;
}
message SolidarityTransportDriverJourney{
string id = 1;
string driver_id = 2;
GeoJsonFeature passenger_pickup = 3;
GeoJsonFeature passenger_drop = 4;
int64 passenger_distance = 5;
GeoJsonFeature driver_departure = 6;
GeoJsonFeature driver_arrival = 7;
int64 driver_distance = 8;
int64 duration = 9;
optional string journey_polyline = 10;
google.protobuf.Timestamp passenger_pickup_date = 11;
optional google.protobuf.Timestamp driver_departure_date = 12;
optional SolidarityTransportPrice price = 13;
}
message SolidarityTransportPrice {
double amount = 1;
string currency = 2;
}
message SolidarityTransportBooking {
string id = 1;
string group_id = 2;
string driver_id = 3;
string passenger_id = 4;
string status = 5;
SolidarityTransportDriverJourney journey = 10;
}

View File

@@ -0,0 +1,110 @@
syntax = "proto3";
option go_package = "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen";
import "google/protobuf/timestamp.proto";
import "solidarity-transport-types.proto";
service SolidarityTransport {
//Availabilities management
rpc AddDriverRegularAvailability(AddDriverRegularAvailabilityRequest) returns (AddDriverRegularAvailabilityResponse) {}
rpc AddDriverRegularAvailabilities(AddDriverRegularAvailabilitiesRequest) returns (AddDriverRegularAvailabilitiesResponse) {}
rpc GetDriverRegularAvailabilities(GetDriverRegularAvailabilitiesRequest) returns (GetDriverRegularAvailabilitiesResponse) {}
rpc DeleteDriverRegularAvailability(DeleteDriverRegularAvailabilityRequest) returns (DeleteDriverRegularAvailabilityResponse) {}
// Search / Journeys
rpc GetDriverJourneys(GetDriverJourneysRequest) returns (GetDriverJourneysResponse) {}
rpc GetDriverJourney(GetDriverJourneyRequest) returns (GetDriverJourneyResponse) {}
// Booking flows
rpc BookDriverJourney(BookDriverJourneyRequest) returns (BookDriverJourneyResponse) {}
rpc GetSolidarityTransportBookings(GetSolidarityTransportBookingsRequest) returns (GetSolidarityTransportBookingsResponse) {}
rpc GetSolidarityTransportBooking(GetSolidarityTransportBookingRequest) returns (GetSolidarityTransportBookingResponse) {}
rpc UpdateSolidarityTransportBookingStatus(UpdateSolidarityTransportBookingStatusRequest) returns (UpdateSolidarityTransportBookingStatusResponse) {}
}
message AddDriverRegularAvailabilityRequest{
string driver_id = 1;
int32 day = 2;
string start_time = 3;
string end_time = 4;
GeoJsonFeature address = 5;
}
message AddDriverRegularAvailabilityResponse{}
message AddDriverRegularAvailabilitiesRequest{
repeated DriverRegularAvailability availabilities = 1;
}
message AddDriverRegularAvailabilitiesResponse{}
message GetDriverRegularAvailabilitiesRequest {
string driver_id = 1;
}
message GetDriverRegularAvailabilitiesResponse {
repeated DriverRegularAvailability results = 1;
}
message DeleteDriverRegularAvailabilityRequest {
string driver_id = 1;
string availability_id = 2;
}
message DeleteDriverRegularAvailabilityResponse {}
// Search / Journeys
message GetDriverJourneysRequest {
GeoJsonFeature departure = 1;
GeoJsonFeature arrival = 3;
google.protobuf.Timestamp departure_date = 5;
optional int64 time_delta = 6;
}
message GetDriverJourneysResponse {
repeated SolidarityTransportDriverJourney driver_journeys = 1;
}
message GetDriverJourneyRequest {
string driver_id = 1;
string journey_id = 2;
}
message GetDriverJourneyResponse {
SolidarityTransportDriverJourney driver_journey = 1;
}
message BookDriverJourneyRequest {
string passenger_id = 1;
string driver_id = 2;
string driver_journey_id = 3;
}
message BookDriverJourneyResponse {
}
message GetSolidarityTransportBookingsRequest {
google.protobuf.Timestamp start_date = 1;
google.protobuf.Timestamp end_date = 2;
}
message GetSolidarityTransportBookingsResponse {
repeated SolidarityTransportBooking bookings = 1;
}
message GetSolidarityTransportBookingRequest {
string id = 1;
}
message GetSolidarityTransportBookingResponse {
SolidarityTransportBooking booking = 1;
}
message UpdateSolidarityTransportBookingStatusRequest {
string booking_id = 1;
string new_status = 2;
}
message UpdateSolidarityTransportBookingStatusResponse {}

View File

@@ -0,0 +1,74 @@
package server
import (
"context"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/transformers"
"git.coopgo.io/coopgo-platform/solidarity-transport/types"
"github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s SolidarityTransportServerImpl) AddDriverRegularAvailability(ctx context.Context, req *gen.AddDriverRegularAvailabilityRequest) (*gen.AddDriverRegularAvailabilityResponse, error) {
if err := s.Handler.AddRegularAvailability(req.DriverId, int(req.Day), req.StartTime, req.EndTime); err != nil {
return nil, status.Errorf(codes.Internal, "AddDriverRegularAvailability : %v", err)
}
return &gen.AddDriverRegularAvailabilityResponse{}, nil
}
func (s SolidarityTransportServerImpl) AddDriverRegularAvailabilities(ctx context.Context, req *gen.AddDriverRegularAvailabilitiesRequest) (*gen.AddDriverRegularAvailabilitiesResponse, error) {
log.Info().Msg("grpc call - AddDriverRegularAvailabilities")
availabilities := []*types.DriverRegularAvailability{}
for _, a := range req.Availabilities {
if a != nil {
log.Debug().Any("availability", a).Msg("New availability")
na := transformers.DriverRegularAvailabilityProtoToType(a)
availabilities = append(availabilities, na)
}
}
if err := s.Handler.AddDriverRegularAvailabilities(availabilities); err != nil {
log.Error().Err(err).Msg("AddDriverAvailabilities error")
return nil, status.Errorf(codes.Internal, "AddDriverRegularAvailabilities : %v", err)
}
return &gen.AddDriverRegularAvailabilitiesResponse{}, nil
}
func (s SolidarityTransportServerImpl) GetDriverRegularAvailabilities(ctx context.Context, req *gen.GetDriverRegularAvailabilitiesRequest) (*gen.GetDriverRegularAvailabilitiesResponse, error) {
log.Info().Str("driver", req.DriverId).Msg("grpc call - GetDriverRegularAvailabilities")
availabilities, err := s.Handler.GetDriverRegularAvailabilities(req.DriverId)
if err != nil {
log.Error().Err(err).Msg("GetDriverRegularAvailabilities error")
return nil, status.Errorf(codes.Internal, "GetDriverRegularAvailabilities : %v", err)
}
results := []*gen.DriverRegularAvailability{}
log.Debug().Any("availabilities", availabilities).Msg("retrieved availabilities")
for _, a := range availabilities {
if a != nil {
log.Debug().Any("availability", a).Msg("Availability")
protoavailability := transformers.DriverRegularAvailabilityTypeToProto(a)
results = append(results, protoavailability)
}
}
return &gen.GetDriverRegularAvailabilitiesResponse{
Results: results,
}, nil
}
func (s SolidarityTransportServerImpl) DeleteDriverRegularAvailability(ctx context.Context, req *gen.DeleteDriverRegularAvailabilityRequest) (*gen.DeleteDriverRegularAvailabilityResponse, error) {
driverid := req.DriverId
availabilityid := req.AvailabilityId
if err := s.Handler.DeleteDriverRegularAvailabilities(driverid, availabilityid); err != nil {
log.Error().Err(err).Msg("DeleteDriverRegularAvailability error")
return nil, status.Errorf(codes.Internal, "DeleteDriverRegularAvailability error : %v", err)
}
return &gen.DeleteDriverRegularAvailabilityResponse{}, nil
}

View File

@@ -0,0 +1,76 @@
package server
import (
"context"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/transformers"
"github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s SolidarityTransportServerImpl) BookDriverJourney(ctx context.Context, req *gen.BookDriverJourneyRequest) (*gen.BookDriverJourneyResponse, error) {
passengerId := req.PassengerId
driverId := req.DriverId
journeyId := req.DriverJourneyId
if err := s.Handler.BookDriverJourney(passengerId, driverId, journeyId); err != nil {
log.Error().Err(err).Msg("issue in BookDriverJourney handler")
return nil, status.Errorf(codes.Internal, "could not create booking : %v", err)
}
return &gen.BookDriverJourneyResponse{}, nil
}
func (s SolidarityTransportServerImpl) GetSolidarityTransportBookings(ctx context.Context, req *gen.GetSolidarityTransportBookingsRequest) (*gen.GetSolidarityTransportBookingsResponse, error) {
startdate := req.StartDate.AsTime()
enddate := req.EndDate.AsTime()
bookings, err := s.Handler.GetBookings(startdate, enddate)
if err != nil {
log.Error().Err(err).Msg("issue in GetBookings handler")
return nil, status.Errorf(codes.NotFound, "could not get bookings : %v", err)
}
protobookings := []*gen.SolidarityTransportBooking{}
for _, b := range bookings {
protobooking, _ := transformers.BookingTypeToProto(b)
protobookings = append(protobookings, protobooking)
}
return &gen.GetSolidarityTransportBookingsResponse{
Bookings: protobookings,
}, nil
}
func (s SolidarityTransportServerImpl) GetSolidarityTransportBooking(ctx context.Context, req *gen.GetSolidarityTransportBookingRequest) (*gen.GetSolidarityTransportBookingResponse, error) {
bookingid := req.Id
booking, err := s.Handler.GetBooking(bookingid)
if err != nil {
log.Error().Err(err).Msg("issue in GetBooking handler")
return nil, status.Errorf(codes.NotFound, "could not get booking : %v", err)
}
bookingproto, err := transformers.BookingTypeToProto(booking)
if err != nil {
log.Error().Err(err).Msg("issue in GetBooking handler")
return nil, status.Errorf(codes.NotFound, "transformer issue on booking : %v", err)
}
return &gen.GetSolidarityTransportBookingResponse{
Booking: bookingproto,
}, nil
}
func (s SolidarityTransportServerImpl) UpdateSolidarityTransportBookingStatus(ctx context.Context, req *gen.UpdateSolidarityTransportBookingStatusRequest) (*gen.UpdateSolidarityTransportBookingStatusResponse, error) {
bookingid := req.BookingId
newStatus := req.NewStatus
err := s.Handler.UpdateBookingStatus(bookingid, newStatus)
if err != nil {
log.Error().Err(err).Msg("issue in GetBooking handler")
return nil, status.Errorf(codes.NotFound, "transformer issue on booking : %v", err)
}
return &gen.UpdateSolidarityTransportBookingStatusResponse{}, nil
}

View File

@@ -0,0 +1,67 @@
package server
import (
"context"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/transformers"
"github.com/paulmach/orb/geojson"
"github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s SolidarityTransportServerImpl) GetDriverJourneys(ctx context.Context, req *gen.GetDriverJourneysRequest) (*gen.GetDriverJourneysResponse, error) {
departureDate := req.DepartureDate.AsTime()
departure, err := geojson.UnmarshalFeature([]byte(req.Departure.Serialized))
if err != nil {
return nil, status.Errorf(codes.Internal, "departure unmarshalling error: %v", err)
}
arrival, err := geojson.UnmarshalFeature([]byte(req.Arrival.Serialized))
if err != nil {
return nil, status.Errorf(codes.Internal, "arrival unmarhsalling error : %v", err)
}
driverJourneys, err := s.Handler.GetDriverJourneys(departure, arrival, departureDate)
if err != nil {
log.Error().Err(err).Msg("issue in GetDriverJourneys handler")
return nil, status.Errorf(codes.Internal, "could not get driver journeys : %v", err)
}
results := []*gen.SolidarityTransportDriverJourney{}
for _, j := range driverJourneys {
// transformer
dj, err := transformers.DriverJourneyTypeToProto(j)
if err != nil {
log.Error().Err(err).Msg("issue while converting DriverJourney type to protobuf")
continue
// return nil, status.Errorf(codes.Internal, "could not get driver journeys : %v", err)
}
results = append(results, dj)
}
return &gen.GetDriverJourneysResponse{
DriverJourneys: results,
}, nil
}
func (s SolidarityTransportServerImpl) GetDriverJourney(ctx context.Context, req *gen.GetDriverJourneyRequest) (*gen.GetDriverJourneyResponse, error) {
driverid := req.DriverId
journeyid := req.JourneyId
journey, err := s.Handler.GetDriverJourney(driverid, journeyid)
if err != nil {
return nil, status.Errorf(codes.NotFound, "could not get driver journey : %v", err)
}
protojourney, err := transformers.DriverJourneyTypeToProto(journey)
if err != nil {
log.Error().Err(err).Msg("transformation error")
return nil, status.Errorf(codes.NotFound, "transformation error : %v", err)
}
return &gen.GetDriverJourneyResponse{
DriverJourney: protojourney,
}, nil
}

View File

@@ -0,0 +1,50 @@
package server
import (
"fmt"
"net"
"git.coopgo.io/coopgo-platform/solidarity-transport/handler"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
type SolidarityTransportServerImpl struct {
Handler *handler.Handler
gen.UnimplementedSolidarityTransportServer
}
func NewSolidarityTransportServer(handler *handler.Handler) *SolidarityTransportServerImpl {
return &SolidarityTransportServerImpl{
Handler: handler,
}
}
func Run(done chan error, cfg *viper.Viper, handler *handler.Handler) {
var (
dev_env = cfg.GetBool("dev_env")
address = ":" + cfg.GetString("services.grpc.port")
)
server := grpc.NewServer()
gen.RegisterSolidarityTransportServer(server, NewSolidarityTransportServer(handler))
l, err := net.Listen("tcp", address)
if err != nil {
log.Fatal().Err(err).Msg("could not register solidarity transport grpc server")
return
}
if dev_env {
reflection.Register(server)
}
if err := server.Serve(l); err != nil {
fmt.Println("gRPC service ended")
done <- err
}
}

View File

@@ -0,0 +1,34 @@
package transformers
import (
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"git.coopgo.io/coopgo-platform/solidarity-transport/types"
"github.com/paulmach/orb/geojson"
)
func DriverRegularAvailabilityProtoToType(a *gen.DriverRegularAvailability) *types.DriverRegularAvailability {
address, _ := geojson.UnmarshalFeature([]byte(a.Address.Serialized))
return &types.DriverRegularAvailability{
ID: a.Id,
DriverId: a.DriverId,
Day: int(a.Day),
StartTime: a.StartTime,
EndTime: a.EndTime,
Address: address,
}
}
func DriverRegularAvailabilityTypeToProto(a *types.DriverRegularAvailability) *gen.DriverRegularAvailability {
address := []byte("")
if a.Address != nil {
address, _ = a.Address.MarshalJSON()
}
return &gen.DriverRegularAvailability{
Id: a.ID,
Day: int32(a.Day),
DriverId: a.DriverId,
StartTime: a.StartTime,
EndTime: a.EndTime,
Address: &gen.GeoJsonFeature{Serialized: string(address)},
}
}

View File

@@ -0,0 +1,36 @@
package transformers
import (
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"git.coopgo.io/coopgo-platform/solidarity-transport/types"
)
func BookingTypeToProto(booking *types.Booking) (*gen.SolidarityTransportBooking, error) {
journey, err := DriverJourneyTypeToProto(booking.Journey)
if err != nil {
return nil, err
}
return &gen.SolidarityTransportBooking{
Id: booking.Id,
GroupId: booking.GroupId,
DriverId: booking.DriverId,
PassengerId: booking.PassengerId,
Status: booking.Status,
Journey: journey,
}, nil
}
func BookingProtoToType(booking *gen.SolidarityTransportBooking) (*types.Booking, error) {
journey, err := DriverJourneyProtoToType(booking.Journey)
if err != nil {
return nil, err
}
return &types.Booking{
Id: booking.Id,
GroupId: booking.GroupId,
DriverId: booking.DriverId,
PassengerId: booking.PassengerId,
Status: booking.Status,
Journey: journey,
}, nil
}

View File

@@ -0,0 +1,24 @@
package transformers
import (
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"github.com/paulmach/orb/geojson"
)
func GeoJsonToProto(feature *geojson.Feature) (*gen.GeoJsonFeature, error) {
serialized, err := feature.MarshalJSON()
if err != nil {
return nil, err
}
return &gen.GeoJsonFeature{
Serialized: string(serialized),
}, nil
}
func ProtoToGeoJson(feature *gen.GeoJsonFeature) (*geojson.Feature, error) {
gj, err := geojson.UnmarshalFeature([]byte(feature.Serialized))
if err != nil {
return nil, err
}
return gj, err
}

View File

@@ -0,0 +1,100 @@
package transformers
import (
"time"
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
"git.coopgo.io/coopgo-platform/solidarity-transport/types"
"github.com/paulmach/orb/geojson"
"google.golang.org/protobuf/types/known/timestamppb"
)
func DriverJourneyTypeToProto(j *types.DriverJourney) (*gen.SolidarityTransportDriverJourney, error) {
passengerPickup, err := j.PassengerPickup.MarshalJSON()
if err != nil {
return nil, err
}
passengerDrop, err := j.PassengerDrop.MarshalJSON()
if err != nil {
return nil, err
}
driverDeparture, err := j.DriverDeparture.MarshalJSON()
if err != nil {
return nil, err
}
driverArrival, err := j.DriverArrival.MarshalJSON()
if err != nil {
return nil, err
}
return &gen.SolidarityTransportDriverJourney{
Id: j.Id,
DriverId: j.DriverId,
PassengerPickup: &gen.GeoJsonFeature{
Serialized: string(passengerPickup),
},
PassengerDrop: &gen.GeoJsonFeature{
Serialized: string(passengerDrop),
},
PassengerDistance: j.PassengerDistance,
DriverDeparture: &gen.GeoJsonFeature{
Serialized: string(driverDeparture),
},
DriverArrival: &gen.GeoJsonFeature{
Serialized: string(driverArrival),
},
DriverDistance: j.DriverDistance,
Duration: int64(j.Duration.Seconds()),
JourneyPolyline: &j.JourneyPolyline,
DriverDepartureDate: timestamppb.New(j.DriverDepartureDate),
PassengerPickupDate: timestamppb.New(j.PassengerPickupDate),
Price: &gen.SolidarityTransportPrice{
Amount: 0,
Currency: "EUR",
},
}, nil
}
func DriverJourneyProtoToType(j *gen.SolidarityTransportDriverJourney) (*types.DriverJourney, error) {
passengerPickup, err := geojson.UnmarshalFeature([]byte(j.PassengerPickup.Serialized))
if err != nil {
return nil, err
}
passengerDrop, err := geojson.UnmarshalFeature([]byte(j.PassengerDrop.Serialized))
if err != nil {
return nil, err
}
driverDeparture, err := geojson.UnmarshalFeature([]byte(j.DriverDeparture.Serialized))
if err != nil {
return nil, err
}
driverArrival, err := geojson.UnmarshalFeature([]byte(j.DriverArrival.Serialized))
if err != nil {
return nil, err
}
return &types.DriverJourney{
Id: j.Id,
DriverId: j.DriverId,
PassengerPickup: passengerPickup,
PassengerDrop: passengerDrop,
PassengerDistance: j.PassengerDistance,
DriverDeparture: driverDeparture,
DriverArrival: driverArrival,
DriverDistance: j.DriverDistance,
Duration: time.Duration(j.Duration) * time.Second,
JourneyPolyline: *j.JourneyPolyline,
DriverDepartureDate: j.DriverDepartureDate.AsTime(),
PassengerPickupDate: j.PassengerPickupDate.AsTime(),
Price: types.SolidarityTransportPrice{
Amount: j.Price.Amount,
Currency: j.Price.Currency,
},
}, nil
}