mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 20:38:00 +00:00
fb3c6f791b
* feat: add projections and query side to executions and targets * feat: add list and get endpoints for targets * feat: add integration tests for query endpoints target and execution * fix: linting * fix: linting * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: remove position from list details
70 lines
1.4 KiB
Go
70 lines
1.4 KiB
Go
package execution
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
)
|
|
|
|
const (
|
|
eventTypePrefix eventstore.EventType = "execution."
|
|
SetEventType = eventTypePrefix + "set"
|
|
RemovedEventType = eventTypePrefix + "removed"
|
|
)
|
|
|
|
type SetEvent struct {
|
|
*eventstore.BaseEvent `json:"-"`
|
|
|
|
Targets []string `json:"targets"`
|
|
Includes []string `json:"includes"`
|
|
}
|
|
|
|
func (e *SetEvent) SetBaseEvent(b *eventstore.BaseEvent) {
|
|
e.BaseEvent = b
|
|
}
|
|
|
|
func (e *SetEvent) Payload() any {
|
|
return e
|
|
}
|
|
|
|
func (e *SetEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
|
return nil
|
|
}
|
|
|
|
func NewSetEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
targets []string,
|
|
includes []string,
|
|
) *SetEvent {
|
|
return &SetEvent{
|
|
BaseEvent: eventstore.NewBaseEventForPush(
|
|
ctx, aggregate, SetEventType,
|
|
),
|
|
Targets: targets,
|
|
Includes: includes,
|
|
}
|
|
}
|
|
|
|
type RemovedEvent struct {
|
|
*eventstore.BaseEvent `json:"-"`
|
|
}
|
|
|
|
func (e *RemovedEvent) SetBaseEvent(b *eventstore.BaseEvent) {
|
|
e.BaseEvent = b
|
|
}
|
|
|
|
func (e *RemovedEvent) Payload() any {
|
|
return e
|
|
}
|
|
|
|
func (e *RemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
|
return nil
|
|
}
|
|
|
|
func NewRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *RemovedEvent {
|
|
return &RemovedEvent{
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, RemovedEventType),
|
|
}
|
|
}
|