Compare commits

...

13 Commits

Author SHA1 Message Date
Arnaud Delcasse ef3add576f merge 2023-03-10 13:19:01 +01:00
soukainna e55cf41e20 add return nil to compile 2023-02-22 14:57:22 +01:00
soukainna 74fe5f57e3 add deleteSub in event struct 2023-02-22 14:56:51 +01:00
soukainna 72c292bd47 fix conflie 2023-02-22 14:56:06 +01:00
soukainna 868e1321b7 add new event proto to fix conflie 2023-02-22 14:55:43 +01:00
soukainna bd480e875a add new proto 2023-02-22 14:54:23 +01:00
soukainna 3bf6876365 Merge branch 'modifyAnEvent' into dev 2023-02-22 14:17:53 +01:00
Nicolas CARON 81b27976f9 delete consol log 2023-02-15 14:25:27 +01:00
Nicolas CARON 822c053e78 edit events proto en events.go for visualize history 2023-02-15 10:14:06 +01:00
soukainna 781ec59472 fix some err 2023-02-03 16:33:00 +01:00
soukainna 1ce72b2f88 add logic to delete and srore sub 2023-02-01 16:04:10 +01:00
Nicolas CARON ffa341b13d init 2023-02-01 10:09:43 +01:00
soukainna 301f636072 add logic to store event modification and deleted event 2023-02-01 09:58:37 +01:00
17 changed files with 2089 additions and 162 deletions

View File

@ -3,7 +3,7 @@ FROM golang:alpine as builder
ARG ACCESS_TOKEN_USR="nothing" ARG ACCESS_TOKEN_USR="nothing"
ARG ACCESS_TOKEN_PWD="nothing" ARG ACCESS_TOKEN_PWD="nothing"
RUN apk add --no-cache ca-certificates tzdata RUN apk add --no-cache ca-certificates tzdata git
WORKDIR / WORKDIR /

8
go.mod
View File

@ -6,11 +6,14 @@ require (
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
github.com/spf13/viper v1.12.0 github.com/spf13/viper v1.12.0
go.mongodb.org/mongo-driver v1.10.1 go.mongodb.org/mongo-driver v1.10.1
google.golang.org/grpc v1.46.2 google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.0 google.golang.org/protobuf v1.28.1
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
) )
require ( require (
git.coopgo.io/coopgo-platform/fleets v0.0.0-20221205162030-cecdcb20e1d5 // indirect
git.coopgo.io/coopgo-platform/groups-management v0.0.0-20221205161801-9705c8d898f0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/golang/protobuf v1.5.2 // indirect github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.1 // indirect github.com/golang/snappy v0.0.1 // indirect
@ -38,7 +41,6 @@ require (
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
gopkg.in/ini.v1 v1.66.4 // 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.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )

8
go.sum
View File

@ -36,6 +36,10 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.coopgo.io/coopgo-platform/fleets v0.0.0-20221205162030-cecdcb20e1d5 h1:HL/M681G9R1ZN8XPp4LvG9hcF20//R9yQmr5cdXwQaM=
git.coopgo.io/coopgo-platform/fleets v0.0.0-20221205162030-cecdcb20e1d5/go.mod h1:s9OIFCNcjBAbBzRNHwoCTYV6kAntPG9CpT3GVweGdTY=
git.coopgo.io/coopgo-platform/groups-management v0.0.0-20221205161801-9705c8d898f0 h1:CnLKO1kzoGtaqPhDqfOX3WPRFRcJVJZdGzPdBE4X//w=
git.coopgo.io/coopgo-platform/groups-management v0.0.0-20221205161801-9705c8d898f0/go.mod h1:lozSy6qlIIYhvKKXscZzz28HAtS0qBDUTv5nofLRmYA=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
@ -502,6 +506,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ=
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w=
google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@ -517,6 +523,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@ -2,17 +2,17 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.0 // protoc-gen-go v1.28.1
// protoc v3.19.4 // protoc v3.12.4
// source: agenda.proto // source: agenda.proto
package grpcapi package grpcapi
import ( import (
_struct "github.com/golang/protobuf/ptypes/struct"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
structpb "google.golang.org/protobuf/types/known/structpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
) )
@ -312,8 +312,8 @@ type GetEventsRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Namespaces []string `protobuf:"bytes,10,rep,name=namespaces,proto3" json:"namespaces,omitempty"` Namespaces []string `protobuf:"bytes,10,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
Mindate *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=mindate,proto3" json:"mindate,omitempty"` Mindate *timestamp.Timestamp `protobuf:"bytes,11,opt,name=mindate,proto3" json:"mindate,omitempty"`
Maxdate *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=maxdate,proto3" json:"maxdate,omitempty"` Maxdate *timestamp.Timestamp `protobuf:"bytes,12,opt,name=maxdate,proto3" json:"maxdate,omitempty"`
} }
func (x *GetEventsRequest) Reset() { func (x *GetEventsRequest) Reset() {
@ -355,14 +355,14 @@ func (x *GetEventsRequest) GetNamespaces() []string {
return nil return nil
} }
func (x *GetEventsRequest) GetMindate() *timestamppb.Timestamp { func (x *GetEventsRequest) GetMindate() *timestamp.Timestamp {
if x != nil { if x != nil {
return x.Mindate return x.Mindate
} }
return nil return nil
} }
func (x *GetEventsRequest) GetMaxdate() *timestamppb.Timestamp { func (x *GetEventsRequest) GetMaxdate() *timestamp.Timestamp {
if x != nil { if x != nil {
return x.Maxdate return x.Maxdate
} }
@ -423,7 +423,7 @@ type SubscribeEventRequest struct {
Subscriber string `protobuf:"bytes,20,opt,name=subscriber,proto3" json:"subscriber,omitempty"` Subscriber string `protobuf:"bytes,20,opt,name=subscriber,proto3" json:"subscriber,omitempty"`
Eventid string `protobuf:"bytes,21,opt,name=eventid,proto3" json:"eventid,omitempty"` Eventid string `protobuf:"bytes,21,opt,name=eventid,proto3" json:"eventid,omitempty"`
Data *structpb.Struct `protobuf:"bytes,22,opt,name=data,proto3" json:"data,omitempty"` Data *_struct.Struct `protobuf:"bytes,22,opt,name=data,proto3" json:"data,omitempty"`
} }
func (x *SubscribeEventRequest) Reset() { func (x *SubscribeEventRequest) Reset() {
@ -472,7 +472,7 @@ func (x *SubscribeEventRequest) GetEventid() string {
return "" return ""
} }
func (x *SubscribeEventRequest) GetData() *structpb.Struct { func (x *SubscribeEventRequest) GetData() *_struct.Struct {
if x != nil { if x != nil {
return x.Data return x.Data
} }
@ -628,6 +628,210 @@ func (x *UnsubscribeEventResponse) GetOk() bool {
return false 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,52,opt,name=event,proto3" json:"event,omitempty"`
}
func (x *UpdateEventRequest) Reset() {
*x = UpdateEventRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_agenda_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateEventRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateEventRequest) ProtoMessage() {}
func (x *UpdateEventRequest) ProtoReflect() protoreflect.Message {
mi := &file_agenda_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateEventRequest.ProtoReflect.Descriptor instead.
func (*UpdateEventRequest) Descriptor() ([]byte, []int) {
return file_agenda_proto_rawDescGZIP(), []int{14}
}
func (x *UpdateEventRequest) GetEvent() *Event {
if x != nil {
return x.Event
}
return nil
}
type UpdateEventResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Event *Event `protobuf:"bytes,53,opt,name=event,proto3" json:"event,omitempty"`
}
func (x *UpdateEventResponse) Reset() {
*x = UpdateEventResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_agenda_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateEventResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateEventResponse) ProtoMessage() {}
func (x *UpdateEventResponse) ProtoReflect() protoreflect.Message {
mi := &file_agenda_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateEventResponse.ProtoReflect.Descriptor instead.
func (*UpdateEventResponse) Descriptor() ([]byte, []int) {
return file_agenda_proto_rawDescGZIP(), []int{15}
}
func (x *UpdateEventResponse) GetEvent() *Event {
if x != nil {
return x.Event
}
return nil
}
var File_agenda_proto protoreflect.FileDescriptor var File_agenda_proto protoreflect.FileDescriptor
var file_agenda_proto_rawDesc = []byte{ var file_agenda_proto_rawDesc = []byte{
@ -685,34 +889,61 @@ var file_agenda_proto_rawDesc = []byte{
0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x18, 0x55, 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, 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, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x27, 0x20,
0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xf9, 0x02, 0x0a, 0x06, 0x41, 0x67, 0x65, 0x6e, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x82, 0x01, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65,
0x64, 0x61, 0x12, 0x3a, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x74, 0x12, 0x13, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x62, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63,
0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x72, 0x69, 0x62, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64,
0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x12,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x11, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2c, 0x0a, 0x1a,
0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x18, 0x29, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x32, 0x0a, 0x12, 0x55, 0x70,
0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x13, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x44, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x34, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x06, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x33,
0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x35,
0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 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, 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, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x55, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x12, 0x49, 0x0a, 0x10, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
0x65, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e,
0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x12, 0x44,
0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x64, 0x61, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
@ -727,7 +958,7 @@ func file_agenda_proto_rawDescGZIP() []byte {
return file_agenda_proto_rawDescData return file_agenda_proto_rawDescData
} }
var file_agenda_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_agenda_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_agenda_proto_goTypes = []interface{}{ var file_agenda_proto_goTypes = []interface{}{
(*CreateEventRequest)(nil), // 0: CreateEventRequest (*CreateEventRequest)(nil), // 0: CreateEventRequest
(*CreateEventResponse)(nil), // 1: CreateEventResponse (*CreateEventResponse)(nil), // 1: CreateEventResponse
@ -741,35 +972,46 @@ var file_agenda_proto_goTypes = []interface{}{
(*SubscribeEventResponse)(nil), // 9: SubscribeEventResponse (*SubscribeEventResponse)(nil), // 9: SubscribeEventResponse
(*UnsubscribeEventRequest)(nil), // 10: UnsubscribeEventRequest (*UnsubscribeEventRequest)(nil), // 10: UnsubscribeEventRequest
(*UnsubscribeEventResponse)(nil), // 11: UnsubscribeEventResponse (*UnsubscribeEventResponse)(nil), // 11: UnsubscribeEventResponse
(*Event)(nil), // 12: Event (*DeleteSubscriptionRequest)(nil), // 12: DeleteSubscriptionRequest
(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp (*DeleteSubscriptionResponse)(nil), // 13: DeleteSubscriptionResponse
(*structpb.Struct)(nil), // 14: google.protobuf.Struct (*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{ var file_agenda_proto_depIdxs = []int32{
12, // 0: CreateEventRequest.event:type_name -> Event 16, // 0: CreateEventRequest.event:type_name -> Event
12, // 1: CreateEventResponse.event:type_name -> Event 16, // 1: CreateEventResponse.event:type_name -> Event
12, // 2: GetEventResponse.event:type_name -> Event 16, // 2: GetEventResponse.event:type_name -> Event
13, // 3: GetEventsRequest.mindate:type_name -> google.protobuf.Timestamp 17, // 3: GetEventsRequest.mindate:type_name -> google.protobuf.Timestamp
13, // 4: GetEventsRequest.maxdate:type_name -> google.protobuf.Timestamp 17, // 4: GetEventsRequest.maxdate:type_name -> google.protobuf.Timestamp
12, // 5: GetEventsResponse.events:type_name -> Event 16, // 5: GetEventsResponse.events:type_name -> Event
14, // 6: SubscribeEventRequest.data:type_name -> google.protobuf.Struct 18, // 6: SubscribeEventRequest.data:type_name -> google.protobuf.Struct
0, // 7: Agenda.CreateEvent:input_type -> CreateEventRequest 18, // 7: DeleteSubscriptionRequest.data:type_name -> google.protobuf.Struct
2, // 8: Agenda.GetEvent:input_type -> GetEventRequest 16, // 8: UpdateEventRequest.event:type_name -> Event
6, // 9: Agenda.GetEvents:input_type -> GetEventsRequest 16, // 9: UpdateEventResponse.event:type_name -> Event
4, // 10: Agenda.DeleteEvent:input_type -> DeleteEventRequest 0, // 10: Agenda.CreateEvent:input_type -> CreateEventRequest
8, // 11: Agenda.SubscribeEvent:input_type -> SubscribeEventRequest 2, // 11: Agenda.GetEvent:input_type -> GetEventRequest
10, // 12: Agenda.UnsubscribeEvent:input_type -> UnsubscribeEventRequest 6, // 12: Agenda.GetEvents:input_type -> GetEventsRequest
1, // 13: Agenda.CreateEvent:output_type -> CreateEventResponse 4, // 13: Agenda.DeleteEvent:input_type -> DeleteEventRequest
3, // 14: Agenda.GetEvent:output_type -> GetEventResponse 14, // 14: Agenda.UpdateEvent:input_type -> UpdateEventRequest
7, // 15: Agenda.GetEvents:output_type -> GetEventsResponse 8, // 15: Agenda.SubscribeEvent:input_type -> SubscribeEventRequest
5, // 16: Agenda.DeleteEvent:output_type -> DeleteEventResponse 10, // 16: Agenda.UnsubscribeEvent:input_type -> UnsubscribeEventRequest
9, // 17: Agenda.SubscribeEvent:output_type -> SubscribeEventResponse 12, // 17: Agenda.DeleteSubscription:input_type -> DeleteSubscriptionRequest
11, // 18: Agenda.UnsubscribeEvent:output_type -> UnsubscribeEventResponse 1, // 18: Agenda.CreateEvent:output_type -> CreateEventResponse
13, // [13:19] is the sub-list for method output_type 3, // 19: Agenda.GetEvent:output_type -> GetEventResponse
7, // [7:13] is the sub-list for method input_type 7, // 20: Agenda.GetEvents:output_type -> GetEventsResponse
7, // [7:7] is the sub-list for extension type_name 5, // 21: Agenda.DeleteEvent:output_type -> DeleteEventResponse
7, // [7:7] is the sub-list for extension extendee 15, // 22: Agenda.UpdateEvent:output_type -> UpdateEventResponse
0, // [0:7] is the sub-list for field type_name 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() } func init() { file_agenda_proto_init() }
@ -923,6 +1165,54 @@ func file_agenda_proto_init() {
return nil return nil
} }
} }
file_agenda_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSubscriptionRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_agenda_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*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
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -930,7 +1220,7 @@ func file_agenda_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_agenda_proto_rawDesc, RawDescriptor: file_agenda_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 12, NumMessages: 16,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@ -13,9 +13,10 @@ service Agenda {
rpc GetEvent(GetEventRequest) returns (GetEventResponse) {} rpc GetEvent(GetEventRequest) returns (GetEventResponse) {}
rpc GetEvents(GetEventsRequest) returns (GetEventsResponse) {} rpc GetEvents(GetEventsRequest) returns (GetEventsResponse) {}
rpc DeleteEvent(DeleteEventRequest) returns (DeleteEventResponse) {} rpc DeleteEvent(DeleteEventRequest) returns (DeleteEventResponse) {}
rpc UpdateEvent(UpdateEventRequest) returns (UpdateEventResponse) {}
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,20 @@ 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;
}
message UpdateEventRequest {
Event event = 52;
}
message UpdateEventResponse {
Event event = 53;
}

View File

@ -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.12.4
// source: agenda.proto // source: agenda.proto
package grpcapi package grpcapi
@ -26,8 +26,10 @@ type AgendaClient interface {
GetEvent(ctx context.Context, in *GetEventRequest, opts ...grpc.CallOption) (*GetEventResponse, error) GetEvent(ctx context.Context, in *GetEventRequest, opts ...grpc.CallOption) (*GetEventResponse, error)
GetEvents(ctx context.Context, in *GetEventsRequest, opts ...grpc.CallOption) (*GetEventsResponse, error) GetEvents(ctx context.Context, in *GetEventsRequest, opts ...grpc.CallOption) (*GetEventsResponse, error)
DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error) DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error)
UpdateEvent(ctx context.Context, in *UpdateEventRequest, opts ...grpc.CallOption) (*UpdateEventResponse, error)
SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) 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 {
@ -74,6 +76,15 @@ func (c *agendaClient) DeleteEvent(ctx context.Context, in *DeleteEventRequest,
return out, nil return out, nil
} }
func (c *agendaClient) UpdateEvent(ctx context.Context, in *UpdateEventRequest, opts ...grpc.CallOption) (*UpdateEventResponse, error) {
out := new(UpdateEventResponse)
err := c.cc.Invoke(ctx, "/Agenda/UpdateEvent", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agendaClient) SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) { func (c *agendaClient) SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) {
out := new(SubscribeEventResponse) out := new(SubscribeEventResponse)
err := c.cc.Invoke(ctx, "/Agenda/SubscribeEvent", in, out, opts...) err := c.cc.Invoke(ctx, "/Agenda/SubscribeEvent", in, out, opts...)
@ -92,6 +103,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
@ -100,8 +120,10 @@ type AgendaServer interface {
GetEvent(context.Context, *GetEventRequest) (*GetEventResponse, error) GetEvent(context.Context, *GetEventRequest) (*GetEventResponse, error)
GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error) GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error)
DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error)
UpdateEvent(context.Context, *UpdateEventRequest) (*UpdateEventResponse, 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()
} }
@ -121,12 +143,18 @@ func (UnimplementedAgendaServer) GetEvents(context.Context, *GetEventsRequest) (
func (UnimplementedAgendaServer) DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) { func (UnimplementedAgendaServer) DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteEvent not implemented") return nil, status.Errorf(codes.Unimplemented, "method DeleteEvent not implemented")
} }
func (UnimplementedAgendaServer) UpdateEvent(context.Context, *UpdateEventRequest) (*UpdateEventResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateEvent not implemented")
}
func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) { func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SubscribeEvent not implemented") return nil, status.Errorf(codes.Unimplemented, "method SubscribeEvent not implemented")
} }
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.
@ -212,6 +240,24 @@ func _Agenda_DeleteEvent_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Agenda_UpdateEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateEventRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgendaServer).UpdateEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Agenda/UpdateEvent",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgendaServer).UpdateEvent(ctx, req.(*UpdateEventRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Agenda_SubscribeEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Agenda_SubscribeEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SubscribeEventRequest) in := new(SubscribeEventRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -248,6 +294,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)
@ -271,6 +335,10 @@ var Agenda_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeleteEvent", MethodName: "DeleteEvent",
Handler: _Agenda_DeleteEvent_Handler, Handler: _Agenda_DeleteEvent_Handler,
}, },
{
MethodName: "UpdateEvent",
Handler: _Agenda_UpdateEvent_Handler,
},
{ {
MethodName: "SubscribeEvent", MethodName: "SubscribeEvent",
Handler: _Agenda_SubscribeEvent_Handler, Handler: _Agenda_SubscribeEvent_Handler,
@ -279,6 +347,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",

View File

@ -26,13 +26,19 @@ 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{},
Deleted: e.Deleted,
} }
for _, v := range e.Subscriptions { for _, v := range e.Subscriptions {
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 +78,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,7 +105,9 @@ 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,
Deleted: event.Deleted,
}, nil }, nil
} }

View File

@ -1,16 +1,16 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.0 // protoc-gen-go v1.28.1
// protoc v3.19.4 // protoc v3.12.4
// source: events.proto // source: events.proto
package grpcapi package grpcapi
import ( import (
_struct "github.com/golang/protobuf/ptypes/struct"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
structpb "google.golang.org/protobuf/types/known/structpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
) )
@ -34,14 +34,16 @@ type Event struct {
RestrictedTo []string `protobuf:"bytes,5,rep,name=restricted_to,json=restrictedTo,proto3" json:"restricted_to,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"` Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"`
Startdate *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=startdate,proto3" json:"startdate,omitempty"` Startdate *timestamp.Timestamp `protobuf:"bytes,8,opt,name=startdate,proto3" json:"startdate,omitempty"`
Enddate *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=enddate,proto3" json:"enddate,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"` Allday bool `protobuf:"varint,10,opt,name=allday,proto3" json:"allday,omitempty"`
Starttime string `protobuf:"bytes,11,opt,name=starttime,proto3" json:"starttime,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"` 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"`
Data *structpb.Struct `protobuf:"bytes,15,opt,name=data,proto3" json:"data,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() { func (x *Event) Reset() {
@ -125,14 +127,14 @@ func (x *Event) GetDescription() string {
return "" return ""
} }
func (x *Event) GetStartdate() *timestamppb.Timestamp { func (x *Event) GetStartdate() *timestamp.Timestamp {
if x != nil { if x != nil {
return x.Startdate return x.Startdate
} }
return nil return nil
} }
func (x *Event) GetEnddate() *timestamppb.Timestamp { func (x *Event) GetEnddate() *timestamp.Timestamp {
if x != nil { if x != nil {
return x.Enddate return x.Enddate
} }
@ -174,13 +176,27 @@ func (x *Event) GetSubscriptions() []*Subscription {
return nil return nil
} }
func (x *Event) GetData() *structpb.Struct { func (x *Event) GetDeletedSubscription() []*Subscription {
if x != nil {
return x.DeletedSubscription
}
return nil
}
func (x *Event) GetData() *_struct.Struct {
if x != nil { if x != nil {
return x.Data return x.Data
} }
return nil return nil
} }
func (x *Event) GetDeleted() bool {
if x != nil {
return x.Deleted
}
return false
}
type Subscription struct { type Subscription struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -189,8 +205,8 @@ type Subscription struct {
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 *_struct.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 *timestamp.Timestamp `protobuf:"bytes,24,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
} }
func (x *Subscription) Reset() { func (x *Subscription) Reset() {
@ -246,14 +262,14 @@ func (x *Subscription) GetTags() []string {
return nil return nil
} }
func (x *Subscription) GetData() *structpb.Struct { func (x *Subscription) GetData() *_struct.Struct {
if x != nil { if x != nil {
return x.Data return x.Data
} }
return nil return nil
} }
func (x *Subscription) GetCreatedAt() *timestamppb.Timestamp { func (x *Subscription) GetCreatedAt() *timestamp.Timestamp {
if x != nil { if x != nil {
return x.CreatedAt return x.CreatedAt
} }
@ -267,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, 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, 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, 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, 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, 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, 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, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65,
@ -297,25 +313,31 @@ var file_events_proto_rawDesc = []byte{
0x69, 0x62, 0x65, 0x72, 0x73, 0x12, 0x33, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 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, 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, 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, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, 0x0a, 0x14, 0x64, 0x65,
0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63,
0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x73, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64,
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x14, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f,
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, 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, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c,
0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x65, 0x74, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x74, 0x65, 0x64, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09,
0x65, 0x64, 0x41, 0x74, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x65, 0x72, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72,
0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x64, 0x61, 0x2f, 0x67, 0x72, 0x70, 0x69, 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x16, 0x20, 0x03,
0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
@ -334,21 +356,22 @@ var file_events_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_events_proto_goTypes = []interface{}{ var file_events_proto_goTypes = []interface{}{
(*Event)(nil), // 0: Event (*Event)(nil), // 0: Event
(*Subscription)(nil), // 1: Subscription (*Subscription)(nil), // 1: Subscription
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp (*timestamp.Timestamp)(nil), // 2: google.protobuf.Timestamp
(*structpb.Struct)(nil), // 3: google.protobuf.Struct (*_struct.Struct)(nil), // 3: google.protobuf.Struct
} }
var file_events_proto_depIdxs = []int32{ var file_events_proto_depIdxs = []int32{
2, // 0: Event.startdate:type_name -> google.protobuf.Timestamp 2, // 0: Event.startdate:type_name -> google.protobuf.Timestamp
2, // 1: Event.enddate:type_name -> google.protobuf.Timestamp 2, // 1: Event.enddate:type_name -> google.protobuf.Timestamp
1, // 2: Event.subscriptions:type_name -> Subscription 1, // 2: Event.subscriptions:type_name -> Subscription
3, // 3: Event.data:type_name -> google.protobuf.Struct 1, // 3: Event.deleted_subscription:type_name -> Subscription
3, // 4: Subscription.data:type_name -> google.protobuf.Struct 3, // 4: Event.data:type_name -> google.protobuf.Struct
2, // 5: Subscription.created_at:type_name -> google.protobuf.Timestamp 3, // 5: Subscription.data:type_name -> google.protobuf.Struct
6, // [6:6] is the sub-list for method output_type 2, // 6: Subscription.created_at:type_name -> google.protobuf.Timestamp
6, // [6:6] is the sub-list for method input_type 7, // [7:7] is the sub-list for method output_type
6, // [6:6] is the sub-list for extension type_name 7, // [7:7] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension extendee 7, // [7:7] is the sub-list for extension type_name
0, // [0:6] is the sub-list for field 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() } func init() { file_events_proto_init() }

View File

@ -20,7 +20,9 @@ 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;
bool deleted = 17;
} }
message Subscription { message Subscription {

View File

@ -94,6 +94,34 @@ 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) UpdateEvent(ctx context.Context, req *UpdateEventRequest) (*UpdateEventResponse, error) {
b := req.Event.ToStorageType()
event, err := s.handler.UpdateEvent(b)
if err != nil {
fmt.Println(err)
return nil, status.Errorf(codes.AlreadyExists, "event update failed : %v", err)
}
response, err := EventFromStorageType(event)
if err != nil {
fmt.Println(err)
return nil, status.Errorf(codes.Internal, "issue while retrieving event : %v", err)
}
return &UpdateEventResponse{Event: response}, nil
}
//////////////////////////////////////////////////////////////////////////////////////////////
func (s AgendaServerImpl) mustEmbedUnimplementedAgendaServer() {} func (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) {

1078
grpcapi/lol/agenda.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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",
}

View File

@ -70,3 +70,33 @@ 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
}
func (h AgendaHandler) UpdateEvent(event storage.Event) (*storage.Event, error) {
// Store the account
if err := h.storage.UpdateEvent(event); err != nil {
return nil, err
}
return &event, nil
}

View File

@ -18,6 +18,7 @@ func main() {
var ( var (
service_name = cfg.GetString("name") service_name = cfg.GetString("name")
grpc_enable = cfg.GetBool("services.grpc.enable") grpc_enable = cfg.GetBool("services.grpc.enable")
dev_env = cfg.GetBool("dev_env")
) )
storage, err := storage.NewStorage(cfg) storage, err := storage.NewStorage(cfg)
@ -28,6 +29,9 @@ func main() {
handler := handlers.NewHandler(cfg, storage) handler := handlers.NewHandler(cfg, storage)
fmt.Println("Running", service_name, ":") fmt.Println("Running", service_name, ":")
if dev_env {
fmt.Printf("\033]0;%s\007", service_name)
}
failed := make(chan error) failed := make(chan error)

View File

@ -17,7 +17,9 @@ 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"`
Deleted bool `json:"deleted"`
} }
type Subscription struct { type Subscription struct {

View File

@ -120,3 +120,36 @@ 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
}
func (s MongoDBStorage) UpdateEvent(event Event) error {
collection := s.Client.Database(s.DbName).Collection(s.Collections["events"])
if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": event.ID}, event); err != nil {
fmt.Println(err)
return err
}
return nil
}

View File

@ -11,6 +11,8 @@ 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
UpdateEvent(Event) error
} }
type StorageImpl struct { type StorageImpl struct {
} }