2023-07-06 06:38:13 +00:00
|
|
|
package milestone
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
eventTypePrefix = eventstore.EventType("milestone.")
|
|
|
|
PushedEventType = eventTypePrefix + "pushed"
|
|
|
|
)
|
|
|
|
|
2023-10-19 10:19:10 +00:00
|
|
|
var _ eventstore.Command = (*PushedEvent)(nil)
|
|
|
|
|
2023-07-06 06:38:13 +00:00
|
|
|
type PushedEvent struct {
|
|
|
|
*eventstore.BaseEvent `json:"-"`
|
|
|
|
MilestoneType Type `json:"type"`
|
|
|
|
ExternalDomain string `json:"externalDomain"`
|
|
|
|
PrimaryDomain string `json:"primaryDomain"`
|
|
|
|
Endpoints []string `json:"endpoints"`
|
|
|
|
}
|
|
|
|
|
2023-10-19 10:19:10 +00:00
|
|
|
// Payload implements eventstore.Command.
|
|
|
|
func (p *PushedEvent) Payload() any {
|
2023-07-06 06:38:13 +00:00
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
2023-10-19 10:19:10 +00:00
|
|
|
func (p *PushedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
2023-07-06 06:38:13 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *PushedEvent) SetBaseEvent(b *eventstore.BaseEvent) {
|
|
|
|
p.BaseEvent = b
|
|
|
|
}
|
|
|
|
|
|
|
|
var PushedEventMapper = eventstore.GenericEventMapper[PushedEvent]
|
|
|
|
|
|
|
|
func NewPushedEvent(
|
|
|
|
ctx context.Context,
|
|
|
|
aggregate *Aggregate,
|
|
|
|
msType Type,
|
|
|
|
endpoints []string,
|
|
|
|
externalDomain, primaryDomain string,
|
|
|
|
) *PushedEvent {
|
|
|
|
return &PushedEvent{
|
|
|
|
BaseEvent: eventstore.NewBaseEventForPush(
|
|
|
|
ctx,
|
|
|
|
&aggregate.Aggregate,
|
|
|
|
PushedEventType,
|
|
|
|
),
|
|
|
|
MilestoneType: msType,
|
|
|
|
Endpoints: endpoints,
|
|
|
|
ExternalDomain: externalDomain,
|
|
|
|
PrimaryDomain: primaryDomain,
|
|
|
|
}
|
|
|
|
}
|