package handlers import ( "fmt" "git.coopgo.io/coopgo-platform/agenda/storage" "github.com/google/uuid" ) func (h AgendaHandler) CreateEvent(event storage.Event) (*storage.Event, error) { if event.ID == "" { event.ID = uuid.NewString() } if event.Subscribers == nil { event.Subscribers = []string{} } if err := h.storage.CreateEvent(event); err != nil { return nil, err } return &event, nil } func (h AgendaHandler) GetEvent(id string) (event *storage.Event, err error) { event, err = h.storage.GetEvent(id) return } func (h AgendaHandler) GetEvents(namespaces []string) (events []storage.Event, err error) { events, err = h.storage.GetEvents(namespaces) fmt.Println(events) return } func (h AgendaHandler) SubscribeEvent(eventid string, subscriber string) (err error) { err = h.storage.AddSubscriber(eventid, subscriber) return }