diff --git a/grpcapi/agenda.pb.go b/grpcapi/agenda.pb.go index 0e99159..61e8821 100644 --- a/grpcapi/agenda.pb.go +++ b/grpcapi/agenda.pb.go @@ -1,4 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 // source: agenda.proto package grpcapi @@ -9,6 +12,12 @@ import ( structpb "google.golang.org/protobuf/types/known/structpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" math "math" + _struct "github.com/golang/protobuf/ptypes/struct" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) // Reference imports to suppress errors if they are not otherwise used. @@ -263,6 +272,13 @@ type GetEventsRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Namespaces []string `protobuf:"bytes,10,rep,name=namespaces,proto3" json:"namespaces,omitempty"` + Mindate *timestamp.Timestamp `protobuf:"bytes,11,opt,name=mindate,proto3" json:"mindate,omitempty"` + Maxdate *timestamp.Timestamp `protobuf:"bytes,12,opt,name=maxdate,proto3" json:"maxdate,omitempty"` } func (m *GetEventsRequest) Reset() { *m = GetEventsRequest{} } @@ -297,16 +313,16 @@ func (m *GetEventsRequest) GetNamespaces() []string { return nil } -func (m *GetEventsRequest) GetMindate() *timestamppb.Timestamp { - if m != nil { - return m.Mindate +func (x *GetEventsRequest) GetMindate() *timestamp.Timestamp { + if x != nil { + return x.Mindate } return nil } -func (m *GetEventsRequest) GetMaxdate() *timestamppb.Timestamp { - if m != nil { - return m.Maxdate +func (x *GetEventsRequest) GetMaxdate() *timestamp.Timestamp { + if x != nil { + return x.Maxdate } return nil } @@ -357,6 +373,13 @@ type SubscribeEventRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Subscriber string `protobuf:"bytes,20,opt,name=subscriber,proto3" json:"subscriber,omitempty"` + Eventid string `protobuf:"bytes,21,opt,name=eventid,proto3" json:"eventid,omitempty"` + Data *_struct.Struct `protobuf:"bytes,22,opt,name=data,proto3" json:"data,omitempty"` } func (m *SubscribeEventRequest) Reset() { *m = SubscribeEventRequest{} } @@ -401,6 +424,9 @@ func (m *SubscribeEventRequest) GetEventid() string { func (m *SubscribeEventRequest) GetData() *structpb.Struct { if m != nil { return m.Data +func (x *SubscribeEventRequest) GetData() *_struct.Struct { + if x != nil { + return x.Data } return nil } @@ -537,6 +563,195 @@ type DeleteSubscriptionRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` +type UpdateEventRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Event *Event `protobuf:"bytes,32,opt,name=event,proto3" json:"event,omitempty"` +} + +func (x *UpdateEventRequest) Reset() { + *x = UpdateEventRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agenda_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateEventRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateEventRequest) ProtoMessage() {} + +func (x *UpdateEventRequest) ProtoReflect() protoreflect.Message { + mi := &file_agenda_proto_msgTypes[12] + 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 UpdateEventRequest.ProtoReflect.Descriptor instead. +func (*UpdateEventRequest) Descriptor() ([]byte, []int) { + return file_agenda_proto_rawDescGZIP(), []int{12} +} + +func (x *UpdateEventRequest) GetEvent() *Event { + if x != nil { + return x.Event + } + return nil +} + +type UpdateEventResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Event *Event `protobuf:"bytes,33,opt,name=event,proto3" json:"event,omitempty"` +} + +func (x *UpdateEventResponse) Reset() { + *x = UpdateEventResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_agenda_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateEventResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateEventResponse) ProtoMessage() {} + +func (x *UpdateEventResponse) ProtoReflect() protoreflect.Message { + mi := &file_agenda_proto_msgTypes[13] + 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 UpdateEventResponse.ProtoReflect.Descriptor instead. +func (*UpdateEventResponse) Descriptor() ([]byte, []int) { + return file_agenda_proto_rawDescGZIP(), []int{13} +} + +func (x *UpdateEventResponse) GetEvent() *Event { + if x != nil { + return x.Event + } + return nil +} + +var File_agenda_proto protoreflect.FileDescriptor + +var file_agenda_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x61, 0x67, 0x65, 0x6e, 0x64, 0x61, 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, 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, 0x0c, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x32, 0x0a, 0x12, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1c, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x06, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, + 0x33, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x22, 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x30, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x24, 0x0a, 0x12, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, + 0x25, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x07, 0x6d, + 0x69, 0x6e, 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, 0x07, 0x6d, 0x69, 0x6e, 0x64, 0x61, 0x74, + 0x65, 0x12, 0x34, 0x0a, 0x07, 0x6d, 0x61, 0x78, 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, 0x52, 0x07, + 0x6d, 0x61, 0x78, 0x64, 0x61, 0x74, 0x65, 0x22, 0x33, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x06, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x7e, 0x0a, 0x15, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x62, 0x65, 0x72, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x62, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, + 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x12, + 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x16, 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, 0x22, 0x28, 0x0a, 0x16, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x1d, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x53, 0x0a, 0x17, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x72, 0x18, + 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x72, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x18, 0x1f, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x18, 0x55, + 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x27, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x32, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, + 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x33, 0x0a, 0x13, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x06, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x32, 0xb5, 0x03, 0x0a, 0x06, 0x41, 0x67, 0x65, 0x6e, 0x64, 0x61, 0x12, 0x3a, 0x0a, 0x0b, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x13, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x14, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, + 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x3a, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, + 0x13, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x13, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x14, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, + 0x10, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x12, 0x18, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x55, 0x6e, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 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, 0x61, 0x67, 0x65, 0x6e, 0x64, 0x61, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } func (m *DeleteSubscriptionRequest) Reset() { *m = DeleteSubscriptionRequest{} } @@ -560,6 +775,55 @@ func (m *DeleteSubscriptionRequest) XXX_Size() int { } func (m *DeleteSubscriptionRequest) XXX_DiscardUnknown() { xxx_messageInfo_DeleteSubscriptionRequest.DiscardUnknown(m) +var file_agenda_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_agenda_proto_goTypes = []interface{}{ + (*CreateEventRequest)(nil), // 0: CreateEventRequest + (*CreateEventResponse)(nil), // 1: CreateEventResponse + (*GetEventRequest)(nil), // 2: GetEventRequest + (*GetEventResponse)(nil), // 3: GetEventResponse + (*DeleteEventRequest)(nil), // 4: DeleteEventRequest + (*DeleteEventResponse)(nil), // 5: DeleteEventResponse + (*GetEventsRequest)(nil), // 6: GetEventsRequest + (*GetEventsResponse)(nil), // 7: GetEventsResponse + (*SubscribeEventRequest)(nil), // 8: SubscribeEventRequest + (*SubscribeEventResponse)(nil), // 9: SubscribeEventResponse + (*UnsubscribeEventRequest)(nil), // 10: UnsubscribeEventRequest + (*UnsubscribeEventResponse)(nil), // 11: UnsubscribeEventResponse + (*UpdateEventRequest)(nil), // 12: UpdateEventRequest + (*UpdateEventResponse)(nil), // 13: UpdateEventResponse + (*Event)(nil), // 14: Event + (*timestamp.Timestamp)(nil), // 15: google.protobuf.Timestamp + (*_struct.Struct)(nil), // 16: google.protobuf.Struct +} +var file_agenda_proto_depIdxs = []int32{ + 14, // 0: CreateEventRequest.event:type_name -> Event + 14, // 1: CreateEventResponse.event:type_name -> Event + 14, // 2: GetEventResponse.event:type_name -> Event + 15, // 3: GetEventsRequest.mindate:type_name -> google.protobuf.Timestamp + 15, // 4: GetEventsRequest.maxdate:type_name -> google.protobuf.Timestamp + 14, // 5: GetEventsResponse.events:type_name -> Event + 16, // 6: SubscribeEventRequest.data:type_name -> google.protobuf.Struct + 14, // 7: UpdateEventRequest.event:type_name -> Event + 14, // 8: UpdateEventResponse.event:type_name -> Event + 0, // 9: Agenda.CreateEvent:input_type -> CreateEventRequest + 2, // 10: Agenda.GetEvent:input_type -> GetEventRequest + 6, // 11: Agenda.GetEvents:input_type -> GetEventsRequest + 4, // 12: Agenda.DeleteEvent:input_type -> DeleteEventRequest + 12, // 13: Agenda.UpdateEvent:input_type -> UpdateEventRequest + 8, // 14: Agenda.SubscribeEvent:input_type -> SubscribeEventRequest + 10, // 15: Agenda.UnsubscribeEvent:input_type -> UnsubscribeEventRequest + 1, // 16: Agenda.CreateEvent:output_type -> CreateEventResponse + 3, // 17: Agenda.GetEvent:output_type -> GetEventResponse + 7, // 18: Agenda.GetEvents:output_type -> GetEventsResponse + 5, // 19: Agenda.DeleteEvent:output_type -> DeleteEventResponse + 13, // 20: Agenda.UpdateEvent:output_type -> UpdateEventResponse + 9, // 21: Agenda.SubscribeEvent:output_type -> SubscribeEventResponse + 11, // 22: Agenda.UnsubscribeEvent:output_type -> UnsubscribeEventResponse + 16, // [16:23] is the sub-list for method output_type + 9, // [9:16] 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 } var xxx_messageInfo_DeleteSubscriptionRequest proto.InternalMessageInfo @@ -684,4 +948,193 @@ var fileDescriptor_2c165b8e4ed40226 = []byte{ 0x42, 0x84, 0x9e, 0xa0, 0xbe, 0x18, 0xc6, 0xbf, 0x5e, 0x85, 0x73, 0xa6, 0x6e, 0x44, 0xb4, 0x18, 0xc6, 0x9f, 0x81, 0xa1, 0x17, 0x85, 0x33, 0x16, 0xfa, 0xd3, 0x9a, 0x76, 0xd0, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x57, 0xd4, 0x2d, 0xc7, 0x1f, 0x06, 0x00, 0x00, + file_events_proto_init() + if !protoimpl.UnsafeEnabled { + file_agenda_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateEventResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEventResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteEventResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEventsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEventsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeEventResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnsubscribeEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnsubscribeEventResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateEventRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agenda_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateEventResponse); 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_agenda_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_agenda_proto_goTypes, + DependencyIndexes: file_agenda_proto_depIdxs, + MessageInfos: file_agenda_proto_msgTypes, + }.Build() + File_agenda_proto = out.File + file_agenda_proto_rawDesc = nil + file_agenda_proto_goTypes = nil + file_agenda_proto_depIdxs = nil } diff --git a/grpcapi/agenda.proto b/grpcapi/agenda.proto index c97342f..d316ccf 100644 --- a/grpcapi/agenda.proto +++ b/grpcapi/agenda.proto @@ -13,7 +13,7 @@ service Agenda { rpc GetEvent(GetEventRequest) returns (GetEventResponse) {} rpc GetEvents(GetEventsRequest) returns (GetEventsResponse) {} rpc DeleteEvent(DeleteEventRequest) returns (DeleteEventResponse) {} - + rpc UpdateEvent(UpdateEventRequest) returns (UpdateEventResponse) {} rpc SubscribeEvent(SubscribeEventRequest) returns (SubscribeEventResponse) {} rpc UnsubscribeEvent(UnsubscribeEventRequest) returns (UnsubscribeEventResponse) {} rpc DeleteSubscription(DeleteSubscriptionRequest) returns (DeleteSubscriptionResponse) {} @@ -81,4 +81,10 @@ message DeleteSubscriptionRequest { message DeleteSubscriptionResponse { bool ok = 41; +message UpdateEventRequest { + Event event = 32; +} + +message UpdateEventResponse { + Event event = 33; } \ No newline at end of file diff --git a/grpcapi/agenda_grpc.pb.go b/grpcapi/agenda_grpc.pb.go index 000265e..f88a7ac 100644 --- a/grpcapi/agenda_grpc.pb.go +++ b/grpcapi/agenda_grpc.pb.go @@ -2,6 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc v3.21.12 +// - protoc v3.12.4 // source: agenda.proto package grpcapi @@ -26,6 +27,7 @@ type AgendaClient interface { GetEvent(ctx context.Context, in *GetEventRequest, opts ...grpc.CallOption) (*GetEventResponse, error) GetEvents(ctx context.Context, in *GetEventsRequest, opts ...grpc.CallOption) (*GetEventsResponse, error) DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error) + UpdateEvent(ctx context.Context, in *UpdateEventRequest, opts ...grpc.CallOption) (*UpdateEventResponse, error) SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) UnsubscribeEvent(ctx context.Context, in *UnsubscribeEventRequest, opts ...grpc.CallOption) (*UnsubscribeEventResponse, error) DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error) @@ -75,6 +77,15 @@ func (c *agendaClient) DeleteEvent(ctx context.Context, in *DeleteEventRequest, return out, nil } +func (c *agendaClient) UpdateEvent(ctx context.Context, in *UpdateEventRequest, opts ...grpc.CallOption) (*UpdateEventResponse, error) { + out := new(UpdateEventResponse) + err := c.cc.Invoke(ctx, "/Agenda/UpdateEvent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agendaClient) SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) { out := new(SubscribeEventResponse) err := c.cc.Invoke(ctx, "/Agenda/SubscribeEvent", in, out, opts...) @@ -110,6 +121,7 @@ type AgendaServer interface { GetEvent(context.Context, *GetEventRequest) (*GetEventResponse, error) GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error) DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) + UpdateEvent(context.Context, *UpdateEventRequest) (*UpdateEventResponse, error) SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) @@ -132,6 +144,9 @@ func (UnimplementedAgendaServer) GetEvents(context.Context, *GetEventsRequest) ( func (UnimplementedAgendaServer) DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteEvent not implemented") } +func (UnimplementedAgendaServer) UpdateEvent(context.Context, *UpdateEventRequest) (*UpdateEventResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateEvent not implemented") +} func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubscribeEvent not implemented") } @@ -226,6 +241,24 @@ func _Agenda_DeleteEvent_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Agenda_UpdateEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateEventRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgendaServer).UpdateEvent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Agenda/UpdateEvent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgendaServer).UpdateEvent(ctx, req.(*UpdateEventRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agenda_SubscribeEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SubscribeEventRequest) if err := dec(in); err != nil { @@ -303,6 +336,10 @@ var Agenda_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteEvent", Handler: _Agenda_DeleteEvent_Handler, }, + { + MethodName: "UpdateEvent", + Handler: _Agenda_UpdateEvent_Handler, + }, { MethodName: "SubscribeEvent", Handler: _Agenda_SubscribeEvent_Handler, diff --git a/grpcapi/events.go b/grpcapi/events.go index f4c4584..2ceb10f 100644 --- a/grpcapi/events.go +++ b/grpcapi/events.go @@ -28,6 +28,7 @@ func (e Event) ToStorageType() storage.Event { Subscriptions: []storage.Subscription{}, DeletedSubscription: []storage.Subscription{}, Data: map[string]any{}, + Deleted: e.Deleted, } for _, v := range e.Subscriptions { @@ -106,6 +107,7 @@ func EventFromStorageType(event *storage.Event) (*Event, error) { Subscriptions: subscriptions, DeletedSubscription: deletedsubscription, Data: data, + Deleted: event.Deleted, }, nil } diff --git a/grpcapi/events.pb.go b/grpcapi/events.pb.go index 77fbe17..a75a00b 100644 --- a/grpcapi/events.pb.go +++ b/grpcapi/events.pb.go @@ -1,4 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 // source: events.proto package grpcapi @@ -9,6 +12,12 @@ import ( structpb "google.golang.org/protobuf/types/known/structpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" math "math" + _struct "github.com/golang/protobuf/ptypes/struct" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) // Reference imports to suppress errors if they are not otherwise used. @@ -42,6 +51,26 @@ type Event struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` + 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"` + Owners []string `protobuf:"bytes,4,rep,name=owners,proto3" json:"owners,omitempty"` + RestrictedTo []string `protobuf:"bytes,5,rep,name=restricted_to,json=restrictedTo,proto3" json:"restricted_to,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` + Startdate *timestamp.Timestamp `protobuf:"bytes,8,opt,name=startdate,proto3" json:"startdate,omitempty"` + Enddate *timestamp.Timestamp `protobuf:"bytes,9,opt,name=enddate,proto3" json:"enddate,omitempty"` + Allday bool `protobuf:"varint,10,opt,name=allday,proto3" json:"allday,omitempty"` + Starttime string `protobuf:"bytes,11,opt,name=starttime,proto3" json:"starttime,omitempty"` + Endtime string `protobuf:"bytes,12,opt,name=endtime,proto3" json:"endtime,omitempty"` + MaxSubscribers int64 `protobuf:"varint,13,opt,name=max_subscribers,json=maxSubscribers,proto3" json:"max_subscribers,omitempty"` + Subscriptions []*Subscription `protobuf:"bytes,14,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"` + Data *_struct.Struct `protobuf:"bytes,15,opt,name=data,proto3" json:"data,omitempty"` + Deleted bool `protobuf:"varint,16,opt,name=deleted,proto3" json:"deleted,omitempty"` } func (m *Event) Reset() { *m = Event{} } @@ -121,6 +150,9 @@ func (m *Event) GetDescription() string { func (m *Event) GetStartdate() *timestamppb.Timestamp { if m != nil { return m.Startdate +func (x *Event) GetStartdate() *timestamp.Timestamp { + if x != nil { + return x.Startdate } return nil } @@ -128,6 +160,9 @@ func (m *Event) GetStartdate() *timestamppb.Timestamp { func (m *Event) GetEnddate() *timestamppb.Timestamp { if m != nil { return m.Enddate +func (x *Event) GetEnddate() *timestamp.Timestamp { + if x != nil { + return x.Enddate } return nil } @@ -177,10 +212,20 @@ func (m *Event) GetDeletedSubscription() []*Subscription { func (m *Event) GetData() *structpb.Struct { if m != nil { return m.Data +func (x *Event) GetData() *_struct.Struct { + if x != nil { + return x.Data } return nil } +func (x *Event) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + type Subscription struct { Id string `protobuf:"bytes,20,opt,name=id,proto3" json:"id,omitempty"` Subscriber string `protobuf:"bytes,21,opt,name=subscriber,proto3" json:"subscriber,omitempty"` @@ -190,6 +235,15 @@ type Subscription struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,20,opt,name=id,proto3" json:"id,omitempty"` + Subscriber string `protobuf:"bytes,21,opt,name=subscriber,proto3" json:"subscriber,omitempty"` + Tags []string `protobuf:"bytes,22,rep,name=tags,proto3" json:"tags,omitempty"` + Data *_struct.Struct `protobuf:"bytes,23,opt,name=data,proto3" json:"data,omitempty"` + CreatedAt *timestamp.Timestamp `protobuf:"bytes,24,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` } func (m *Subscription) Reset() { *m = Subscription{} } @@ -241,6 +295,9 @@ func (m *Subscription) GetTags() []string { func (m *Subscription) GetData() *structpb.Struct { if m != nil { return m.Data +func (x *Subscription) GetData() *_struct.Struct { + if x != nil { + return x.Data } return nil } @@ -248,6 +305,9 @@ func (m *Subscription) GetData() *structpb.Struct { func (m *Subscription) GetCreatedAt() *timestamppb.Timestamp { if m != nil { return m.CreatedAt +func (x *Subscription) GetCreatedAt() *timestamp.Timestamp { + if x != nil { + return x.CreatedAt } return nil } @@ -255,6 +315,64 @@ func (m *Subscription) GetCreatedAt() *timestamppb.Timestamp { func init() { proto.RegisterType((*Event)(nil), "Event") proto.RegisterType((*Subscription)(nil), "Subscription") +var File_events_proto protoreflect.FileDescriptor + +var file_events_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 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, 0xa1, 0x04, + 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 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, 0x16, 0x0a, 0x06, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x64, 0x5f, + 0x74, 0x6f, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, + 0x63, 0x74, 0x65, 0x64, 0x54, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x09, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x64, 0x61, 0x74, 0x65, 0x18, 0x08, 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, 0x09, 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, 0x16, 0x0a, 0x06, + 0x61, 0x6c, 0x6c, 0x64, 0x61, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x6c, + 0x6c, 0x64, 0x61, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x74, 0x69, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, + 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x72, 0x73, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x62, 0x65, 0x72, 0x73, 0x12, 0x33, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x0f, 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, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x64, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x72, + 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x17, + 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, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x18, 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, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 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, + 0x61, 0x67, 0x65, 0x6e, 0x64, 0x61, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } func init() { @@ -292,4 +410,74 @@ var fileDescriptor_8f22242cb04491f9 = []byte{ 0x36, 0x85, 0x4e, 0x4a, 0x9d, 0xb6, 0xd5, 0x7b, 0x53, 0x09, 0xbc, 0xd3, 0xb6, 0x4e, 0x45, 0xa1, 0x1a, 0x29, 0xd2, 0xc2, 0x9a, 0x5c, 0x98, 0x72, 0x3d, 0xa5, 0x75, 0xd7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xdb, 0xa6, 0x2e, 0x8e, 0x03, 0x00, 0x00, +var file_events_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_events_proto_goTypes = []interface{}{ + (*Event)(nil), // 0: Event + (*Subscription)(nil), // 1: Subscription + (*timestamp.Timestamp)(nil), // 2: google.protobuf.Timestamp + (*_struct.Struct)(nil), // 3: google.protobuf.Struct +} +var file_events_proto_depIdxs = []int32{ + 2, // 0: Event.startdate:type_name -> google.protobuf.Timestamp + 2, // 1: Event.enddate:type_name -> google.protobuf.Timestamp + 1, // 2: Event.subscriptions:type_name -> Subscription + 3, // 3: Event.data:type_name -> google.protobuf.Struct + 3, // 4: Subscription.data:type_name -> google.protobuf.Struct + 2, // 5: Subscription.created_at:type_name -> google.protobuf.Timestamp + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_events_proto_init() } +func file_events_proto_init() { + if File_events_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Subscription); 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_events_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_events_proto_goTypes, + DependencyIndexes: file_events_proto_depIdxs, + MessageInfos: file_events_proto_msgTypes, + }.Build() + File_events_proto = out.File + file_events_proto_rawDesc = nil + file_events_proto_goTypes = nil + file_events_proto_depIdxs = nil } diff --git a/grpcapi/events.proto b/grpcapi/events.proto index c93d675..5f3cd61 100644 --- a/grpcapi/events.proto +++ b/grpcapi/events.proto @@ -22,6 +22,7 @@ message Event { repeated Subscription subscriptions = 14; repeated Subscription deleted_subscription = 16; google.protobuf.Struct data = 15; + bool deleted = 16; } message Subscription { diff --git a/grpcapi/grpcapi.go b/grpcapi/grpcapi.go index bdf176e..bed5594 100644 --- a/grpcapi/grpcapi.go +++ b/grpcapi/grpcapi.go @@ -105,6 +105,23 @@ func (s AgendaServerImpl) DeleteSubscription(ctx context.Context, req *DeleteSub //////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +func (s AgendaServerImpl) UpdateEvent(ctx context.Context, req *UpdateEventRequest) (*UpdateEventResponse, error) { + b := req.Event.ToStorageType() + event, err := s.handler.UpdateEvent(b) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.AlreadyExists, "event update failed : %v", err) + } + response, err := EventFromStorageType(event) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.Internal, "issue while retrieving event : %v", err) + } + return &UpdateEventResponse{Event: response}, nil +} + +////////////////////////////////////////////////////////////////////////////////////////////// func (s AgendaServerImpl) mustEmbedUnimplementedAgendaServer() {} func Run(done chan error, cfg *viper.Viper, handler handlers.AgendaHandler) { diff --git a/handlers/events.go b/handlers/events.go index 5e01d0a..217d03a 100644 --- a/handlers/events.go +++ b/handlers/events.go @@ -90,4 +90,12 @@ func (h AgendaHandler) DeleteSubscription(eventid string, subscriber string, dat } err = h.storage.UpdateSubscription(eventid, subscriber, deletesubscription) return +func (h AgendaHandler) UpdateEvent(event storage.Event) (*storage.Event, error) { + + // Store the account + if err := h.storage.UpdateEvent(event); err != nil { + return nil, err + } + + return &event, nil } diff --git a/storage/events.go b/storage/events.go index 4480c8e..e71aeb0 100644 --- a/storage/events.go +++ b/storage/events.go @@ -3,22 +3,22 @@ package storage import "time" type Event struct { - ID string `json:"id" bson:"_id"` - Namespace string `json:"namespace"` - Owners []string `json:"owners"` - RestrictedTo []string `json:"restricted_to"` - Type string `json:"type"` - Name string `json:"name"` - Description string `json:"description"` - Startdate time.Time `json:"startdate"` - Enddate time.Time `json:"enddate"` - Starttime string `json:"starttime"` - Endtime string `json:"endtime"` - Allday bool `json:"allday"` - MaxSubscribers int64 `json:"max_subscribers"` - Subscriptions []Subscription `json:"subscriptions" bson:"subscriptions,omitempty"` - DeletedSubscription []Subscription `json:"deletedsubscriptions" bson:"deletedsubscriptions,omitempty"` - Data map[string]any `json:"data"` + ID string `json:"id" bson:"_id"` + Namespace string `json:"namespace"` + Owners []string `json:"owners"` + RestrictedTo []string `json:"restricted_to"` + Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` + Startdate time.Time `json:"startdate"` + Enddate time.Time `json:"enddate"` + Starttime string `json:"starttime"` + Endtime string `json:"endtime"` + Allday bool `json:"allday"` + MaxSubscribers int64 `json:"max_subscribers"` + Subscriptions []Subscription `json:"subscriptions" bson:"subscriptions,omitempty"` + Data map[string]any `json:"data"` + Deleted bool `json:"deleted"` } type Subscription struct { diff --git a/storage/mongodb.go b/storage/mongodb.go index 2a4ffff..f17414c 100644 --- a/storage/mongodb.go +++ b/storage/mongodb.go @@ -141,5 +141,12 @@ func (s MongoDBStorage) UpdateSubscription(eventid string, subscriber string, de return er } } +func (s MongoDBStorage) UpdateEvent(event Event) error { + collection := s.Client.Database(s.DbName).Collection(s.Collections["events"]) + if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": event.ID}, event); err != nil { + fmt.Println(err) + return err + } + return nil } diff --git a/storage/storage.go b/storage/storage.go index 1ac6a03..d63710d 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -12,6 +12,7 @@ type Storage interface { GetEvents(namespaces []string) ([]Event, error) AddSubscription(eventid string, subscription Subscription) error UpdateSubscription(eventid string, subscriber string, deletesubscription Subscription) error + UpdateEvent(Event) error } type StorageImpl struct { }