mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
ed80a8bb1e
* feat(actions): begin api * feat(actions): begin api * api and projections * fix: handle multiple statements for a single event in projections * export func type * fix test * update to new reduce interface * flows in login * feat: jwt idp * feat: command side * feat: add tests * actions and flows * fill idp views with jwt idps and return apis * add jwtEndpoint to jwt idp * begin jwt request handling * add feature * merge * merge * handle jwt idp * cleanup * bug fixes * autoregister * get token from specific header name * fix: proto * fixes * i18n * begin tests * fix and log http proxy * remove docker cache * fixes * usergrants in actions api * tests adn cleanup * cleanup * fix add user grant * set login context * i18n Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
107 lines
2.7 KiB
Go
107 lines
2.7 KiB
Go
package org
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/domain"
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
"github.com/caos/zitadel/internal/eventstore/repository"
|
|
"github.com/caos/zitadel/internal/repository/flow"
|
|
)
|
|
|
|
var (
|
|
TriggerActionsSetEventType = orgEventTypePrefix + flow.TriggerActionsSetEventType
|
|
TriggerActionsCascadeRemovedEventType = orgEventTypePrefix + flow.TriggerActionsCascadeRemovedEventType
|
|
FlowClearedEventType = orgEventTypePrefix + flow.FlowClearedEventType
|
|
)
|
|
|
|
type TriggerActionsSetEvent struct {
|
|
flow.TriggerActionsSetEvent
|
|
}
|
|
|
|
func NewTriggerActionsSetEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
flowType domain.FlowType,
|
|
triggerType domain.TriggerType,
|
|
actionIDs []string,
|
|
) *TriggerActionsSetEvent {
|
|
return &TriggerActionsSetEvent{
|
|
TriggerActionsSetEvent: *flow.NewTriggerActionsSetEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
TriggerActionsSetEventType),
|
|
flowType,
|
|
triggerType,
|
|
actionIDs),
|
|
}
|
|
}
|
|
|
|
func TriggerActionsSetEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := flow.TriggerActionsSetEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &TriggerActionsSetEvent{TriggerActionsSetEvent: *e.(*flow.TriggerActionsSetEvent)}, nil
|
|
}
|
|
|
|
type TriggerActionsCascadeRemovedEvent struct {
|
|
flow.TriggerActionsCascadeRemovedEvent
|
|
}
|
|
|
|
func NewTriggerActionsCascadeRemovedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
flowType domain.FlowType,
|
|
actionID string,
|
|
) *TriggerActionsCascadeRemovedEvent {
|
|
return &TriggerActionsCascadeRemovedEvent{
|
|
TriggerActionsCascadeRemovedEvent: *flow.NewTriggerActionsCascadeRemovedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
TriggerActionsCascadeRemovedEventType),
|
|
flowType,
|
|
actionID),
|
|
}
|
|
}
|
|
|
|
func TriggerActionsCascadeRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := flow.TriggerActionsCascadeRemovedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &TriggerActionsCascadeRemovedEvent{TriggerActionsCascadeRemovedEvent: *e.(*flow.TriggerActionsCascadeRemovedEvent)}, nil
|
|
}
|
|
|
|
type FlowClearedEvent struct {
|
|
flow.FlowClearedEvent
|
|
}
|
|
|
|
func NewFlowClearedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
flowType domain.FlowType,
|
|
) *FlowClearedEvent {
|
|
return &FlowClearedEvent{
|
|
FlowClearedEvent: *flow.NewFlowClearedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
FlowClearedEventType),
|
|
flowType),
|
|
}
|
|
}
|
|
|
|
func FlowClearedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := flow.FlowClearedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &FlowClearedEvent{FlowClearedEvent: *e.(*flow.FlowClearedEvent)}, nil
|
|
}
|