41 lines
901 B
Go
Raw Normal View History

2023-06-28 08:19:34 +02:00
package pseudo
import (
2023-06-28 11:35:22 +02:00
"context"
2023-06-28 08:19:34 +02:00
"time"
"github.com/zitadel/zitadel/internal/eventstore"
)
const (
eventTypePrefix = eventstore.EventType("pseudo.")
2023-06-28 11:35:22 +02:00
ScheduledEventType = eventTypePrefix + "timestamp"
2023-06-28 08:19:34 +02:00
)
2023-06-28 11:35:22 +02:00
var _ eventstore.Event = (*ScheduledEvent)(nil)
2023-06-28 08:19:34 +02:00
2023-06-28 11:35:22 +02:00
type ScheduledEvent struct {
*eventstore.BaseEvent `json:"-"`
2023-06-28 17:43:19 +02:00
Timestamp time.Time `json:"timestamp"`
InstanceIDs []string `json:"instanceIDs"`
TriggeringEvent eventstore.Event `json:"triggeringEvent"`
2023-06-28 08:19:34 +02:00
}
2023-06-28 11:35:22 +02:00
func NewScheduledEvent(
ctx context.Context,
2023-06-28 08:19:34 +02:00
timestamp time.Time,
2023-06-28 17:43:19 +02:00
triggeringEvent eventstore.Event,
2023-06-28 08:19:34 +02:00
instanceIDs ...string,
2023-06-28 11:35:22 +02:00
) *ScheduledEvent {
return &ScheduledEvent{
BaseEvent: eventstore.NewBaseEventForPush(
ctx,
&NewAggregate().Aggregate,
ScheduledEventType,
),
2023-06-28 17:43:19 +02:00
Timestamp: timestamp,
InstanceIDs: instanceIDs,
TriggeringEvent: triggeringEvent,
2023-06-28 08:19:34 +02:00
}
}