2023-06-19 12:15:30 +02:00
|
|
|
package milestone
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2023-06-28 11:35:22 +02:00
|
|
|
eventTypePrefix = eventstore.EventType("milestone.")
|
|
|
|
PushedEventType = eventTypePrefix + "pushed"
|
2023-06-19 12:15:30 +02:00
|
|
|
)
|
|
|
|
|
2023-06-28 11:35:22 +02:00
|
|
|
type PushedEvent struct {
|
|
|
|
*eventstore.BaseEvent `json:"-"`
|
|
|
|
MilestoneType Type `json:"type"`
|
|
|
|
PrimaryDomain string `json:"primaryDomain"`
|
|
|
|
Endpoints []string `json:"endpoints"`
|
2023-06-28 08:19:34 +02:00
|
|
|
}
|
|
|
|
|
2023-06-28 11:35:22 +02:00
|
|
|
func (p *PushedEvent) Data() interface{} {
|
|
|
|
return p
|
2023-06-19 12:15:30 +02:00
|
|
|
}
|
|
|
|
|
2023-06-28 11:35:22 +02:00
|
|
|
func (p *PushedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
2023-06-19 12:15:30 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-06-28 11:35:22 +02:00
|
|
|
func (p *PushedEvent) SetBaseEvent(b *eventstore.BaseEvent) {
|
|
|
|
p.BaseEvent = b
|
2023-06-28 08:19:34 +02:00
|
|
|
}
|
|
|
|
|
2023-06-28 11:35:22 +02:00
|
|
|
func NewPushedEvent(
|
2023-06-28 08:19:34 +02:00
|
|
|
ctx context.Context,
|
|
|
|
aggregate *Aggregate,
|
2023-06-28 11:35:22 +02:00
|
|
|
msType Type,
|
2023-06-28 08:19:34 +02:00
|
|
|
endpoints []string,
|
|
|
|
primaryDomain string,
|
2023-06-28 11:35:22 +02:00
|
|
|
) *PushedEvent {
|
|
|
|
return &PushedEvent{
|
|
|
|
BaseEvent: eventstore.NewBaseEventForPush(
|
|
|
|
ctx,
|
|
|
|
&aggregate.Aggregate,
|
|
|
|
PushedEventType,
|
|
|
|
),
|
|
|
|
MilestoneType: msType,
|
|
|
|
Endpoints: endpoints,
|
|
|
|
PrimaryDomain: primaryDomain,
|
2023-06-19 12:15:30 +02:00
|
|
|
}
|
|
|
|
}
|