Compare commits
	
		
			4 Commits
		
	
	
		
			5feb1b720e
			...
			81b27976f9
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 81b27976f9 | |
|  | 822c053e78 | |
|  | 1ce72b2f88 | |
|  | ffa341b13d | 
							
								
								
									
										1228
									
								
								grpcapi/agenda.pb.go
								
								
								
								
							
							
						
						
									
										1228
									
								
								grpcapi/agenda.pb.go
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -16,6 +16,7 @@ service Agenda { | ||||||
|      |      | ||||||
|     rpc SubscribeEvent(SubscribeEventRequest) returns (SubscribeEventResponse) {} |     rpc SubscribeEvent(SubscribeEventRequest) returns (SubscribeEventResponse) {} | ||||||
|     rpc UnsubscribeEvent(UnsubscribeEventRequest) returns (UnsubscribeEventResponse) {} |     rpc UnsubscribeEvent(UnsubscribeEventRequest) returns (UnsubscribeEventResponse) {} | ||||||
|  |     rpc DeleteSubscription(DeleteSubscriptionRequest) returns (DeleteSubscriptionResponse) {} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| message CreateEventRequest { | message CreateEventRequest { | ||||||
|  | @ -71,3 +72,13 @@ message UnsubscribeEventRequest { | ||||||
| message UnsubscribeEventResponse { | message UnsubscribeEventResponse { | ||||||
|     bool ok = 39; |     bool ok = 39; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | message DeleteSubscriptionRequest { | ||||||
|  |     string subscriber = 32; | ||||||
|  |     string eventid = 33; | ||||||
|  |     google.protobuf.Struct data = 34; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | message DeleteSubscriptionResponse { | ||||||
|  |     bool ok = 41; | ||||||
|  | } | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 | // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 | ||||||
| // versions:
 | // versions:
 | ||||||
| // - protoc-gen-go-grpc v1.2.0
 | // - protoc-gen-go-grpc v1.2.0
 | ||||||
| // - protoc             v3.19.4
 | // - protoc             v3.21.12
 | ||||||
| // source: agenda.proto
 | // source: agenda.proto
 | ||||||
| 
 | 
 | ||||||
| package grpcapi | package grpcapi | ||||||
|  | @ -28,6 +28,7 @@ type AgendaClient interface { | ||||||
| 	DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error) | 	DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error) | ||||||
| 	SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) | 	SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) | ||||||
| 	UnsubscribeEvent(ctx context.Context, in *UnsubscribeEventRequest, opts ...grpc.CallOption) (*UnsubscribeEventResponse, error) | 	UnsubscribeEvent(ctx context.Context, in *UnsubscribeEventRequest, opts ...grpc.CallOption) (*UnsubscribeEventResponse, error) | ||||||
|  | 	DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type agendaClient struct { | type agendaClient struct { | ||||||
|  | @ -92,6 +93,15 @@ func (c *agendaClient) UnsubscribeEvent(ctx context.Context, in *UnsubscribeEven | ||||||
| 	return out, nil | 	return out, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (c *agendaClient) DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error) { | ||||||
|  | 	out := new(DeleteSubscriptionResponse) | ||||||
|  | 	err := c.cc.Invoke(ctx, "/Agenda/DeleteSubscription", in, out, opts...) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return out, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // AgendaServer is the server API for Agenda service.
 | // AgendaServer is the server API for Agenda service.
 | ||||||
| // All implementations must embed UnimplementedAgendaServer
 | // All implementations must embed UnimplementedAgendaServer
 | ||||||
| // for forward compatibility
 | // for forward compatibility
 | ||||||
|  | @ -102,6 +112,7 @@ type AgendaServer interface { | ||||||
| 	DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) | 	DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) | ||||||
| 	SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) | 	SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) | ||||||
| 	UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) | 	UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) | ||||||
|  | 	DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) | ||||||
| 	mustEmbedUnimplementedAgendaServer() | 	mustEmbedUnimplementedAgendaServer() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -127,6 +138,9 @@ func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEvent | ||||||
| func (UnimplementedAgendaServer) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) { | func (UnimplementedAgendaServer) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) { | ||||||
| 	return nil, status.Errorf(codes.Unimplemented, "method UnsubscribeEvent not implemented") | 	return nil, status.Errorf(codes.Unimplemented, "method UnsubscribeEvent not implemented") | ||||||
| } | } | ||||||
|  | func (UnimplementedAgendaServer) DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method DeleteSubscription not implemented") | ||||||
|  | } | ||||||
| func (UnimplementedAgendaServer) mustEmbedUnimplementedAgendaServer() {} | func (UnimplementedAgendaServer) mustEmbedUnimplementedAgendaServer() {} | ||||||
| 
 | 
 | ||||||
| // UnsafeAgendaServer may be embedded to opt out of forward compatibility for this service.
 | // UnsafeAgendaServer may be embedded to opt out of forward compatibility for this service.
 | ||||||
|  | @ -248,6 +262,24 @@ func _Agenda_UnsubscribeEvent_Handler(srv interface{}, ctx context.Context, dec | ||||||
| 	return interceptor(ctx, in, info, handler) | 	return interceptor(ctx, in, info, handler) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func _Agenda_DeleteSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||||
|  | 	in := new(DeleteSubscriptionRequest) | ||||||
|  | 	if err := dec(in); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).DeleteSubscription(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/DeleteSubscription", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).DeleteSubscription(ctx, req.(*DeleteSubscriptionRequest)) | ||||||
|  | 	} | ||||||
|  | 	return interceptor(ctx, in, info, handler) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // Agenda_ServiceDesc is the grpc.ServiceDesc for Agenda service.
 | // Agenda_ServiceDesc is the grpc.ServiceDesc for Agenda service.
 | ||||||
| // It's only intended for direct use with grpc.RegisterService,
 | // It's only intended for direct use with grpc.RegisterService,
 | ||||||
| // and not to be introspected or modified (even as a copy)
 | // and not to be introspected or modified (even as a copy)
 | ||||||
|  | @ -279,6 +311,10 @@ var Agenda_ServiceDesc = grpc.ServiceDesc{ | ||||||
| 			MethodName: "UnsubscribeEvent", | 			MethodName: "UnsubscribeEvent", | ||||||
| 			Handler:    _Agenda_UnsubscribeEvent_Handler, | 			Handler:    _Agenda_UnsubscribeEvent_Handler, | ||||||
| 		}, | 		}, | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "DeleteSubscription", | ||||||
|  | 			Handler:    _Agenda_DeleteSubscription_Handler, | ||||||
|  | 		}, | ||||||
| 	}, | 	}, | ||||||
| 	Streams:  []grpc.StreamDesc{}, | 	Streams:  []grpc.StreamDesc{}, | ||||||
| 	Metadata: "agenda.proto", | 	Metadata: "agenda.proto", | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ func (e Event) ToStorageType() storage.Event { | ||||||
| 		Allday:         e.Allday, | 		Allday:         e.Allday, | ||||||
| 		MaxSubscribers: e.MaxSubscribers, | 		MaxSubscribers: e.MaxSubscribers, | ||||||
| 		Subscriptions:  []storage.Subscription{}, | 		Subscriptions:  []storage.Subscription{}, | ||||||
|  | 		DeletedSubscription: []storage.Subscription{}, | ||||||
| 		Data:           map[string]any{}, | 		Data:           map[string]any{}, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -33,6 +34,10 @@ func (e Event) ToStorageType() storage.Event { | ||||||
| 		event.Subscriptions = append(event.Subscriptions, v.ToStorageType()) | 		event.Subscriptions = append(event.Subscriptions, v.ToStorageType()) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	for _, v := range e.DeletedSubscription { | ||||||
|  | 		event.DeletedSubscription = append(event.DeletedSubscription, v.ToStorageType()) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	for k, d := range e.Data.GetFields() { | 	for k, d := range e.Data.GetFields() { | ||||||
| 		jsondata, err := protojson.Marshal(d) | 		jsondata, err := protojson.Marshal(d) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|  | @ -72,12 +77,18 @@ func EventFromStorageType(event *storage.Event) (*Event, error) { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	subscriptions := []*Subscription{} | 	subscriptions := []*Subscription{} | ||||||
|  | 	deletedsubscription := []*Subscription{} | ||||||
| 
 | 
 | ||||||
| 	for _, v := range event.Subscriptions { | 	for _, v := range event.Subscriptions { | ||||||
| 		sub, _ := SubscriptionFromStorageType(v) | 		sub, _ := SubscriptionFromStorageType(v) | ||||||
| 		subscriptions = append(subscriptions, sub) | 		subscriptions = append(subscriptions, sub) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	for _, v := range event.DeletedSubscription { | ||||||
|  | 		sub, _ := SubscriptionFromStorageType(v) | ||||||
|  | 		deletedsubscription = append(deletedsubscription, sub) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	return &Event{ | 	return &Event{ | ||||||
| 		Id:             event.ID, | 		Id:             event.ID, | ||||||
| 		Namespace:      event.Namespace, | 		Namespace:      event.Namespace, | ||||||
|  | @ -93,6 +104,7 @@ func EventFromStorageType(event *storage.Event) (*Event, error) { | ||||||
| 		Allday:         event.Allday, | 		Allday:         event.Allday, | ||||||
| 		MaxSubscribers: event.MaxSubscribers, | 		MaxSubscribers: event.MaxSubscribers, | ||||||
| 		Subscriptions:  subscriptions, | 		Subscriptions:  subscriptions, | ||||||
|  | 		DeletedSubscription: deletedsubscription, | ||||||
| 		Data:           data, | 		Data:           data, | ||||||
| 	}, nil | 	}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,32 +1,28 @@ | ||||||
| // Code generated by protoc-gen-go. DO NOT EDIT.
 | // Code generated by protoc-gen-go. DO NOT EDIT.
 | ||||||
| // versions:
 |  | ||||||
| // 	protoc-gen-go v1.28.0
 |  | ||||||
| // 	protoc        v3.19.4
 |  | ||||||
| // source: events.proto
 | // source: events.proto
 | ||||||
| 
 | 
 | ||||||
| package grpcapi | package grpcapi | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	protoreflect "google.golang.org/protobuf/reflect/protoreflect" | 	fmt "fmt" | ||||||
| 	protoimpl "google.golang.org/protobuf/runtime/protoimpl" | 	proto "github.com/golang/protobuf/proto" | ||||||
| 	structpb "google.golang.org/protobuf/types/known/structpb" | 	structpb "google.golang.org/protobuf/types/known/structpb" | ||||||
| 	timestamppb "google.golang.org/protobuf/types/known/timestamppb" | 	timestamppb "google.golang.org/protobuf/types/known/timestamppb" | ||||||
| 	reflect "reflect" | 	math "math" | ||||||
| 	sync "sync" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const ( | // Reference imports to suppress errors if they are not otherwise used.
 | ||||||
| 	// Verify that this generated code is sufficiently up-to-date.
 | var _ = proto.Marshal | ||||||
| 	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) | var _ = fmt.Errorf | ||||||
| 	// Verify that runtime/protoimpl is sufficiently up-to-date.
 | var _ = math.Inf | ||||||
| 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) | 
 | ||||||
| ) | // This is a compile-time assertion to ensure that this generated file
 | ||||||
|  | // is compatible with the proto package it is being compiled against.
 | ||||||
|  | // A compilation error at this line likely means your copy of the
 | ||||||
|  | // proto package needs to be updated.
 | ||||||
|  | const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
 | ||||||
| 
 | 
 | ||||||
| type Event struct { | type Event struct { | ||||||
| 	state         protoimpl.MessageState |  | ||||||
| 	sizeCache     protoimpl.SizeCache |  | ||||||
| 	unknownFields protoimpl.UnknownFields |  | ||||||
| 
 |  | ||||||
| 	Id                   string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` | 	Id                   string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` | ||||||
| 	Namespace            string                 `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,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"` | 	Type                 string                 `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` | ||||||
|  | @ -41,363 +37,259 @@ type Event struct { | ||||||
| 	Endtime              string                 `protobuf:"bytes,12,opt,name=endtime,proto3" json:"endtime,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"` | 	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"` | 	Subscriptions        []*Subscription        `protobuf:"bytes,14,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"` | ||||||
|  | 	DeletedSubscription  []*Subscription        `protobuf:"bytes,16,rep,name=deleted_subscription,json=deletedSubscription,proto3" json:"deleted_subscription,omitempty"` | ||||||
| 	Data                 *structpb.Struct       `protobuf:"bytes,15,opt,name=data,proto3" json:"data,omitempty"` | 	Data                 *structpb.Struct       `protobuf:"bytes,15,opt,name=data,proto3" json:"data,omitempty"` | ||||||
|  | 	XXX_NoUnkeyedLiteral struct{}               `json:"-"` | ||||||
|  | 	XXX_unrecognized     []byte                 `json:"-"` | ||||||
|  | 	XXX_sizecache        int32                  `json:"-"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) Reset() { | func (m *Event) Reset()         { *m = Event{} } | ||||||
| 	*x = Event{} | func (m *Event) String() string { return proto.CompactTextString(m) } | ||||||
| 	if protoimpl.UnsafeEnabled { |  | ||||||
| 		mi := &file_events_proto_msgTypes[0] |  | ||||||
| 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |  | ||||||
| 		ms.StoreMessageInfo(mi) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (x *Event) String() string { |  | ||||||
| 	return protoimpl.X.MessageStringOf(x) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (*Event) ProtoMessage()    {} | func (*Event) ProtoMessage()    {} | ||||||
| 
 |  | ||||||
| func (x *Event) ProtoReflect() protoreflect.Message { |  | ||||||
| 	mi := &file_events_proto_msgTypes[0] |  | ||||||
| 	if protoimpl.UnsafeEnabled && x != nil { |  | ||||||
| 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |  | ||||||
| 		if ms.LoadMessageInfo() == nil { |  | ||||||
| 			ms.StoreMessageInfo(mi) |  | ||||||
| 		} |  | ||||||
| 		return ms |  | ||||||
| 	} |  | ||||||
| 	return mi.MessageOf(x) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Deprecated: Use Event.ProtoReflect.Descriptor instead.
 |  | ||||||
| func (*Event) Descriptor() ([]byte, []int) { | func (*Event) Descriptor() ([]byte, []int) { | ||||||
| 	return file_events_proto_rawDescGZIP(), []int{0} | 	return fileDescriptor_8f22242cb04491f9, []int{0} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetId() string { | func (m *Event) XXX_Unmarshal(b []byte) error { | ||||||
| 	if x != nil { | 	return xxx_messageInfo_Event.Unmarshal(m, b) | ||||||
| 		return x.Id | } | ||||||
|  | func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||||
|  | 	return xxx_messageInfo_Event.Marshal(b, m, deterministic) | ||||||
|  | } | ||||||
|  | func (m *Event) XXX_Merge(src proto.Message) { | ||||||
|  | 	xxx_messageInfo_Event.Merge(m, src) | ||||||
|  | } | ||||||
|  | func (m *Event) XXX_Size() int { | ||||||
|  | 	return xxx_messageInfo_Event.Size(m) | ||||||
|  | } | ||||||
|  | func (m *Event) XXX_DiscardUnknown() { | ||||||
|  | 	xxx_messageInfo_Event.DiscardUnknown(m) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | var xxx_messageInfo_Event proto.InternalMessageInfo | ||||||
|  | 
 | ||||||
|  | func (m *Event) GetId() string { | ||||||
|  | 	if m != nil { | ||||||
|  | 		return m.Id | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetNamespace() string { | func (m *Event) GetNamespace() string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Namespace | 		return m.Namespace | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetType() string { | func (m *Event) GetType() string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Type | 		return m.Type | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetOwners() []string { | func (m *Event) GetOwners() []string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Owners | 		return m.Owners | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetRestrictedTo() []string { | func (m *Event) GetRestrictedTo() []string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.RestrictedTo | 		return m.RestrictedTo | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetName() string { | func (m *Event) GetName() string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Name | 		return m.Name | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetDescription() string { | func (m *Event) GetDescription() string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Description | 		return m.Description | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetStartdate() *timestamppb.Timestamp { | func (m *Event) GetStartdate() *timestamppb.Timestamp { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Startdate | 		return m.Startdate | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetEnddate() *timestamppb.Timestamp { | func (m *Event) GetEnddate() *timestamppb.Timestamp { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Enddate | 		return m.Enddate | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetAllday() bool { | func (m *Event) GetAllday() bool { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Allday | 		return m.Allday | ||||||
| 	} | 	} | ||||||
| 	return false | 	return false | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetStarttime() string { | func (m *Event) GetStarttime() string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Starttime | 		return m.Starttime | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetEndtime() string { | func (m *Event) GetEndtime() string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Endtime | 		return m.Endtime | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetMaxSubscribers() int64 { | func (m *Event) GetMaxSubscribers() int64 { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.MaxSubscribers | 		return m.MaxSubscribers | ||||||
| 	} | 	} | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetSubscriptions() []*Subscription { | func (m *Event) GetSubscriptions() []*Subscription { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Subscriptions | 		return m.Subscriptions | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Event) GetData() *structpb.Struct { | func (m *Event) GetDeletedSubscription() []*Subscription { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Data | 		return m.DeletedSubscription | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (m *Event) GetData() *structpb.Struct { | ||||||
|  | 	if m != nil { | ||||||
|  | 		return m.Data | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type Subscription struct { | type Subscription struct { | ||||||
| 	state         protoimpl.MessageState |  | ||||||
| 	sizeCache     protoimpl.SizeCache |  | ||||||
| 	unknownFields protoimpl.UnknownFields |  | ||||||
| 
 |  | ||||||
| 	Id                   string                 `protobuf:"bytes,20,opt,name=id,proto3" json:"id,omitempty"` | 	Id                   string                 `protobuf:"bytes,20,opt,name=id,proto3" json:"id,omitempty"` | ||||||
| 	Subscriber           string                 `protobuf:"bytes,21,opt,name=subscriber,proto3" json:"subscriber,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"` | 	Tags                 []string               `protobuf:"bytes,22,rep,name=tags,proto3" json:"tags,omitempty"` | ||||||
| 	Data                 *structpb.Struct       `protobuf:"bytes,23,opt,name=data,proto3" json:"data,omitempty"` | 	Data                 *structpb.Struct       `protobuf:"bytes,23,opt,name=data,proto3" json:"data,omitempty"` | ||||||
| 	CreatedAt            *timestamppb.Timestamp `protobuf:"bytes,24,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` | 	CreatedAt            *timestamppb.Timestamp `protobuf:"bytes,24,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` | ||||||
|  | 	XXX_NoUnkeyedLiteral struct{}               `json:"-"` | ||||||
|  | 	XXX_unrecognized     []byte                 `json:"-"` | ||||||
|  | 	XXX_sizecache        int32                  `json:"-"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Subscription) Reset() { | func (m *Subscription) Reset()         { *m = Subscription{} } | ||||||
| 	*x = Subscription{} | func (m *Subscription) String() string { return proto.CompactTextString(m) } | ||||||
| 	if protoimpl.UnsafeEnabled { |  | ||||||
| 		mi := &file_events_proto_msgTypes[1] |  | ||||||
| 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |  | ||||||
| 		ms.StoreMessageInfo(mi) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (x *Subscription) String() string { |  | ||||||
| 	return protoimpl.X.MessageStringOf(x) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (*Subscription) ProtoMessage()    {} | func (*Subscription) ProtoMessage()    {} | ||||||
| 
 |  | ||||||
| func (x *Subscription) ProtoReflect() protoreflect.Message { |  | ||||||
| 	mi := &file_events_proto_msgTypes[1] |  | ||||||
| 	if protoimpl.UnsafeEnabled && x != nil { |  | ||||||
| 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |  | ||||||
| 		if ms.LoadMessageInfo() == nil { |  | ||||||
| 			ms.StoreMessageInfo(mi) |  | ||||||
| 		} |  | ||||||
| 		return ms |  | ||||||
| 	} |  | ||||||
| 	return mi.MessageOf(x) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Deprecated: Use Subscription.ProtoReflect.Descriptor instead.
 |  | ||||||
| func (*Subscription) Descriptor() ([]byte, []int) { | func (*Subscription) Descriptor() ([]byte, []int) { | ||||||
| 	return file_events_proto_rawDescGZIP(), []int{1} | 	return fileDescriptor_8f22242cb04491f9, []int{1} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Subscription) GetId() string { | func (m *Subscription) XXX_Unmarshal(b []byte) error { | ||||||
| 	if x != nil { | 	return xxx_messageInfo_Subscription.Unmarshal(m, b) | ||||||
| 		return x.Id | } | ||||||
|  | func (m *Subscription) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||||
|  | 	return xxx_messageInfo_Subscription.Marshal(b, m, deterministic) | ||||||
|  | } | ||||||
|  | func (m *Subscription) XXX_Merge(src proto.Message) { | ||||||
|  | 	xxx_messageInfo_Subscription.Merge(m, src) | ||||||
|  | } | ||||||
|  | func (m *Subscription) XXX_Size() int { | ||||||
|  | 	return xxx_messageInfo_Subscription.Size(m) | ||||||
|  | } | ||||||
|  | func (m *Subscription) XXX_DiscardUnknown() { | ||||||
|  | 	xxx_messageInfo_Subscription.DiscardUnknown(m) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | var xxx_messageInfo_Subscription proto.InternalMessageInfo | ||||||
|  | 
 | ||||||
|  | func (m *Subscription) GetId() string { | ||||||
|  | 	if m != nil { | ||||||
|  | 		return m.Id | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Subscription) GetSubscriber() string { | func (m *Subscription) GetSubscriber() string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Subscriber | 		return m.Subscriber | ||||||
| 	} | 	} | ||||||
| 	return "" | 	return "" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Subscription) GetTags() []string { | func (m *Subscription) GetTags() []string { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Tags | 		return m.Tags | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Subscription) GetData() *structpb.Struct { | func (m *Subscription) GetData() *structpb.Struct { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.Data | 		return m.Data | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (x *Subscription) GetCreatedAt() *timestamppb.Timestamp { | func (m *Subscription) GetCreatedAt() *timestamppb.Timestamp { | ||||||
| 	if x != nil { | 	if m != nil { | ||||||
| 		return x.CreatedAt | 		return m.CreatedAt | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var File_events_proto protoreflect.FileDescriptor | func init() { | ||||||
| 
 | 	proto.RegisterType((*Event)(nil), "Event") | ||||||
| var file_events_proto_rawDesc = []byte{ | 	proto.RegisterType((*Subscription)(nil), "Subscription") | ||||||
| 	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, 0x87, 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, 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, |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var ( | func init() { | ||||||
| 	file_events_proto_rawDescOnce sync.Once | 	proto.RegisterFile("events.proto", fileDescriptor_8f22242cb04491f9) | ||||||
| 	file_events_proto_rawDescData = file_events_proto_rawDesc |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| func file_events_proto_rawDescGZIP() []byte { |  | ||||||
| 	file_events_proto_rawDescOnce.Do(func() { |  | ||||||
| 		file_events_proto_rawDescData = protoimpl.X.CompressGZIP(file_events_proto_rawDescData) |  | ||||||
| 	}) |  | ||||||
| 	return file_events_proto_rawDescData |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var file_events_proto_msgTypes = make([]protoimpl.MessageInfo, 2) | var fileDescriptor_8f22242cb04491f9 = []byte{ | ||||||
| var file_events_proto_goTypes = []interface{}{ | 	// 458 bytes of a gzipped FileDescriptorProto
 | ||||||
| 	(*Event)(nil),                 // 0: Event
 | 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4d, 0x6f, 0xd4, 0x30, | ||||||
| 	(*Subscription)(nil),          // 1: Subscription
 | 	0x10, 0x55, 0x76, 0xb7, 0xdb, 0x66, 0xf6, 0xa3, 0xc8, 0x94, 0xd6, 0xaa, 0x2a, 0x88, 0xca, 0x81, | ||||||
| 	(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
 | 	0x48, 0x40, 0x22, 0xb5, 0x1c, 0xe0, 0x06, 0x48, 0xfc, 0x81, 0x6c, 0x4f, 0x5c, 0x2a, 0x6f, 0xec, | ||||||
| 	(*structpb.Struct)(nil),       // 3: google.protobuf.Struct
 | 	0x46, 0x91, 0x92, 0xd8, 0xb2, 0x67, 0xa1, 0xfd, 0x6b, 0xfc, 0x03, 0xfe, 0x15, 0xf2, 0x24, 0xbb, | ||||||
| } | 	0x49, 0x01, 0x69, 0x7b, 0x9b, 0x79, 0xef, 0xcd, 0xd8, 0xef, 0x69, 0x60, 0xae, 0x7e, 0xa8, 0x06, | ||||||
| var file_events_proto_depIdxs = []int32{ | 	0x5d, 0x62, 0xac, 0x46, 0x7d, 0x7e, 0x51, 0x68, 0x5d, 0x54, 0x2a, 0xa5, 0x6e, 0xbd, 0xb9, 0x4b, | ||||||
| 	2, // 0: Event.startdate:type_name -> google.protobuf.Timestamp
 | 	0x1d, 0xda, 0x4d, 0x8e, 0x1d, 0xfb, 0xea, 0x6f, 0x16, 0xcb, 0x5a, 0x39, 0x14, 0xb5, 0x69, 0x05, | ||||||
| 	2, // 1: Event.enddate:type_name -> google.protobuf.Timestamp
 | 	0x97, 0xbf, 0x27, 0x70, 0xf0, 0xcd, 0xef, 0x63, 0x4b, 0x18, 0x95, 0x92, 0x07, 0x51, 0x10, 0x87, | ||||||
| 	1, // 2: Event.subscriptions:type_name -> Subscription
 | 	0xd9, 0xa8, 0x94, 0xec, 0x02, 0xc2, 0x46, 0xd4, 0xca, 0x19, 0x91, 0x2b, 0x3e, 0x22, 0xb8, 0x07, | ||||||
| 	3, // 3: Event.data:type_name -> google.protobuf.Struct
 | 	0x18, 0x83, 0x09, 0x3e, 0x18, 0xc5, 0xc7, 0x44, 0x50, 0xcd, 0x4e, 0x61, 0xaa, 0x7f, 0x36, 0xca, | ||||||
| 	3, // 4: Subscription.data:type_name -> google.protobuf.Struct
 | 	0x3a, 0x3e, 0x89, 0xc6, 0x71, 0x98, 0x75, 0x1d, 0x7b, 0x0d, 0x0b, 0xab, 0x1c, 0xda, 0x32, 0x47, | ||||||
| 	2, // 5: Subscription.created_at:type_name -> google.protobuf.Timestamp
 | 	0x25, 0x6f, 0x51, 0xf3, 0x03, 0xa2, 0xe7, 0x3d, 0x78, 0xa3, 0xfd, 0x42, 0xbf, 0x9d, 0x4f, 0xdb, | ||||||
| 	6, // [6:6] is the sub-list for method output_type
 | 	0x85, 0xbe, 0x66, 0x11, 0xcc, 0xa4, 0x72, 0xb9, 0x2d, 0x0d, 0x96, 0xba, 0xe1, 0x87, 0x44, 0x0d, | ||||||
| 	6, // [6:6] is the sub-list for method input_type
 | 	0x21, 0xf6, 0x11, 0x42, 0x87, 0xc2, 0xa2, 0x14, 0xa8, 0xf8, 0x51, 0x14, 0xc4, 0xb3, 0xab, 0xf3, | ||||||
| 	6, // [6:6] is the sub-list for extension type_name
 | 	0xa4, 0xf5, 0x9c, 0x6c, 0x3d, 0x27, 0x37, 0x5b, 0xcf, 0x59, 0x2f, 0x66, 0x1f, 0xe0, 0x50, 0x35, | ||||||
| 	6, // [6:6] is the sub-list for extension extendee
 | 	0x92, 0xe6, 0xc2, 0xbd, 0x73, 0x5b, 0xa9, 0xb7, 0x28, 0xaa, 0x4a, 0x8a, 0x07, 0x0e, 0x51, 0x10, | ||||||
| 	0, // [0:6] is the sub-list for field type_name
 | 	0x1f, 0x65, 0x5d, 0xe7, 0xc3, 0xa2, 0xd5, 0x3e, 0x5e, 0x3e, 0x6b, 0xc3, 0xda, 0x01, 0x8c, 0xd3, | ||||||
| } | 	0x5b, 0xc4, 0xcd, 0x89, 0xdb, 0xb6, 0xec, 0x0d, 0x1c, 0xd7, 0xe2, 0xfe, 0xd6, 0x6d, 0xd6, 0xde, | ||||||
| 
 | 	0xd3, 0xda, 0x67, 0xb7, 0x88, 0x82, 0x78, 0x9c, 0x2d, 0x6b, 0x71, 0xbf, 0xea, 0x51, 0x76, 0x0d, | ||||||
| func init() { file_events_proto_init() } | 	0x8b, 0x4e, 0x44, 0xc6, 0x1d, 0x5f, 0x46, 0xe3, 0x78, 0x76, 0xb5, 0x48, 0x56, 0x03, 0x34, 0x7b, | ||||||
| func file_events_proto_init() { | 	0xac, 0x61, 0x9f, 0xe1, 0x44, 0xaa, 0x4a, 0xf9, 0xd4, 0x87, 0x04, 0x7f, 0xf6, 0xbf, 0xd9, 0xe7, | ||||||
| 	if File_events_proto != nil { | 	0x9d, 0x74, 0x08, 0xb2, 0xb7, 0x30, 0x91, 0x02, 0x05, 0x3f, 0xa6, 0x88, 0xce, 0xfe, 0x89, 0x68, | ||||||
| 		return | 	0x45, 0xc7, 0x96, 0x91, 0xe8, 0xf2, 0x57, 0x00, 0xf3, 0x47, 0xd3, 0xed, 0x49, 0x9d, 0xec, 0x4e, | ||||||
| 	} | 	0xea, 0x25, 0x40, 0xef, 0x94, 0xbf, 0x20, 0x7c, 0x80, 0xd0, 0x51, 0x89, 0xc2, 0xf1, 0x53, 0xba, | ||||||
| 	if !protoimpl.UnsafeEnabled { | 	0x0f, 0xaa, 0x77, 0x3f, 0x38, 0x7b, 0xc2, 0x0f, 0xd8, 0x27, 0x80, 0xdc, 0x2a, 0xe1, 0x0d, 0x0b, | ||||||
| 		file_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { | 	0xe4, 0x7c, 0xff, 0x3d, 0x74, 0xea, 0x2f, 0xf8, 0x35, 0xf9, 0xfe, 0xae, 0x28, 0x31, 0xc9, 0xb5, | ||||||
| 			switch v := v.(*Event); i { | 	0x36, 0x85, 0x4e, 0x4a, 0x9d, 0xb6, 0xd5, 0x7b, 0x53, 0x09, 0xbc, 0xd3, 0xb6, 0x4e, 0x45, 0xa1, | ||||||
| 			case 0: | 	0x1a, 0x29, 0xd2, 0xc2, 0x9a, 0x5c, 0x98, 0x72, 0x3d, 0xa5, 0x75, 0xd7, 0x7f, 0x02, 0x00, 0x00, | ||||||
| 				return &v.state | 	0xff, 0xff, 0x5f, 0xdb, 0xa6, 0x2e, 0x8e, 0x03, 0x00, 0x00, | ||||||
| 			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 |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -20,6 +20,7 @@ message Event { | ||||||
|     string endtime = 12; |     string endtime = 12; | ||||||
|     int64 max_subscribers = 13; |     int64 max_subscribers = 13; | ||||||
|     repeated Subscription subscriptions = 14; |     repeated Subscription subscriptions = 14; | ||||||
|  |     repeated Subscription deleted_subscription = 16; | ||||||
|     google.protobuf.Struct data = 15; |     google.protobuf.Struct data = 15; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -94,6 +94,17 @@ func (s AgendaServerImpl) SubscribeEvent(ctx context.Context, req *SubscribeEven | ||||||
| func (s AgendaServerImpl) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) { | func (s AgendaServerImpl) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) { | ||||||
| 	return nil, status.Errorf(codes.Unimplemented, "method Unsubscribe not implemented") | 	return nil, status.Errorf(codes.Unimplemented, "method Unsubscribe not implemented") | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | ////////////////////////////////////////////////////////////
 | ||||||
|  | func (s AgendaServerImpl) DeleteSubscription(ctx context.Context, req *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) { | ||||||
|  | 	err := s.handler.DeleteSubscription(req.Eventid, req.Subscriber, req.Data.AsMap()) | ||||||
|  | 	return &DeleteSubscriptionResponse{ | ||||||
|  | 		Ok: err != nil, | ||||||
|  | 	}, err | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ////////////////////////////////////////////////////////////////////
 | ||||||
|  | 
 | ||||||
| func (s AgendaServerImpl) mustEmbedUnimplementedAgendaServer() {} | func (s AgendaServerImpl) mustEmbedUnimplementedAgendaServer() {} | ||||||
| 
 | 
 | ||||||
| func Run(done chan error, cfg *viper.Viper, handler handlers.AgendaHandler) { | func Run(done chan error, cfg *viper.Viper, handler handlers.AgendaHandler) { | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -0,0 +1,321 @@ | ||||||
|  | // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 | ||||||
|  | // versions:
 | ||||||
|  | // - protoc-gen-go-grpc v1.2.0
 | ||||||
|  | // - protoc             v3.12.4
 | ||||||
|  | // source: agenda.proto
 | ||||||
|  | 
 | ||||||
|  | package grpcapi | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	context "context" | ||||||
|  | 	grpc "google.golang.org/grpc" | ||||||
|  | 	codes "google.golang.org/grpc/codes" | ||||||
|  | 	status "google.golang.org/grpc/status" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | // This is a compile-time assertion to ensure that this generated file
 | ||||||
|  | // is compatible with the grpc package it is being compiled against.
 | ||||||
|  | // Requires gRPC-Go v1.32.0 or later.
 | ||||||
|  | const _ = grpc.SupportPackageIsVersion7 | ||||||
|  | 
 | ||||||
|  | // AgendaClient is the client API for Agenda service.
 | ||||||
|  | //
 | ||||||
|  | // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
 | ||||||
|  | type AgendaClient interface { | ||||||
|  | 	CreateEvent(ctx context.Context, in *CreateEventRequest, opts ...grpc.CallOption) (*CreateEventResponse, error) | ||||||
|  | 	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) | ||||||
|  | 	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) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | type agendaClient struct { | ||||||
|  | 	cc grpc.ClientConnInterface | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func NewAgendaClient(cc grpc.ClientConnInterface) AgendaClient { | ||||||
|  | 	return &agendaClient{cc} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (c *agendaClient) CreateEvent(ctx context.Context, in *CreateEventRequest, opts ...grpc.CallOption) (*CreateEventResponse, error) { | ||||||
|  | 	out := new(CreateEventResponse) | ||||||
|  | 	err := c.cc.Invoke(ctx, "/Agenda/CreateEvent", in, out, opts...) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return out, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (c *agendaClient) GetEvent(ctx context.Context, in *GetEventRequest, opts ...grpc.CallOption) (*GetEventResponse, error) { | ||||||
|  | 	out := new(GetEventResponse) | ||||||
|  | 	err := c.cc.Invoke(ctx, "/Agenda/GetEvent", in, out, opts...) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return out, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (c *agendaClient) GetEvents(ctx context.Context, in *GetEventsRequest, opts ...grpc.CallOption) (*GetEventsResponse, error) { | ||||||
|  | 	out := new(GetEventsResponse) | ||||||
|  | 	err := c.cc.Invoke(ctx, "/Agenda/GetEvents", in, out, opts...) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return out, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (c *agendaClient) DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error) { | ||||||
|  | 	out := new(DeleteEventResponse) | ||||||
|  | 	err := c.cc.Invoke(ctx, "/Agenda/DeleteEvent", 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...) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return out, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (c *agendaClient) UnsubscribeEvent(ctx context.Context, in *UnsubscribeEventRequest, opts ...grpc.CallOption) (*UnsubscribeEventResponse, error) { | ||||||
|  | 	out := new(UnsubscribeEventResponse) | ||||||
|  | 	err := c.cc.Invoke(ctx, "/Agenda/UnsubscribeEvent", in, out, opts...) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return out, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (c *agendaClient) DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error) { | ||||||
|  | 	out := new(DeleteSubscriptionResponse) | ||||||
|  | 	err := c.cc.Invoke(ctx, "/Agenda/DeleteSubscription", in, out, opts...) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return out, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // AgendaServer is the server API for Agenda service.
 | ||||||
|  | // All implementations must embed UnimplementedAgendaServer
 | ||||||
|  | // for forward compatibility
 | ||||||
|  | type AgendaServer interface { | ||||||
|  | 	CreateEvent(context.Context, *CreateEventRequest) (*CreateEventResponse, error) | ||||||
|  | 	GetEvent(context.Context, *GetEventRequest) (*GetEventResponse, error) | ||||||
|  | 	GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error) | ||||||
|  | 	DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) | ||||||
|  | 	SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) | ||||||
|  | 	UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) | ||||||
|  | 	DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) | ||||||
|  | 	mustEmbedUnimplementedAgendaServer() | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // UnimplementedAgendaServer must be embedded to have forward compatible implementations.
 | ||||||
|  | type UnimplementedAgendaServer struct { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (UnimplementedAgendaServer) CreateEvent(context.Context, *CreateEventRequest) (*CreateEventResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method CreateEvent not implemented") | ||||||
|  | } | ||||||
|  | func (UnimplementedAgendaServer) GetEvent(context.Context, *GetEventRequest) (*GetEventResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method GetEvent not implemented") | ||||||
|  | } | ||||||
|  | func (UnimplementedAgendaServer) GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method GetEvents not implemented") | ||||||
|  | } | ||||||
|  | func (UnimplementedAgendaServer) DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method DeleteEvent not implemented") | ||||||
|  | } | ||||||
|  | func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method SubscribeEvent not implemented") | ||||||
|  | } | ||||||
|  | func (UnimplementedAgendaServer) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method UnsubscribeEvent not implemented") | ||||||
|  | } | ||||||
|  | func (UnimplementedAgendaServer) DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) { | ||||||
|  | 	return nil, status.Errorf(codes.Unimplemented, "method DeleteSubscription not implemented") | ||||||
|  | } | ||||||
|  | func (UnimplementedAgendaServer) mustEmbedUnimplementedAgendaServer() {} | ||||||
|  | 
 | ||||||
|  | // UnsafeAgendaServer may be embedded to opt out of forward compatibility for this service.
 | ||||||
|  | // Use of this interface is not recommended, as added methods to AgendaServer will
 | ||||||
|  | // result in compilation errors.
 | ||||||
|  | type UnsafeAgendaServer interface { | ||||||
|  | 	mustEmbedUnimplementedAgendaServer() | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func RegisterAgendaServer(s grpc.ServiceRegistrar, srv AgendaServer) { | ||||||
|  | 	s.RegisterService(&Agenda_ServiceDesc, srv) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func _Agenda_CreateEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||||
|  | 	in := new(CreateEventRequest) | ||||||
|  | 	if err := dec(in); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).CreateEvent(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/CreateEvent", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).CreateEvent(ctx, req.(*CreateEventRequest)) | ||||||
|  | 	} | ||||||
|  | 	return interceptor(ctx, in, info, handler) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func _Agenda_GetEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||||
|  | 	in := new(GetEventRequest) | ||||||
|  | 	if err := dec(in); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).GetEvent(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/GetEvent", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).GetEvent(ctx, req.(*GetEventRequest)) | ||||||
|  | 	} | ||||||
|  | 	return interceptor(ctx, in, info, handler) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func _Agenda_GetEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||||
|  | 	in := new(GetEventsRequest) | ||||||
|  | 	if err := dec(in); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).GetEvents(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/GetEvents", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).GetEvents(ctx, req.(*GetEventsRequest)) | ||||||
|  | 	} | ||||||
|  | 	return interceptor(ctx, in, info, handler) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func _Agenda_DeleteEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||||
|  | 	in := new(DeleteEventRequest) | ||||||
|  | 	if err := dec(in); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).DeleteEvent(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/DeleteEvent", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).DeleteEvent(ctx, req.(*DeleteEventRequest)) | ||||||
|  | 	} | ||||||
|  | 	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 { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).SubscribeEvent(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/SubscribeEvent", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).SubscribeEvent(ctx, req.(*SubscribeEventRequest)) | ||||||
|  | 	} | ||||||
|  | 	return interceptor(ctx, in, info, handler) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func _Agenda_UnsubscribeEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||||
|  | 	in := new(UnsubscribeEventRequest) | ||||||
|  | 	if err := dec(in); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).UnsubscribeEvent(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/UnsubscribeEvent", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).UnsubscribeEvent(ctx, req.(*UnsubscribeEventRequest)) | ||||||
|  | 	} | ||||||
|  | 	return interceptor(ctx, in, info, handler) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func _Agenda_DeleteSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||||
|  | 	in := new(DeleteSubscriptionRequest) | ||||||
|  | 	if err := dec(in); err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	if interceptor == nil { | ||||||
|  | 		return srv.(AgendaServer).DeleteSubscription(ctx, in) | ||||||
|  | 	} | ||||||
|  | 	info := &grpc.UnaryServerInfo{ | ||||||
|  | 		Server:     srv, | ||||||
|  | 		FullMethod: "/Agenda/DeleteSubscription", | ||||||
|  | 	} | ||||||
|  | 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||||
|  | 		return srv.(AgendaServer).DeleteSubscription(ctx, req.(*DeleteSubscriptionRequest)) | ||||||
|  | 	} | ||||||
|  | 	return interceptor(ctx, in, info, handler) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // Agenda_ServiceDesc is the grpc.ServiceDesc for Agenda service.
 | ||||||
|  | // It's only intended for direct use with grpc.RegisterService,
 | ||||||
|  | // and not to be introspected or modified (even as a copy)
 | ||||||
|  | var Agenda_ServiceDesc = grpc.ServiceDesc{ | ||||||
|  | 	ServiceName: "Agenda", | ||||||
|  | 	HandlerType: (*AgendaServer)(nil), | ||||||
|  | 	Methods: []grpc.MethodDesc{ | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "CreateEvent", | ||||||
|  | 			Handler:    _Agenda_CreateEvent_Handler, | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "GetEvent", | ||||||
|  | 			Handler:    _Agenda_GetEvent_Handler, | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "GetEvents", | ||||||
|  | 			Handler:    _Agenda_GetEvents_Handler, | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "DeleteEvent", | ||||||
|  | 			Handler:    _Agenda_DeleteEvent_Handler, | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "SubscribeEvent", | ||||||
|  | 			Handler:    _Agenda_SubscribeEvent_Handler, | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "UnsubscribeEvent", | ||||||
|  | 			Handler:    _Agenda_UnsubscribeEvent_Handler, | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			MethodName: "DeleteSubscription", | ||||||
|  | 			Handler:    _Agenda_DeleteSubscription_Handler, | ||||||
|  | 		}, | ||||||
|  | 	}, | ||||||
|  | 	Streams:  []grpc.StreamDesc{}, | ||||||
|  | 	Metadata: "agenda.proto", | ||||||
|  | } | ||||||
|  | @ -70,3 +70,24 @@ func (h AgendaHandler) SubscribeEvent(eventid string, subscriber string, data ma | ||||||
| 	err = h.storage.AddSubscription(eventid, subscription) | 	err = h.storage.AddSubscription(eventid, subscription) | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func (h AgendaHandler) DeleteSubscription(eventid string, subscriber string, data map[string]any) (err error) { | ||||||
|  | 	if eventid == "" || subscriber == "" { | ||||||
|  | 		return errors.New("missing eventid or subscriber") | ||||||
|  | 	} | ||||||
|  | 	now := time.Now() | ||||||
|  | 	id := uuid.NewString() | ||||||
|  | 	deletesubscription := storage.Subscription{ | ||||||
|  | 		ID:         id, | ||||||
|  | 		Subscriber: subscriber, | ||||||
|  | 		Tags:       []string{}, | ||||||
|  | 		CreatedAt:  now, | ||||||
|  | 		Data:       map[string]any{}, | ||||||
|  | 	} | ||||||
|  | 	// Initiate data map
 | ||||||
|  | 	for k, v := range data { | ||||||
|  | 		deletesubscription.Data[k] = v | ||||||
|  | 	} | ||||||
|  | 	err = h.storage.UpdateSubscription(eventid, subscriber, deletesubscription) | ||||||
|  | 	return | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -17,6 +17,7 @@ type Event struct { | ||||||
| 	Allday              bool           `json:"allday"` | 	Allday              bool           `json:"allday"` | ||||||
| 	MaxSubscribers      int64          `json:"max_subscribers"` | 	MaxSubscribers      int64          `json:"max_subscribers"` | ||||||
| 	Subscriptions       []Subscription `json:"subscriptions" bson:"subscriptions,omitempty"` | 	Subscriptions       []Subscription `json:"subscriptions" bson:"subscriptions,omitempty"` | ||||||
|  | 	DeletedSubscription []Subscription `json:"deletedsubscriptions" bson:"deletedsubscriptions,omitempty"` | ||||||
| 	Data                map[string]any `json:"data"` | 	Data                map[string]any `json:"data"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -120,3 +120,26 @@ func (s MongoDBStorage) AddSubscription(eventid string, subscription Subscriptio | ||||||
| 	_, err := collection.UpdateOne(context.TODO(), filter, push) | 	_, err := collection.UpdateOne(context.TODO(), filter, push) | ||||||
| 	return err | 	return err | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func (s MongoDBStorage) UpdateSubscription(eventid string, subscriber string, deletesubscription Subscription) error { | ||||||
|  | 	collection := s.Client.Database(s.DbName).Collection(s.Collections["events"]) | ||||||
|  | 
 | ||||||
|  | 	event := &Event{} | ||||||
|  | 	if errr := collection.FindOne(context.TODO(), bson.M{"_id": eventid}).Decode(event); errr != nil { | ||||||
|  | 		return errr | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	for i := range event.Subscriptions { | ||||||
|  | 		if event.Subscriptions[i].Subscriber == subscriber { | ||||||
|  | 			filter := bson.M{"_id": eventid} | ||||||
|  | 			push := bson.M{"$push": bson.M{"deletedsubscriptions": deletesubscription}} | ||||||
|  | 			pull := bson.M{"$pull": bson.M{"subscriptions": bson.M{"subscriber": subscriber}}} | ||||||
|  | 			_, er := collection.UpdateOne(context.TODO(), filter, push) | ||||||
|  | 			if _, err := collection.UpdateOne(context.TODO(), filter, pull); err != nil { | ||||||
|  | 				return err | ||||||
|  | 			} | ||||||
|  | 			return er | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ type Storage interface { | ||||||
| 	GetEvent(string) (*Event, error) | 	GetEvent(string) (*Event, error) | ||||||
| 	GetEvents(namespaces []string) ([]Event, error) | 	GetEvents(namespaces []string) ([]Event, error) | ||||||
| 	AddSubscription(eventid string, subscription Subscription) error | 	AddSubscription(eventid string, subscription Subscription) error | ||||||
|  | 	UpdateSubscription(eventid string, subscriber string, deletesubscription Subscription) error | ||||||
| } | } | ||||||
| type StorageImpl struct { | type StorageImpl struct { | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue