Files
archie/modules/events/references.go
T

23 lines
473 B
Go

package events
import (
"context"
"github.com/google/uuid"
)
// WorkflowTriggers returns the names of the triggers that start the workflow.
func (m *Module) WorkflowTriggers(ctx context.Context, workflow uuid.UUID) ([]string, error) {
triggers, err := m.store.AllTriggers(ctx, m.orgID)
if err != nil {
return nil, err
}
var names []string
for _, t := range triggers {
if t.WorkflowID == workflow {
names = append(names, t.Name)
}
}
return names, nil
}