Compare commits
11 Commits
modifyAnEv
...
97828d895a
| Author | SHA1 | Date | |
|---|---|---|---|
| 97828d895a | |||
|
|
e55cf41e20 | ||
|
|
74fe5f57e3 | ||
|
|
72c292bd47 | ||
|
|
868e1321b7 | ||
|
|
bd480e875a | ||
|
|
3bf6876365 | ||
| 81b27976f9 | |||
| 822c053e78 | |||
|
|
1ce72b2f88 | ||
| ffa341b13d |
4
go.mod
4
go.mod
@@ -3,16 +3,17 @@ module git.coopgo.io/coopgo-platform/agenda
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/spf13/viper v1.12.0
|
||||
go.mongodb.org/mongo-driver v1.10.1
|
||||
google.golang.org/grpc v1.46.2
|
||||
google.golang.org/protobuf v1.28.0
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/klauspost/compress v1.13.6 // indirect
|
||||
@@ -38,7 +39,6 @@ require (
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
|
||||
gopkg.in/ini.v1 v1.66.4 // indirect
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -628,18 +628,128 @@ func (x *UnsubscribeEventResponse) GetOk() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type DeleteSubscriptionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Subscriber string `protobuf:"bytes,32,opt,name=subscriber,proto3" json:"subscriber,omitempty"`
|
||||
Eventid string `protobuf:"bytes,33,opt,name=eventid,proto3" json:"eventid,omitempty"`
|
||||
Data *_struct.Struct `protobuf:"bytes,34,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) Reset() {
|
||||
*x = DeleteSubscriptionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_agenda_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteSubscriptionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) 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 DeleteSubscriptionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteSubscriptionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_agenda_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) GetSubscriber() string {
|
||||
if x != nil {
|
||||
return x.Subscriber
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) GetEventid() string {
|
||||
if x != nil {
|
||||
return x.Eventid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) GetData() *_struct.Struct {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteSubscriptionResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Ok bool `protobuf:"varint,41,opt,name=ok,proto3" json:"ok,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) Reset() {
|
||||
*x = DeleteSubscriptionResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_agenda_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteSubscriptionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) 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 DeleteSubscriptionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteSubscriptionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_agenda_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) GetOk() bool {
|
||||
if x != nil {
|
||||
return x.Ok
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type UpdateEventRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Event *Event `protobuf:"bytes,32,opt,name=event,proto3" json:"event,omitempty"`
|
||||
Event *Event `protobuf:"bytes,52,opt,name=event,proto3" json:"event,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateEventRequest) Reset() {
|
||||
*x = UpdateEventRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_agenda_proto_msgTypes[12]
|
||||
mi := &file_agenda_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -652,7 +762,7 @@ func (x *UpdateEventRequest) String() string {
|
||||
func (*UpdateEventRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateEventRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_agenda_proto_msgTypes[12]
|
||||
mi := &file_agenda_proto_msgTypes[14]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -665,7 +775,7 @@ func (x *UpdateEventRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use UpdateEventRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateEventRequest) Descriptor() ([]byte, []int) {
|
||||
return file_agenda_proto_rawDescGZIP(), []int{12}
|
||||
return file_agenda_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *UpdateEventRequest) GetEvent() *Event {
|
||||
@@ -680,13 +790,13 @@ type UpdateEventResponse struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Event *Event `protobuf:"bytes,33,opt,name=event,proto3" json:"event,omitempty"`
|
||||
Event *Event `protobuf:"bytes,53,opt,name=event,proto3" json:"event,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateEventResponse) Reset() {
|
||||
*x = UpdateEventResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_agenda_proto_msgTypes[13]
|
||||
mi := &file_agenda_proto_msgTypes[15]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -699,7 +809,7 @@ func (x *UpdateEventResponse) String() string {
|
||||
func (*UpdateEventResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateEventResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_agenda_proto_msgTypes[13]
|
||||
mi := &file_agenda_proto_msgTypes[15]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -712,7 +822,7 @@ func (x *UpdateEventResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use UpdateEventResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateEventResponse) Descriptor() ([]byte, []int) {
|
||||
return file_agenda_proto_rawDescGZIP(), []int{13}
|
||||
return file_agenda_proto_rawDescGZIP(), []int{15}
|
||||
}
|
||||
|
||||
func (x *UpdateEventResponse) GetEvent() *Event {
|
||||
@@ -779,44 +889,61 @@ var file_agenda_proto_rawDesc = []byte{
|
||||
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,
|
||||
0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x82, 0x01, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
|
||||
0x62, 0x65, 0x72, 0x18, 0x20, 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, 0x21, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x12,
|
||||
0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x22, 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, 0x2c, 0x0a, 0x1a,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b,
|
||||
0x18, 0x29, 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,
|
||||
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,
|
||||
0x12, 0x1c, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x34, 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, 0x35,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x32, 0x86, 0x04, 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, 0x12, 0x4f, 0x0a, 0x12, 0x44,
|
||||
0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x1a, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 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,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -831,55 +958,60 @@ func file_agenda_proto_rawDescGZIP() []byte {
|
||||
return file_agenda_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_agenda_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_agenda_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
|
||||
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
|
||||
(*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
|
||||
(*DeleteSubscriptionRequest)(nil), // 12: DeleteSubscriptionRequest
|
||||
(*DeleteSubscriptionResponse)(nil), // 13: DeleteSubscriptionResponse
|
||||
(*UpdateEventRequest)(nil), // 14: UpdateEventRequest
|
||||
(*UpdateEventResponse)(nil), // 15: UpdateEventResponse
|
||||
(*Event)(nil), // 16: Event
|
||||
(*timestamp.Timestamp)(nil), // 17: google.protobuf.Timestamp
|
||||
(*_struct.Struct)(nil), // 18: 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
|
||||
16, // 0: CreateEventRequest.event:type_name -> Event
|
||||
16, // 1: CreateEventResponse.event:type_name -> Event
|
||||
16, // 2: GetEventResponse.event:type_name -> Event
|
||||
17, // 3: GetEventsRequest.mindate:type_name -> google.protobuf.Timestamp
|
||||
17, // 4: GetEventsRequest.maxdate:type_name -> google.protobuf.Timestamp
|
||||
16, // 5: GetEventsResponse.events:type_name -> Event
|
||||
18, // 6: SubscribeEventRequest.data:type_name -> google.protobuf.Struct
|
||||
18, // 7: DeleteSubscriptionRequest.data:type_name -> google.protobuf.Struct
|
||||
16, // 8: UpdateEventRequest.event:type_name -> Event
|
||||
16, // 9: UpdateEventResponse.event:type_name -> Event
|
||||
0, // 10: Agenda.CreateEvent:input_type -> CreateEventRequest
|
||||
2, // 11: Agenda.GetEvent:input_type -> GetEventRequest
|
||||
6, // 12: Agenda.GetEvents:input_type -> GetEventsRequest
|
||||
4, // 13: Agenda.DeleteEvent:input_type -> DeleteEventRequest
|
||||
14, // 14: Agenda.UpdateEvent:input_type -> UpdateEventRequest
|
||||
8, // 15: Agenda.SubscribeEvent:input_type -> SubscribeEventRequest
|
||||
10, // 16: Agenda.UnsubscribeEvent:input_type -> UnsubscribeEventRequest
|
||||
12, // 17: Agenda.DeleteSubscription:input_type -> DeleteSubscriptionRequest
|
||||
1, // 18: Agenda.CreateEvent:output_type -> CreateEventResponse
|
||||
3, // 19: Agenda.GetEvent:output_type -> GetEventResponse
|
||||
7, // 20: Agenda.GetEvents:output_type -> GetEventsResponse
|
||||
5, // 21: Agenda.DeleteEvent:output_type -> DeleteEventResponse
|
||||
15, // 22: Agenda.UpdateEvent:output_type -> UpdateEventResponse
|
||||
9, // 23: Agenda.SubscribeEvent:output_type -> SubscribeEventResponse
|
||||
11, // 24: Agenda.UnsubscribeEvent:output_type -> UnsubscribeEventResponse
|
||||
13, // 25: Agenda.DeleteSubscription:output_type -> DeleteSubscriptionResponse
|
||||
18, // [18:26] is the sub-list for method output_type
|
||||
10, // [10:18] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_agenda_proto_init() }
|
||||
@@ -1034,7 +1166,7 @@ func file_agenda_proto_init() {
|
||||
}
|
||||
}
|
||||
file_agenda_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateEventRequest); i {
|
||||
switch v := v.(*DeleteSubscriptionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -1046,6 +1178,30 @@ func file_agenda_proto_init() {
|
||||
}
|
||||
}
|
||||
file_agenda_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteSubscriptionResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_agenda_proto_msgTypes[14].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[15].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateEventResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1064,7 +1220,7 @@ func file_agenda_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_agenda_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 14,
|
||||
NumMessages: 16,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -16,6 +16,7 @@ service Agenda {
|
||||
rpc UpdateEvent(UpdateEventRequest) returns (UpdateEventResponse) {}
|
||||
rpc SubscribeEvent(SubscribeEventRequest) returns (SubscribeEventResponse) {}
|
||||
rpc UnsubscribeEvent(UnsubscribeEventRequest) returns (UnsubscribeEventResponse) {}
|
||||
rpc DeleteSubscription(DeleteSubscriptionRequest) returns (DeleteSubscriptionResponse) {}
|
||||
}
|
||||
|
||||
message CreateEventRequest {
|
||||
@@ -72,10 +73,19 @@ message UnsubscribeEventResponse {
|
||||
bool ok = 39;
|
||||
}
|
||||
|
||||
message DeleteSubscriptionRequest {
|
||||
string subscriber = 32;
|
||||
string eventid = 33;
|
||||
google.protobuf.Struct data = 34;
|
||||
}
|
||||
|
||||
message DeleteSubscriptionResponse {
|
||||
bool ok = 41;
|
||||
}
|
||||
message UpdateEventRequest {
|
||||
Event event = 32;
|
||||
Event event = 52;
|
||||
}
|
||||
|
||||
message UpdateEventResponse {
|
||||
Event event = 33;
|
||||
Event event = 53;
|
||||
}
|
||||
@@ -29,6 +29,7 @@ type AgendaClient interface {
|
||||
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)
|
||||
}
|
||||
|
||||
type agendaClient struct {
|
||||
@@ -102,6 +103,15 @@ func (c *agendaClient) UnsubscribeEvent(ctx context.Context, in *UnsubscribeEven
|
||||
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
|
||||
@@ -113,6 +123,7 @@ type AgendaServer interface {
|
||||
UpdateEvent(context.Context, *UpdateEventRequest) (*UpdateEventResponse, error)
|
||||
SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error)
|
||||
UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error)
|
||||
DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error)
|
||||
mustEmbedUnimplementedAgendaServer()
|
||||
}
|
||||
|
||||
@@ -141,6 +152,9 @@ func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEvent
|
||||
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.
|
||||
@@ -280,6 +294,24 @@ func _Agenda_UnsubscribeEvent_Handler(srv interface{}, ctx context.Context, dec
|
||||
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)
|
||||
@@ -315,6 +347,10 @@ var Agenda_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "UnsubscribeEvent",
|
||||
Handler: _Agenda_UnsubscribeEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteSubscription",
|
||||
Handler: _Agenda_DeleteSubscription_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "agenda.proto",
|
||||
|
||||
@@ -26,6 +26,7 @@ func (e Event) ToStorageType() storage.Event {
|
||||
Allday: e.Allday,
|
||||
MaxSubscribers: e.MaxSubscribers,
|
||||
Subscriptions: []storage.Subscription{},
|
||||
DeletedSubscription: []storage.Subscription{},
|
||||
Data: map[string]any{},
|
||||
Deleted: e.Deleted,
|
||||
}
|
||||
@@ -34,6 +35,10 @@ func (e Event) ToStorageType() storage.Event {
|
||||
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() {
|
||||
jsondata, err := protojson.Marshal(d)
|
||||
if err != nil {
|
||||
@@ -73,12 +78,18 @@ func EventFromStorageType(event *storage.Event) (*Event, error) {
|
||||
}
|
||||
|
||||
subscriptions := []*Subscription{}
|
||||
deletedsubscription := []*Subscription{}
|
||||
|
||||
for _, v := range event.Subscriptions {
|
||||
sub, _ := SubscriptionFromStorageType(v)
|
||||
subscriptions = append(subscriptions, sub)
|
||||
}
|
||||
|
||||
for _, v := range event.DeletedSubscription {
|
||||
sub, _ := SubscriptionFromStorageType(v)
|
||||
deletedsubscription = append(deletedsubscription, sub)
|
||||
}
|
||||
|
||||
return &Event{
|
||||
Id: event.ID,
|
||||
Namespace: event.Namespace,
|
||||
@@ -94,6 +105,7 @@ func EventFromStorageType(event *storage.Event) (*Event, error) {
|
||||
Allday: event.Allday,
|
||||
MaxSubscribers: event.MaxSubscribers,
|
||||
Subscriptions: subscriptions,
|
||||
DeletedSubscription: deletedsubscription,
|
||||
Data: data,
|
||||
Deleted: event.Deleted,
|
||||
}, nil
|
||||
|
||||
@@ -27,22 +27,23 @@ type Event struct {
|
||||
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"`
|
||||
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"`
|
||||
DeletedSubscription []*Subscription `protobuf:"bytes,16,rep,name=deleted_subscription,json=deletedSubscription,proto3" json:"deleted_subscription,omitempty"`
|
||||
Data *_struct.Struct `protobuf:"bytes,15,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Deleted bool `protobuf:"varint,17,opt,name=deleted,proto3" json:"deleted,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Event) Reset() {
|
||||
@@ -175,6 +176,13 @@ func (x *Event) GetSubscriptions() []*Subscription {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Event) GetDeletedSubscription() []*Subscription {
|
||||
if x != nil {
|
||||
return x.DeletedSubscription
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Event) GetData() *_struct.Struct {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
@@ -275,7 +283,7 @@ var file_events_proto_rawDesc = []byte{
|
||||
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,
|
||||
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 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,
|
||||
@@ -305,27 +313,31 @@ var file_events_proto_rawDesc = []byte{
|
||||
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,
|
||||
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, 0x0a, 0x14, 0x64, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63,
|
||||
0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64,
|
||||
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 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, 0x11, 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,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -351,14 +363,15 @@ 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
|
||||
1, // 3: Event.deleted_subscription:type_name -> Subscription
|
||||
3, // 4: Event.data:type_name -> google.protobuf.Struct
|
||||
3, // 5: Subscription.data:type_name -> google.protobuf.Struct
|
||||
2, // 6: Subscription.created_at:type_name -> google.protobuf.Timestamp
|
||||
7, // [7:7] is the sub-list for method output_type
|
||||
7, // [7:7] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_events_proto_init() }
|
||||
|
||||
@@ -20,8 +20,9 @@ message Event {
|
||||
string endtime = 12;
|
||||
int64 max_subscribers = 13;
|
||||
repeated Subscription subscriptions = 14;
|
||||
repeated Subscription deleted_subscription = 16;
|
||||
google.protobuf.Struct data = 15;
|
||||
bool deleted = 16;
|
||||
bool deleted = 17;
|
||||
}
|
||||
|
||||
message Subscription {
|
||||
|
||||
@@ -95,6 +95,16 @@ func (s AgendaServerImpl) UnsubscribeEvent(context.Context, *UnsubscribeEventReq
|
||||
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) UpdateEvent(ctx context.Context, req *UpdateEventRequest) (*UpdateEventResponse, error) {
|
||||
b := req.Event.ToStorageType()
|
||||
|
||||
@@ -71,6 +71,26 @@ func (h AgendaHandler) SubscribeEvent(eventid string, subscriber string, data ma
|
||||
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
|
||||
}
|
||||
func (h AgendaHandler) UpdateEvent(event storage.Event) (*storage.Event, error) {
|
||||
|
||||
// Store the account
|
||||
|
||||
@@ -3,22 +3,23 @@ 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"`
|
||||
Data map[string]any `json:"data"`
|
||||
Deleted bool `json:"deleted"`
|
||||
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"`
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
||||
|
||||
type Subscription struct {
|
||||
|
||||
@@ -121,6 +121,29 @@ func (s MongoDBStorage) AddSubscription(eventid string, subscription Subscriptio
|
||||
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
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -11,6 +11,7 @@ type Storage interface {
|
||||
GetEvent(string) (*Event, error)
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user