mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-05 08:22:04 +00:00
push milestones
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/repository/quota"
|
||||
)
|
||||
|
||||
// ReportUsage calls notification hooks and emits the notified events
|
||||
func (c *Commands) ReportUsage(ctx context.Context, dueNotifications []*quota.NotificationDueEvent) error {
|
||||
// ReportQuotaUsage writes a slice of *quota.NotificationDueEvent directly to the eventstore
|
||||
func (c *Commands) ReportQuotaUsage(ctx context.Context, dueNotifications []*quota.NotificationDueEvent) error {
|
||||
cmds := make([]eventstore.Command, len(dueNotifications))
|
||||
for idx, notification := range dueNotifications {
|
||||
cmds[idx] = notification
|
||||
|
||||
27
internal/command/telemetry.go
Normal file
27
internal/command/telemetry.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/repository/milestone"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
)
|
||||
|
||||
// ReportTelemetryUsage writes one or many *telemetry.PushDueEvent directly to the eventstore
|
||||
func (c *Commands) ReportTelemetryUsage(ctx context.Context, dueEvent ...*milestone.ReachedEvent) error {
|
||||
cmds := make([]eventstore.Command, len(dueEvent))
|
||||
for idx, notification := range dueEvent {
|
||||
cmds[idx] = notification
|
||||
}
|
||||
_, err := c.eventstore.Push(ctx, cmds...)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Commands) TelemetryPushed(ctx context.Context, dueEvent *milestone.ReachedEvent, endpoints []string) error {
|
||||
_, err := c.eventstore.Push(
|
||||
ctx,
|
||||
milestone.NewPushedEvent(ctx, dueEvent, endpoints),
|
||||
)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user