2 Commits

Author SHA1 Message Date
argoyle 1476170f88 feat: add name and registration number to event 2019-12-08 15:46:52 +01:00
argoyle d1898339b1 fix: print unexpected messages 2019-11-22 08:12:48 +01:00
+5
View File
@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"reflect"
) )
// CompanyPrivileges contains the privileges for a combination of email address and company id // CompanyPrivileges contains the privileges for a combination of email address and company id
@@ -22,6 +23,8 @@ type CompanyPrivileges struct {
type PrivilegeAdded struct { type PrivilegeAdded struct {
Email string `json:"email"` Email string `json:"email"`
CompanyID string `json:"companyId"` CompanyID string `json:"companyId"`
Name string `json:"name"`
RegistrationNumber string `json:"registrationNumber"`
Admin bool `json:"admin"` Admin bool `json:"admin"`
Company bool `json:"company"` Company bool `json:"company"`
Consumer bool `json:"consumer"` Consumer bool `json:"consumer"`
@@ -85,6 +88,8 @@ func (h *PrivilegeHandler) Process(msg interface{}) bool {
if ev, ok := msg.(*PrivilegeAdded); ok { if ev, ok := msg.(*PrivilegeAdded); ok {
h.setPrivileges(ev) h.setPrivileges(ev)
return true return true
} else {
fmt.Printf("Got unexpected message type (%s): '%+v'\n", reflect.TypeOf(msg).String(), msg)
} }
return false return false
} }