2021-04-30 17:20:08 +03:00
|
|
|
package config
|
|
|
|
|
|
|
|
import "github.com/leandro-lugaresi/hub"
|
|
|
|
|
|
|
|
type ApplicationEvent struct {
|
|
|
|
Type string
|
|
|
|
Payload interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2021-08-06 18:07:36 +03:00
|
|
|
TopicUser = "user.*"
|
|
|
|
TopicHeartbeat = "heartbeat.*"
|
|
|
|
TopicProjectLabel = "project_label.*"
|
|
|
|
EventUserUpdate = "user.update"
|
|
|
|
EventHeartbeatCreate = "heartbeat.create"
|
|
|
|
EventProjectLabelCreate = "project_label.create"
|
|
|
|
EventProjectLabelDelete = "project_label.delete"
|
2021-08-07 00:28:03 +03:00
|
|
|
EventWakatimeFailure = "wakatime.failure"
|
2021-08-06 18:07:36 +03:00
|
|
|
FieldPayload = "payload"
|
|
|
|
FieldUser = "user"
|
|
|
|
FieldUserId = "user.id"
|
2021-04-30 17:20:08 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
var eventHub *hub.Hub
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
eventHub = hub.New()
|
|
|
|
}
|
|
|
|
|
|
|
|
func EventBus() *hub.Hub {
|
|
|
|
return eventHub
|
|
|
|
}
|