deleted bookings management
Some checks failed
Build and Push Docker Image / build_and_push (push) Has been cancelled

This commit is contained in:
Arnaud Delcasse
2025-10-08 09:27:56 +02:00
parent 708b16343a
commit 5bc6ac0e7b
14 changed files with 573 additions and 940 deletions

View File

@@ -20,6 +20,7 @@ func (v Booking) ToStorageType() storage.Booking {
Unavailablefrom: v.Unavailablefrom.AsTime(),
Unavailableto: v.Unavailableto.AsTime(),
Data: map[string]any{},
Deleted: v.Deleted,
}
for k, d := range v.Data.GetFields() {
@@ -41,7 +42,6 @@ func (v Booking) ToStorageType() storage.Booking {
}
func BookingFromStorageType(booking *storage.Booking) (*Booking, error) {
d, err := sanitizeData(booking.Data)
if err != nil {
return nil, err
@@ -62,6 +62,7 @@ func BookingFromStorageType(booking *storage.Booking) (*Booking, error) {
Unavailablefrom: timestamppb.New(booking.Unavailablefrom),
Unavailableto: timestamppb.New(booking.Unavailableto),
Data: data,
Deleted: booking.Deleted,
}
result.Vehicle, err = VehicleFromStorageType(&booking.Vehicle)

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@ syntax = "proto3";
option go_package = "git.coopgo.io/coopgo-platform/fleets/grpcapi";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
import "vehicles.proto";
@@ -50,6 +51,7 @@ message GetVehiclesRequest {
repeated string administrators = 7;
google.protobuf.Timestamp availability_from = 8;
google.protobuf.Timestamp availability_to = 9;
bool include_deleted = 10;
}
message GetVehiclesResponse {
@@ -90,6 +92,7 @@ message UpdateBookingResponse {
message DeleteBookingRequest {
string id = 15;
google.protobuf.Struct deletion_metadata = 30;
}
message DeleteBookingResponse {
@@ -126,6 +129,7 @@ message GetDriverBookingsResponse {
message GetBookingsRequest {
repeated string namespaces = 27;
bool include_deleted = 29;
}
message GetBookingsResponse {

View File

@@ -1,7 +1,9 @@
//COOPGO Groups Management gRPC service definition
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.31.1
// source: fleets.proto
package grpcapi
@@ -15,8 +17,22 @@ import (
// 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
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Fleets_AddVehicle_FullMethodName = "/Fleets/AddVehicle"
Fleets_GetVehicle_FullMethodName = "/Fleets/GetVehicle"
Fleets_GetVehicles_FullMethodName = "/Fleets/GetVehicles"
Fleets_UpdateVehicle_FullMethodName = "/Fleets/UpdateVehicle"
Fleets_CreateBooking_FullMethodName = "/Fleets/CreateBooking"
Fleets_GetBooking_FullMethodName = "/Fleets/GetBooking"
Fleets_GetBookings_FullMethodName = "/Fleets/GetBookings"
Fleets_GetDriverBookings_FullMethodName = "/Fleets/GetDriverBookings"
Fleets_UpdateBooking_FullMethodName = "/Fleets/UpdateBooking"
Fleets_DeleteBooking_FullMethodName = "/Fleets/DeleteBooking"
Fleets_FindVehicle_FullMethodName = "/Fleets/FindVehicle"
)
// FleetsClient is the client API for Fleets service.
//
@@ -27,14 +43,14 @@ type FleetsClient interface {
GetVehicle(ctx context.Context, in *GetVehicleRequest, opts ...grpc.CallOption) (*GetVehicleResponse, error)
GetVehicles(ctx context.Context, in *GetVehiclesRequest, opts ...grpc.CallOption) (*GetVehiclesResponse, error)
UpdateVehicle(ctx context.Context, in *UpdateVehicleRequest, opts ...grpc.CallOption) (*UpdateVehicleResponse, error)
//Bookings
// 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
// Search / Availabilities
FindVehicle(ctx context.Context, in *FindVehicleRequest, opts ...grpc.CallOption) (*FindVehicleResponse, error)
}
@@ -47,8 +63,9 @@ func NewFleetsClient(cc grpc.ClientConnInterface) FleetsClient {
}
func (c *fleetsClient) AddVehicle(ctx context.Context, in *AddVehicleRequest, opts ...grpc.CallOption) (*AddVehicleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddVehicleResponse)
err := c.cc.Invoke(ctx, "/Fleets/AddVehicle", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_AddVehicle_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -56,8 +73,9 @@ func (c *fleetsClient) AddVehicle(ctx context.Context, in *AddVehicleRequest, op
}
func (c *fleetsClient) GetVehicle(ctx context.Context, in *GetVehicleRequest, opts ...grpc.CallOption) (*GetVehicleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetVehicleResponse)
err := c.cc.Invoke(ctx, "/Fleets/GetVehicle", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_GetVehicle_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -65,8 +83,9 @@ func (c *fleetsClient) GetVehicle(ctx context.Context, in *GetVehicleRequest, op
}
func (c *fleetsClient) GetVehicles(ctx context.Context, in *GetVehiclesRequest, opts ...grpc.CallOption) (*GetVehiclesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetVehiclesResponse)
err := c.cc.Invoke(ctx, "/Fleets/GetVehicles", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_GetVehicles_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -74,8 +93,9 @@ func (c *fleetsClient) GetVehicles(ctx context.Context, in *GetVehiclesRequest,
}
func (c *fleetsClient) UpdateVehicle(ctx context.Context, in *UpdateVehicleRequest, opts ...grpc.CallOption) (*UpdateVehicleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateVehicleResponse)
err := c.cc.Invoke(ctx, "/Fleets/UpdateVehicle", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_UpdateVehicle_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -83,8 +103,9 @@ func (c *fleetsClient) UpdateVehicle(ctx context.Context, in *UpdateVehicleReque
}
func (c *fleetsClient) CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateBookingResponse)
err := c.cc.Invoke(ctx, "/Fleets/CreateBooking", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_CreateBooking_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -92,8 +113,9 @@ func (c *fleetsClient) CreateBooking(ctx context.Context, in *CreateBookingReque
}
func (c *fleetsClient) GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetBookingResponse)
err := c.cc.Invoke(ctx, "/Fleets/GetBooking", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_GetBooking_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -101,8 +123,9 @@ func (c *fleetsClient) GetBooking(ctx context.Context, in *GetBookingRequest, op
}
func (c *fleetsClient) GetBookings(ctx context.Context, in *GetBookingsRequest, opts ...grpc.CallOption) (*GetBookingsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetBookingsResponse)
err := c.cc.Invoke(ctx, "/Fleets/GetBookings", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_GetBookings_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -110,8 +133,9 @@ func (c *fleetsClient) GetBookings(ctx context.Context, in *GetBookingsRequest,
}
func (c *fleetsClient) GetDriverBookings(ctx context.Context, in *GetDriverBookingsRequest, opts ...grpc.CallOption) (*GetDriverBookingsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetDriverBookingsResponse)
err := c.cc.Invoke(ctx, "/Fleets/GetDriverBookings", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_GetDriverBookings_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -119,8 +143,9 @@ func (c *fleetsClient) GetDriverBookings(ctx context.Context, in *GetDriverBooki
}
func (c *fleetsClient) UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateBookingResponse)
err := c.cc.Invoke(ctx, "/Fleets/UpdateBooking", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_UpdateBooking_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -128,8 +153,9 @@ func (c *fleetsClient) UpdateBooking(ctx context.Context, in *UpdateBookingReque
}
func (c *fleetsClient) DeleteBooking(ctx context.Context, in *DeleteBookingRequest, opts ...grpc.CallOption) (*DeleteBookingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteBookingResponse)
err := c.cc.Invoke(ctx, "/Fleets/DeleteBooking", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_DeleteBooking_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -137,8 +163,9 @@ func (c *fleetsClient) DeleteBooking(ctx context.Context, in *DeleteBookingReque
}
func (c *fleetsClient) FindVehicle(ctx context.Context, in *FindVehicleRequest, opts ...grpc.CallOption) (*FindVehicleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FindVehicleResponse)
err := c.cc.Invoke(ctx, "/Fleets/FindVehicle", in, out, opts...)
err := c.cc.Invoke(ctx, Fleets_FindVehicle_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -147,28 +174,31 @@ func (c *fleetsClient) FindVehicle(ctx context.Context, in *FindVehicleRequest,
// FleetsServer is the server API for Fleets service.
// All implementations must embed UnimplementedFleetsServer
// for forward compatibility
// for forward compatibility.
type FleetsServer interface {
// Vehicles management
AddVehicle(context.Context, *AddVehicleRequest) (*AddVehicleResponse, error)
GetVehicle(context.Context, *GetVehicleRequest) (*GetVehicleResponse, error)
GetVehicles(context.Context, *GetVehiclesRequest) (*GetVehiclesResponse, error)
UpdateVehicle(context.Context, *UpdateVehicleRequest) (*UpdateVehicleResponse, error)
//Bookings
// 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
// Search / Availabilities
FindVehicle(context.Context, *FindVehicleRequest) (*FindVehicleResponse, error)
mustEmbedUnimplementedFleetsServer()
}
// UnimplementedFleetsServer must be embedded to have forward compatible implementations.
type UnimplementedFleetsServer struct {
}
// UnimplementedFleetsServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFleetsServer struct{}
func (UnimplementedFleetsServer) AddVehicle(context.Context, *AddVehicleRequest) (*AddVehicleResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddVehicle not implemented")
@@ -204,6 +234,7 @@ func (UnimplementedFleetsServer) FindVehicle(context.Context, *FindVehicleReques
return nil, status.Errorf(codes.Unimplemented, "method FindVehicle not implemented")
}
func (UnimplementedFleetsServer) mustEmbedUnimplementedFleetsServer() {}
func (UnimplementedFleetsServer) testEmbeddedByValue() {}
// UnsafeFleetsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FleetsServer will
@@ -213,6 +244,13 @@ type UnsafeFleetsServer interface {
}
func RegisterFleetsServer(s grpc.ServiceRegistrar, srv FleetsServer) {
// If the following call pancis, it indicates UnimplementedFleetsServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Fleets_ServiceDesc, srv)
}
@@ -226,7 +264,7 @@ func _Fleets_AddVehicle_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/AddVehicle",
FullMethod: Fleets_AddVehicle_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).AddVehicle(ctx, req.(*AddVehicleRequest))
@@ -244,7 +282,7 @@ func _Fleets_GetVehicle_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/GetVehicle",
FullMethod: Fleets_GetVehicle_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).GetVehicle(ctx, req.(*GetVehicleRequest))
@@ -262,7 +300,7 @@ func _Fleets_GetVehicles_Handler(srv interface{}, ctx context.Context, dec func(
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/GetVehicles",
FullMethod: Fleets_GetVehicles_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).GetVehicles(ctx, req.(*GetVehiclesRequest))
@@ -280,7 +318,7 @@ func _Fleets_UpdateVehicle_Handler(srv interface{}, ctx context.Context, dec fun
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/UpdateVehicle",
FullMethod: Fleets_UpdateVehicle_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).UpdateVehicle(ctx, req.(*UpdateVehicleRequest))
@@ -298,7 +336,7 @@ func _Fleets_CreateBooking_Handler(srv interface{}, ctx context.Context, dec fun
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/CreateBooking",
FullMethod: Fleets_CreateBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).CreateBooking(ctx, req.(*CreateBookingRequest))
@@ -316,7 +354,7 @@ func _Fleets_GetBooking_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/GetBooking",
FullMethod: Fleets_GetBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).GetBooking(ctx, req.(*GetBookingRequest))
@@ -334,7 +372,7 @@ func _Fleets_GetBookings_Handler(srv interface{}, ctx context.Context, dec func(
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/GetBookings",
FullMethod: Fleets_GetBookings_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).GetBookings(ctx, req.(*GetBookingsRequest))
@@ -352,7 +390,7 @@ func _Fleets_GetDriverBookings_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/GetDriverBookings",
FullMethod: Fleets_GetDriverBookings_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).GetDriverBookings(ctx, req.(*GetDriverBookingsRequest))
@@ -370,7 +408,7 @@ func _Fleets_UpdateBooking_Handler(srv interface{}, ctx context.Context, dec fun
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/UpdateBooking",
FullMethod: Fleets_UpdateBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).UpdateBooking(ctx, req.(*UpdateBookingRequest))
@@ -388,7 +426,7 @@ func _Fleets_DeleteBooking_Handler(srv interface{}, ctx context.Context, dec fun
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/DeleteBooking",
FullMethod: Fleets_DeleteBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).DeleteBooking(ctx, req.(*DeleteBookingRequest))
@@ -406,7 +444,7 @@ func _Fleets_FindVehicle_Handler(srv interface{}, ctx context.Context, dec func(
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Fleets/FindVehicle",
FullMethod: Fleets_FindVehicle_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FleetsServer).FindVehicle(ctx, req.(*FindVehicleRequest))

View File

@@ -57,6 +57,7 @@ func (s FleetsServerImpl) GetVehicles(ctx context.Context, req *GetVehiclesReque
filter := storage.VehicleFilters{
Types: req.Types,
Administrators: req.Administrators,
IncludeDeleted: req.IncludeDeleted,
}
if req.AvailabilityFrom.IsValid() {
filter.AvailableFrom = req.AvailabilityFrom.AsTime()
@@ -124,9 +125,14 @@ func (s FleetsServerImpl) UpdateBooking(ctx context.Context, req *UpdateBookingR
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 {
var deletionMetadata map[string]any
if req.DeletionMetadata != nil {
deletionMetadata = req.DeletionMetadata.AsMap()
}
if err := s.handler.DeleteBooking(req.Id, deletionMetadata); err != nil {
fmt.Println(err)
return nil, status.Errorf(codes.Internal, "issue while retrieving booking : %v", err)
return nil, status.Errorf(codes.Internal, "issue while deleting booking : %v", err)
}
return &DeleteBookingResponse{

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// protoc-gen-go v1.36.7
// protoc v6.31.1
// source: vehicles.proto
package grpcapi
@@ -13,6 +13,7 @@ import (
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
@@ -23,25 +24,22 @@ const (
)
type Vehicle struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Administrators []string `protobuf:"bytes,4,rep,name=administrators,proto3" json:"administrators,omitempty"`
Data *structpb.Struct `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
Bookings []*Booking `protobuf:"bytes,6,rep,name=bookings,proto3" json:"bookings,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Administrators []string `protobuf:"bytes,4,rep,name=administrators,proto3" json:"administrators,omitempty"`
Data *structpb.Struct `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
Bookings []*Booking `protobuf:"bytes,6,rep,name=bookings,proto3" json:"bookings,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Vehicle) Reset() {
*x = Vehicle{}
if protoimpl.UnsafeEnabled {
mi := &file_vehicles_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_vehicles_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Vehicle) String() string {
@@ -52,7 +50,7 @@ func (*Vehicle) ProtoMessage() {}
func (x *Vehicle) ProtoReflect() protoreflect.Message {
mi := &file_vehicles_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -110,10 +108,7 @@ func (x *Vehicle) GetBookings() []*Booking {
}
type Booking struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Vehicleid string `protobuf:"bytes,2,opt,name=vehicleid,proto3" json:"vehicleid,omitempty"`
Driver string `protobuf:"bytes,3,opt,name=driver,proto3" json:"driver,omitempty"`
@@ -123,15 +118,16 @@ type Booking struct {
Unavailableto *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=unavailableto,proto3" json:"unavailableto,omitempty"`
Data *structpb.Struct `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"`
Vehicle *Vehicle `protobuf:"bytes,9,opt,name=vehicle,proto3" json:"vehicle,omitempty"`
Deleted bool `protobuf:"varint,10,opt,name=deleted,proto3" json:"deleted,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Booking) Reset() {
*x = Booking{}
if protoimpl.UnsafeEnabled {
mi := &file_vehicles_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
mi := &file_vehicles_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Booking) String() string {
@@ -142,7 +138,7 @@ func (*Booking) ProtoMessage() {}
func (x *Booking) ProtoReflect() protoreflect.Message {
mi := &file_vehicles_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -220,72 +216,52 @@ func (x *Booking) GetVehicle() *Vehicle {
return nil
}
func (x *Booking) GetDeleted() bool {
if x != nil {
return x.Deleted
}
return false
}
var File_vehicles_proto protoreflect.FileDescriptor
var file_vehicles_proto_rawDesc = []byte{
0x0a, 0x0e, 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 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,
0xc6, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a,
0x0e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18,
0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72,
0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61,
0x74, 0x61, 0x12, 0x24, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x06,
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, 0x98, 0x03, 0x0a, 0x07, 0x42, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65,
0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x74,
0x61, 0x72, 0x74, 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74,
0x64, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x64, 0x61, 0x74, 0x65, 0x18,
0x05, 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, 0x07, 0x65, 0x6e, 0x64, 0x64, 0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x0f, 0x75, 0x6e,
0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x06, 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,
0x0f, 0x75, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x66, 0x72, 0x6f, 0x6d,
0x12, 0x40, 0x0a, 0x0d, 0x75, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x74,
0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x52, 0x0d, 0x75, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65,
0x74, 0x6f, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12,
0x22, 0x0a, 0x07, 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x08, 0x2e, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x52, 0x07, 0x76, 0x65, 0x68, 0x69,
0x63, 0x6c, 0x65, 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,
}
const file_vehicles_proto_rawDesc = "" +
"\n" +
"\x0evehicles.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc6\x01\n" +
"\aVehicle\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" +
"\tnamespace\x18\x02 \x01(\tR\tnamespace\x12\x12\n" +
"\x04type\x18\x03 \x01(\tR\x04type\x12&\n" +
"\x0eadministrators\x18\x04 \x03(\tR\x0eadministrators\x12+\n" +
"\x04data\x18\x05 \x01(\v2\x17.google.protobuf.StructR\x04data\x12$\n" +
"\bbookings\x18\x06 \x03(\v2\b.BookingR\bbookings\"\xb2\x03\n" +
"\aBooking\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" +
"\tvehicleid\x18\x02 \x01(\tR\tvehicleid\x12\x16\n" +
"\x06driver\x18\x03 \x01(\tR\x06driver\x128\n" +
"\tstartdate\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\tstartdate\x124\n" +
"\aenddate\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\aenddate\x12D\n" +
"\x0funavailablefrom\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\x0funavailablefrom\x12@\n" +
"\runavailableto\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\runavailableto\x12+\n" +
"\x04data\x18\b \x01(\v2\x17.google.protobuf.StructR\x04data\x12\"\n" +
"\avehicle\x18\t \x01(\v2\b.VehicleR\avehicle\x12\x18\n" +
"\adeleted\x18\n" +
" \x01(\bR\adeletedB.Z,git.coopgo.io/coopgo-platform/fleets/grpcapib\x06proto3"
var (
file_vehicles_proto_rawDescOnce sync.Once
file_vehicles_proto_rawDescData = file_vehicles_proto_rawDesc
file_vehicles_proto_rawDescData []byte
)
func file_vehicles_proto_rawDescGZIP() []byte {
file_vehicles_proto_rawDescOnce.Do(func() {
file_vehicles_proto_rawDescData = protoimpl.X.CompressGZIP(file_vehicles_proto_rawDescData)
file_vehicles_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_vehicles_proto_rawDesc), len(file_vehicles_proto_rawDesc)))
})
return file_vehicles_proto_rawDescData
}
var file_vehicles_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_vehicles_proto_goTypes = []interface{}{
var file_vehicles_proto_goTypes = []any{
(*Vehicle)(nil), // 0: Vehicle
(*Booking)(nil), // 1: Booking
(*structpb.Struct)(nil), // 2: google.protobuf.Struct
@@ -312,37 +288,11 @@ func file_vehicles_proto_init() {
if File_vehicles_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_vehicles_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Vehicle); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_vehicles_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Booking); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_vehicles_proto_rawDesc,
RawDescriptor: unsafe.Slice(unsafe.StringData(file_vehicles_proto_rawDesc), len(file_vehicles_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
@@ -353,7 +303,6 @@ func file_vehicles_proto_init() {
MessageInfos: file_vehicles_proto_msgTypes,
}.Build()
File_vehicles_proto = out.File
file_vehicles_proto_rawDesc = nil
file_vehicles_proto_goTypes = nil
file_vehicles_proto_depIdxs = nil
}

View File

@@ -25,4 +25,5 @@ message Booking {
google.protobuf.Struct data = 8;
Vehicle vehicle = 9;
}
bool deleted = 10;
}