mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-05 06:52:03 +00:00
fix scheduled pseudo event projection
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package milestone
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/api/authz"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
)
|
||||
|
||||
@@ -13,13 +16,14 @@ type Aggregate struct {
|
||||
eventstore.Aggregate
|
||||
}
|
||||
|
||||
func NewAggregate(id, resourceOwner, instanceID string) *Aggregate {
|
||||
func NewAggregate(ctx context.Context, id string) *Aggregate {
|
||||
instanceID := authz.GetInstance(ctx).InstanceID()
|
||||
return &Aggregate{
|
||||
Aggregate: eventstore.Aggregate{
|
||||
Type: AggregateType,
|
||||
Version: AggregateVersion,
|
||||
ID: id,
|
||||
ResourceOwner: resourceOwner,
|
||||
ResourceOwner: instanceID,
|
||||
InstanceID: instanceID,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -16,13 +16,15 @@ var _ eventstore.Event = (*ScheduledEvent)(nil)
|
||||
|
||||
type ScheduledEvent struct {
|
||||
*eventstore.BaseEvent `json:"-"`
|
||||
Timestamp time.Time `json:"-"`
|
||||
InstanceIDs []string `json:"-"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
InstanceIDs []string `json:"instanceIDs"`
|
||||
TriggeringEvent eventstore.Event `json:"triggeringEvent"`
|
||||
}
|
||||
|
||||
func NewScheduledEvent(
|
||||
ctx context.Context,
|
||||
timestamp time.Time,
|
||||
triggeringEvent eventstore.Event,
|
||||
instanceIDs ...string,
|
||||
) *ScheduledEvent {
|
||||
return &ScheduledEvent{
|
||||
@@ -31,7 +33,8 @@ func NewScheduledEvent(
|
||||
&NewAggregate().Aggregate,
|
||||
ScheduledEventType,
|
||||
),
|
||||
Timestamp: timestamp,
|
||||
InstanceIDs: instanceIDs,
|
||||
Timestamp: timestamp,
|
||||
InstanceIDs: instanceIDs,
|
||||
TriggeringEvent: triggeringEvent,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user