Small improvements
This commit is contained in:
parent
b9b0c10e1c
commit
be9ee8372f
|
@ -995,6 +995,194 @@ func (x *GetBookingResponse) GetBooking() *Booking {
|
|||
return nil
|
||||
}
|
||||
|
||||
type GetDriverBookingsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Driver string `protobuf:"bytes,25,opt,name=driver,proto3" json:"driver,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetDriverBookingsRequest) Reset() {
|
||||
*x = GetDriverBookingsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_fleets_proto_msgTypes[20]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetDriverBookingsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetDriverBookingsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetDriverBookingsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_fleets_proto_msgTypes[20]
|
||||
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 GetDriverBookingsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetDriverBookingsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_fleets_proto_rawDescGZIP(), []int{20}
|
||||
}
|
||||
|
||||
func (x *GetDriverBookingsRequest) GetDriver() string {
|
||||
if x != nil {
|
||||
return x.Driver
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetDriverBookingsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Bookings []*Booking `protobuf:"bytes,26,rep,name=bookings,proto3" json:"bookings,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetDriverBookingsResponse) Reset() {
|
||||
*x = GetDriverBookingsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_fleets_proto_msgTypes[21]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetDriverBookingsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetDriverBookingsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetDriverBookingsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_fleets_proto_msgTypes[21]
|
||||
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 GetDriverBookingsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetDriverBookingsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_fleets_proto_rawDescGZIP(), []int{21}
|
||||
}
|
||||
|
||||
func (x *GetDriverBookingsResponse) GetBookings() []*Booking {
|
||||
if x != nil {
|
||||
return x.Bookings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetBookingsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Namespaces []string `protobuf:"bytes,27,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetBookingsRequest) Reset() {
|
||||
*x = GetBookingsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_fleets_proto_msgTypes[22]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetBookingsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetBookingsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetBookingsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_fleets_proto_msgTypes[22]
|
||||
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 GetBookingsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetBookingsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_fleets_proto_rawDescGZIP(), []int{22}
|
||||
}
|
||||
|
||||
func (x *GetBookingsRequest) GetNamespaces() []string {
|
||||
if x != nil {
|
||||
return x.Namespaces
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetBookingsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Bookings []*Booking `protobuf:"bytes,28,rep,name=bookings,proto3" json:"bookings,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetBookingsResponse) Reset() {
|
||||
*x = GetBookingsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_fleets_proto_msgTypes[23]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetBookingsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetBookingsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetBookingsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_fleets_proto_msgTypes[23]
|
||||
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 GetBookingsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetBookingsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_fleets_proto_rawDescGZIP(), []int{23}
|
||||
}
|
||||
|
||||
func (x *GetBookingsResponse) GetBookings() []*Booking {
|
||||
if x != nil {
|
||||
return x.Bookings
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_fleets_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_fleets_proto_rawDesc = []byte{
|
||||
|
@ -1082,45 +1270,69 @@ var file_fleets_proto_rawDesc = []byte{
|
|||
0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07,
|
||||
0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e,
|
||||
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
|
||||
0x32, 0xb3, 0x04, 0x0a, 0x06, 0x46, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x0a, 0x41,
|
||||
0x64, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x12, 0x2e, 0x41, 0x64, 0x64, 0x56,
|
||||
0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e,
|
||||
0x41, 0x64, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63,
|
||||
0x6c, 0x65, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69,
|
||||
0x63, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a,
|
||||
0x0b, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x12, 0x13, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x16, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c,
|
||||
0x65, 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, 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, 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, 0x40, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x44, 0x65, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x46, 0x69,
|
||||
0x6e, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x13, 0x2e, 0x46, 0x69, 0x6e, 0x64,
|
||||
0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14,
|
||||
0x2e, 0x46, 0x69, 0x6e, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 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, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x67,
|
||||
0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x22, 0x32, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x42, 0x6f, 0x6f,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x72,
|
||||
0x69, 0x76, 0x65, 0x72, 0x22, 0x41, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65,
|
||||
0x72, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x24, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x1a, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x62,
|
||||
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x34, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x42, 0x6f,
|
||||
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a,
|
||||
0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x1b, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x22, 0x3b, 0x0a,
|
||||
0x13, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73,
|
||||
0x18, 0x1c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
|
||||
0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x32, 0xbd, 0x05, 0x0a, 0x06, 0x46,
|
||||
0x6c, 0x65, 0x65, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x56, 0x65, 0x68, 0x69,
|
||||
0x63, 0x6c, 0x65, 0x12, 0x12, 0x2e, 0x41, 0x64, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x41, 0x64, 0x64, 0x56, 0x65, 0x68,
|
||||
0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37,
|
||||
0x0a, 0x0a, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x12, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x56, 0x65,
|
||||
0x68, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x68, 0x69,
|
||||
0x63, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x65, 0x68,
|
||||
0x69, 0x63, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x65, 0x68,
|
||||
0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x55, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 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, 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, 0x3a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x12,
|
||||
0x13, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
|
||||
0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x11,
|
||||
0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
|
||||
0x73, 0x12, 0x19, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x42, 0x6f, 0x6f,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73,
|
||||
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, 0x40, 0x0a, 0x0d,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a,
|
||||
0x0a, 0x0b, 0x46, 0x69, 0x6e, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x13, 0x2e,
|
||||
0x46, 0x69, 0x6e, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x14, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 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, 0x66, 0x6c, 0x65, 0x65,
|
||||
0x74, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -1135,7 +1347,7 @@ func file_fleets_proto_rawDescGZIP() []byte {
|
|||
return file_fleets_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_fleets_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
|
||||
var file_fleets_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
|
||||
var file_fleets_proto_goTypes = []interface{}{
|
||||
(*AddVehicleRequest)(nil), // 0: AddVehicleRequest
|
||||
(*AddVehicleResponse)(nil), // 1: AddVehicleResponse
|
||||
|
@ -1157,49 +1369,59 @@ var file_fleets_proto_goTypes = []interface{}{
|
|||
(*FindVehicleResponse)(nil), // 17: FindVehicleResponse
|
||||
(*GetBookingRequest)(nil), // 18: GetBookingRequest
|
||||
(*GetBookingResponse)(nil), // 19: GetBookingResponse
|
||||
(*Vehicle)(nil), // 20: Vehicle
|
||||
(*Booking)(nil), // 21: Booking
|
||||
(*timestamppb.Timestamp)(nil), // 22: google.protobuf.Timestamp
|
||||
(*GetDriverBookingsRequest)(nil), // 20: GetDriverBookingsRequest
|
||||
(*GetDriverBookingsResponse)(nil), // 21: GetDriverBookingsResponse
|
||||
(*GetBookingsRequest)(nil), // 22: GetBookingsRequest
|
||||
(*GetBookingsResponse)(nil), // 23: GetBookingsResponse
|
||||
(*Vehicle)(nil), // 24: Vehicle
|
||||
(*Booking)(nil), // 25: Booking
|
||||
(*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp
|
||||
}
|
||||
var file_fleets_proto_depIdxs = []int32{
|
||||
20, // 0: AddVehicleRequest.vehicle:type_name -> Vehicle
|
||||
20, // 1: AddVehicleResponse.vehicle:type_name -> Vehicle
|
||||
20, // 2: GetVehicleResponse.vehicle:type_name -> Vehicle
|
||||
20, // 3: GetVehiclesResponse.vehicles:type_name -> Vehicle
|
||||
20, // 4: GetVehiclesBatchResponse.vehicles:type_name -> Vehicle
|
||||
20, // 5: UpdateVehicleRequest.vehicle:type_name -> Vehicle
|
||||
20, // 6: UpdateVehicleResponse.vehicle:type_name -> Vehicle
|
||||
21, // 7: CreateBookingRequest.booking:type_name -> Booking
|
||||
21, // 8: CreateBookingResponse.booking:type_name -> Booking
|
||||
21, // 9: UpdateBookingRequest.booking:type_name -> Booking
|
||||
21, // 10: UpdateBookingResponse.booking:type_name -> Booking
|
||||
22, // 11: FindVehicleRequest.startdate:type_name -> google.protobuf.Timestamp
|
||||
22, // 12: FindVehicleRequest.enddate:type_name -> google.protobuf.Timestamp
|
||||
20, // 13: FindVehicleResponse.vehicles:type_name -> Vehicle
|
||||
21, // 14: GetBookingResponse.booking:type_name -> Booking
|
||||
0, // 15: Fleets.AddVehicle:input_type -> AddVehicleRequest
|
||||
2, // 16: Fleets.GetVehicle:input_type -> GetVehicleRequest
|
||||
4, // 17: Fleets.GetVehicles:input_type -> GetVehiclesRequest
|
||||
8, // 18: Fleets.UpdateVehicle:input_type -> UpdateVehicleRequest
|
||||
10, // 19: Fleets.CreateBooking:input_type -> CreateBookingRequest
|
||||
18, // 20: Fleets.GetBooking:input_type -> GetBookingRequest
|
||||
12, // 21: Fleets.UpdateBooking:input_type -> UpdateBookingRequest
|
||||
14, // 22: Fleets.DeleteBooking:input_type -> DeleteBookingRequest
|
||||
16, // 23: Fleets.FindVehicle:input_type -> FindVehicleRequest
|
||||
1, // 24: Fleets.AddVehicle:output_type -> AddVehicleResponse
|
||||
3, // 25: Fleets.GetVehicle:output_type -> GetVehicleResponse
|
||||
5, // 26: Fleets.GetVehicles:output_type -> GetVehiclesResponse
|
||||
9, // 27: Fleets.UpdateVehicle:output_type -> UpdateVehicleResponse
|
||||
11, // 28: Fleets.CreateBooking:output_type -> CreateBookingResponse
|
||||
19, // 29: Fleets.GetBooking:output_type -> GetBookingResponse
|
||||
13, // 30: Fleets.UpdateBooking:output_type -> UpdateBookingResponse
|
||||
15, // 31: Fleets.DeleteBooking:output_type -> DeleteBookingResponse
|
||||
17, // 32: Fleets.FindVehicle:output_type -> FindVehicleResponse
|
||||
24, // [24:33] is the sub-list for method output_type
|
||||
15, // [15:24] is the sub-list for method input_type
|
||||
15, // [15:15] is the sub-list for extension type_name
|
||||
15, // [15:15] is the sub-list for extension extendee
|
||||
0, // [0:15] is the sub-list for field type_name
|
||||
24, // 0: AddVehicleRequest.vehicle:type_name -> Vehicle
|
||||
24, // 1: AddVehicleResponse.vehicle:type_name -> Vehicle
|
||||
24, // 2: GetVehicleResponse.vehicle:type_name -> Vehicle
|
||||
24, // 3: GetVehiclesResponse.vehicles:type_name -> Vehicle
|
||||
24, // 4: GetVehiclesBatchResponse.vehicles:type_name -> Vehicle
|
||||
24, // 5: UpdateVehicleRequest.vehicle:type_name -> Vehicle
|
||||
24, // 6: UpdateVehicleResponse.vehicle:type_name -> Vehicle
|
||||
25, // 7: CreateBookingRequest.booking:type_name -> Booking
|
||||
25, // 8: CreateBookingResponse.booking:type_name -> Booking
|
||||
25, // 9: UpdateBookingRequest.booking:type_name -> Booking
|
||||
25, // 10: UpdateBookingResponse.booking:type_name -> Booking
|
||||
26, // 11: FindVehicleRequest.startdate:type_name -> google.protobuf.Timestamp
|
||||
26, // 12: FindVehicleRequest.enddate:type_name -> google.protobuf.Timestamp
|
||||
24, // 13: FindVehicleResponse.vehicles:type_name -> Vehicle
|
||||
25, // 14: GetBookingResponse.booking:type_name -> Booking
|
||||
25, // 15: GetDriverBookingsResponse.bookings:type_name -> Booking
|
||||
25, // 16: GetBookingsResponse.bookings:type_name -> Booking
|
||||
0, // 17: Fleets.AddVehicle:input_type -> AddVehicleRequest
|
||||
2, // 18: Fleets.GetVehicle:input_type -> GetVehicleRequest
|
||||
4, // 19: Fleets.GetVehicles:input_type -> GetVehiclesRequest
|
||||
8, // 20: Fleets.UpdateVehicle:input_type -> UpdateVehicleRequest
|
||||
10, // 21: Fleets.CreateBooking:input_type -> CreateBookingRequest
|
||||
18, // 22: Fleets.GetBooking:input_type -> GetBookingRequest
|
||||
22, // 23: Fleets.GetBookings:input_type -> GetBookingsRequest
|
||||
20, // 24: Fleets.GetDriverBookings:input_type -> GetDriverBookingsRequest
|
||||
12, // 25: Fleets.UpdateBooking:input_type -> UpdateBookingRequest
|
||||
14, // 26: Fleets.DeleteBooking:input_type -> DeleteBookingRequest
|
||||
16, // 27: Fleets.FindVehicle:input_type -> FindVehicleRequest
|
||||
1, // 28: Fleets.AddVehicle:output_type -> AddVehicleResponse
|
||||
3, // 29: Fleets.GetVehicle:output_type -> GetVehicleResponse
|
||||
5, // 30: Fleets.GetVehicles:output_type -> GetVehiclesResponse
|
||||
9, // 31: Fleets.UpdateVehicle:output_type -> UpdateVehicleResponse
|
||||
11, // 32: Fleets.CreateBooking:output_type -> CreateBookingResponse
|
||||
19, // 33: Fleets.GetBooking:output_type -> GetBookingResponse
|
||||
23, // 34: Fleets.GetBookings:output_type -> GetBookingsResponse
|
||||
21, // 35: Fleets.GetDriverBookings:output_type -> GetDriverBookingsResponse
|
||||
13, // 36: Fleets.UpdateBooking:output_type -> UpdateBookingResponse
|
||||
15, // 37: Fleets.DeleteBooking:output_type -> DeleteBookingResponse
|
||||
17, // 38: Fleets.FindVehicle:output_type -> FindVehicleResponse
|
||||
28, // [28:39] is the sub-list for method output_type
|
||||
17, // [17:28] is the sub-list for method input_type
|
||||
17, // [17:17] is the sub-list for extension type_name
|
||||
17, // [17:17] is the sub-list for extension extendee
|
||||
0, // [0:17] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_fleets_proto_init() }
|
||||
|
@ -1449,6 +1671,54 @@ func file_fleets_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_fleets_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetDriverBookingsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_fleets_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetDriverBookingsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_fleets_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetBookingsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_fleets_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetBookingsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
@ -1456,7 +1726,7 @@ func file_fleets_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_fleets_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 20,
|
||||
NumMessages: 24,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
|
|
@ -18,6 +18,8 @@ service Fleets {
|
|||
//Bookings
|
||||
rpc CreateBooking(CreateBookingRequest) returns (CreateBookingResponse) {}
|
||||
rpc GetBooking(GetBookingRequest) returns (GetBookingResponse) {}
|
||||
rpc GetBookings(GetBookingsRequest) returns (GetBookingsResponse) {}
|
||||
rpc GetDriverBookings(GetDriverBookingsRequest) returns (GetDriverBookingsResponse) {}
|
||||
rpc UpdateBooking(UpdateBookingRequest) returns (UpdateBookingResponse) {}
|
||||
rpc DeleteBooking(DeleteBookingRequest) returns (DeleteBookingResponse) {}
|
||||
|
||||
|
@ -109,3 +111,19 @@ message GetBookingRequest {
|
|||
message GetBookingResponse {
|
||||
Booking booking = 24;
|
||||
}
|
||||
|
||||
message GetDriverBookingsRequest {
|
||||
string driver = 25;
|
||||
}
|
||||
|
||||
message GetDriverBookingsResponse {
|
||||
repeated Booking bookings = 26;
|
||||
}
|
||||
|
||||
message GetBookingsRequest {
|
||||
repeated string namespaces = 27;
|
||||
}
|
||||
|
||||
message GetBookingsResponse {
|
||||
repeated Booking bookings = 28;
|
||||
}
|
|
@ -30,6 +30,8 @@ type FleetsClient interface {
|
|||
//Bookings
|
||||
CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error)
|
||||
GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error)
|
||||
GetBookings(ctx context.Context, in *GetBookingsRequest, opts ...grpc.CallOption) (*GetBookingsResponse, error)
|
||||
GetDriverBookings(ctx context.Context, in *GetDriverBookingsRequest, opts ...grpc.CallOption) (*GetDriverBookingsResponse, error)
|
||||
UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error)
|
||||
DeleteBooking(ctx context.Context, in *DeleteBookingRequest, opts ...grpc.CallOption) (*DeleteBookingResponse, error)
|
||||
//Search / Availabilities
|
||||
|
@ -98,6 +100,24 @@ func (c *fleetsClient) GetBooking(ctx context.Context, in *GetBookingRequest, op
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *fleetsClient) GetBookings(ctx context.Context, in *GetBookingsRequest, opts ...grpc.CallOption) (*GetBookingsResponse, error) {
|
||||
out := new(GetBookingsResponse)
|
||||
err := c.cc.Invoke(ctx, "/Fleets/GetBookings", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *fleetsClient) GetDriverBookings(ctx context.Context, in *GetDriverBookingsRequest, opts ...grpc.CallOption) (*GetDriverBookingsResponse, error) {
|
||||
out := new(GetDriverBookingsResponse)
|
||||
err := c.cc.Invoke(ctx, "/Fleets/GetDriverBookings", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *fleetsClient) UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error) {
|
||||
out := new(UpdateBookingResponse)
|
||||
err := c.cc.Invoke(ctx, "/Fleets/UpdateBooking", in, out, opts...)
|
||||
|
@ -137,6 +157,8 @@ type FleetsServer interface {
|
|||
//Bookings
|
||||
CreateBooking(context.Context, *CreateBookingRequest) (*CreateBookingResponse, error)
|
||||
GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error)
|
||||
GetBookings(context.Context, *GetBookingsRequest) (*GetBookingsResponse, error)
|
||||
GetDriverBookings(context.Context, *GetDriverBookingsRequest) (*GetDriverBookingsResponse, error)
|
||||
UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error)
|
||||
DeleteBooking(context.Context, *DeleteBookingRequest) (*DeleteBookingResponse, error)
|
||||
//Search / Availabilities
|
||||
|
@ -166,6 +188,12 @@ func (UnimplementedFleetsServer) CreateBooking(context.Context, *CreateBookingRe
|
|||
func (UnimplementedFleetsServer) GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBooking not implemented")
|
||||
}
|
||||
func (UnimplementedFleetsServer) GetBookings(context.Context, *GetBookingsRequest) (*GetBookingsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBookings not implemented")
|
||||
}
|
||||
func (UnimplementedFleetsServer) GetDriverBookings(context.Context, *GetDriverBookingsRequest) (*GetDriverBookingsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetDriverBookings not implemented")
|
||||
}
|
||||
func (UnimplementedFleetsServer) UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateBooking not implemented")
|
||||
}
|
||||
|
@ -296,6 +324,42 @@ func _Fleets_GetBooking_Handler(srv interface{}, ctx context.Context, dec func(i
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Fleets_GetBookings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBookingsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FleetsServer).GetBookings(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Fleets/GetBookings",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FleetsServer).GetBookings(ctx, req.(*GetBookingsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Fleets_GetDriverBookings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetDriverBookingsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FleetsServer).GetDriverBookings(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Fleets/GetDriverBookings",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FleetsServer).GetDriverBookings(ctx, req.(*GetDriverBookingsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Fleets_UpdateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateBookingRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -381,6 +445,14 @@ var Fleets_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "GetBooking",
|
||||
Handler: _Fleets_GetBooking_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetBookings",
|
||||
Handler: _Fleets_GetBookings_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetDriverBookings",
|
||||
Handler: _Fleets_GetDriverBookings_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateBooking",
|
||||
Handler: _Fleets_UpdateBooking_Handler,
|
||||
|
|
|
@ -101,8 +101,19 @@ func (s FleetsServerImpl) GetBooking(ctx context.Context, req *GetBookingRequest
|
|||
return &GetBookingResponse{Booking: response}, nil
|
||||
}
|
||||
|
||||
func (s FleetsServerImpl) UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateBooking not implemented")
|
||||
func (s FleetsServerImpl) UpdateBooking(ctx context.Context, req *UpdateBookingRequest) (*UpdateBookingResponse, error) {
|
||||
b := req.Booking.ToStorageType()
|
||||
booking, err := s.handler.UpdateBooking(b)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return nil, status.Errorf(codes.AlreadyExists, "booking update failed : %v", err)
|
||||
}
|
||||
response, err := BookingFromStorageType(booking)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return nil, status.Errorf(codes.Internal, "issue while retrieving booking : %v", err)
|
||||
}
|
||||
return &UpdateBookingResponse{Booking: response}, nil
|
||||
}
|
||||
func (s FleetsServerImpl) DeleteBooking(ctx context.Context, req *DeleteBookingRequest) (*DeleteBookingResponse, error) {
|
||||
if err := s.handler.DeleteBooking(req.Id); err != nil {
|
||||
|
@ -117,6 +128,38 @@ func (s FleetsServerImpl) DeleteBooking(ctx context.Context, req *DeleteBookingR
|
|||
func (s FleetsServerImpl) FindVehicle(context.Context, *FindVehicleRequest) (*FindVehicleResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindVehicle not implemented")
|
||||
}
|
||||
func (s FleetsServerImpl) GetDriverBookings(ctx context.Context, req *GetDriverBookingsRequest) (*GetDriverBookingsResponse, error) {
|
||||
responses, err := s.handler.GetDriverBookings(req.Driver)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.NotFound, "could not get driver bookings : %v", err)
|
||||
}
|
||||
var bookings []*Booking
|
||||
|
||||
for _, b := range responses {
|
||||
booking, err := BookingFromStorageType(&b)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "could not get booking : %v", err)
|
||||
}
|
||||
bookings = append(bookings, booking)
|
||||
}
|
||||
return &GetDriverBookingsResponse{Bookings: bookings}, nil
|
||||
}
|
||||
func (s FleetsServerImpl) GetBookings(ctx context.Context, req *GetBookingsRequest) (*GetBookingsResponse, error) {
|
||||
responses, err := s.handler.GetBookings()
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.NotFound, "could not get bookings : %v", err)
|
||||
}
|
||||
var bookings []*Booking
|
||||
|
||||
for _, b := range responses {
|
||||
booking, err := BookingFromStorageType(&b)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "could not get booking : %v", err)
|
||||
}
|
||||
bookings = append(bookings, booking)
|
||||
}
|
||||
return &GetBookingsResponse{Bookings: bookings}, nil
|
||||
}
|
||||
func (s FleetsServerImpl) mustEmbedUnimplementedFleetsServer() {}
|
||||
|
||||
func Run(done chan error, cfg *viper.Viper, handler handlers.FleetsHandler) {
|
||||
|
|
|
@ -12,10 +12,6 @@ func (h FleetsHandler) AddBooking(booking storage.Booking) (*storage.Booking, er
|
|||
booking.ID = uuid.NewString()
|
||||
}
|
||||
|
||||
// vehicle.Metadata = map[string]any{
|
||||
// "created": time.Now(),
|
||||
// }
|
||||
|
||||
// Store the account
|
||||
if err := h.storage.CreateBooking(booking); err != nil {
|
||||
return nil, err
|
||||
|
@ -45,11 +41,26 @@ func (h FleetsHandler) GetBooking(id string) (booking *storage.Booking, err erro
|
|||
return
|
||||
}
|
||||
|
||||
func (h FleetsHandler) UpdateBooking(booking storage.Booking) (*storage.Booking, error) {
|
||||
|
||||
// Store the account
|
||||
if err := h.storage.UpdateBooking(booking); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &booking, nil
|
||||
}
|
||||
|
||||
func (h FleetsHandler) DeleteBooking(id string) error {
|
||||
return h.storage.DeleteBooking(id)
|
||||
}
|
||||
|
||||
// func (h FleetsHandler) GetVehicles(namespaces []string) ([]storage.Vehicle, error) {
|
||||
// vehicles, err := h.storage.GetVehicles(namespaces)
|
||||
// return vehicles, err
|
||||
// }
|
||||
func (h FleetsHandler) GetBookings() ([]storage.Booking, error) {
|
||||
bookings, err := h.storage.GetBookings()
|
||||
return bookings, err
|
||||
}
|
||||
|
||||
func (h FleetsHandler) GetDriverBookings(driver string) ([]storage.Booking, error) {
|
||||
bookings, err := h.storage.GetBookingsForDriver(driver)
|
||||
return bookings, err
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package storage
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
|
@ -112,6 +113,16 @@ func (s MongoDBStorage) CreateBooking(booking Booking) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) UpdateBooking(booking Booking) error {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||
if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": booking.ID}, booking); err != nil {
|
||||
fmt.Println(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
func (s MongoDBStorage) GetBooking(id string) (*Booking, error) {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||
|
||||
|
@ -124,6 +135,35 @@ func (s MongoDBStorage) GetBooking(id string) (*Booking, error) {
|
|||
return booking, nil
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) GetBookings() (bookings []Booking, err error) {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||
|
||||
var cur *mongo.Cursor
|
||||
|
||||
findOptions := options.Find()
|
||||
cur, err = collection.Find(context.TODO(), bson.D{}, findOptions)
|
||||
if err != nil {
|
||||
return bookings, err
|
||||
}
|
||||
|
||||
for cur.Next(context.TODO()) {
|
||||
var booking Booking
|
||||
var elem bson.M
|
||||
|
||||
if err := cur.Decode(&elem); err != nil {
|
||||
return bookings, err
|
||||
}
|
||||
|
||||
bsonBytes, _ := bson.Marshal(elem)
|
||||
bson.Unmarshal(bsonBytes, &booking)
|
||||
|
||||
bookings = append(bookings, booking)
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) GetBookingsForVehicle(vehicleid string) (bookings []Booking, err error) {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||
|
||||
|
@ -153,6 +193,35 @@ func (s MongoDBStorage) GetBookingsForVehicle(vehicleid string) (bookings []Book
|
|||
return
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) GetBookingsForDriver(driver string) (bookings []Booking, err error) {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||
|
||||
var cur *mongo.Cursor
|
||||
|
||||
findOptions := options.Find()
|
||||
cur, err = collection.Find(context.TODO(), bson.M{"driver": driver}, findOptions)
|
||||
if err != nil {
|
||||
return bookings, err
|
||||
}
|
||||
|
||||
for cur.Next(context.TODO()) {
|
||||
var booking Booking
|
||||
var elem bson.M
|
||||
|
||||
if err := cur.Decode(&elem); err != nil {
|
||||
return bookings, err
|
||||
}
|
||||
|
||||
bsonBytes, _ := bson.Marshal(elem)
|
||||
bson.Unmarshal(bsonBytes, &booking)
|
||||
|
||||
bookings = append(bookings, booking)
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) DeleteBooking(bookingid string) error {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||
|
||||
|
|
|
@ -14,8 +14,11 @@ type Storage interface {
|
|||
|
||||
//Bookings management
|
||||
CreateBooking(Booking) error
|
||||
UpdateBooking(Booking) error
|
||||
GetBooking(id string) (*Booking, error)
|
||||
GetBookings() ([]Booking, error)
|
||||
GetBookingsForVehicle(vehicleid string) ([]Booking, error)
|
||||
GetBookingsForDriver(driver string) ([]Booking, error)
|
||||
DeleteBooking(id string) error
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue