command

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Module provides all command handlers and registers them with the Bus.

Functions

This section is empty.

Types

type AddAssigneeCmd

type AddAssigneeCmd struct {
	cqrs.BaseCommand

	TaskID   string
	UserIDs  []string
	AddType  approval.AddAssigneeType
	Operator approval.OperatorInfo
}

AddAssigneeCmd dynamically adds assignees to a task.

type AddAssigneeHandler

type AddAssigneeHandler struct {
	// contains filtered or unexported fields
}

AddAssigneeHandler handles the AddAssigneeCmd command.

func NewAddAssigneeHandler

func NewAddAssigneeHandler(db orm.DB, taskSvc *service.TaskService, publisher *dispatcher.EventPublisher, userResolver approval.UserInfoResolver) *AddAssigneeHandler

NewAddAssigneeHandler creates a new AddAssigneeHandler.

func (*AddAssigneeHandler) Handle

type AddCCCmd

type AddCCCmd struct {
	cqrs.BaseCommand

	InstanceID string
	CCUserIDs  []string
	OperatorID string
}

AddCCCmd adds CC records for an instance.

type AddCCHandler

type AddCCHandler struct {
	// contains filtered or unexported fields
}

AddCCHandler handles the AddCCCmd command.

func NewAddCCHandler

func NewAddCCHandler(db orm.DB, taskSvc *service.TaskService, publisher *dispatcher.EventPublisher, userResolver approval.UserInfoResolver) *AddCCHandler

NewAddCCHandler creates a new AddCCHandler.

func (*AddCCHandler) Handle

func (h *AddCCHandler) Handle(ctx context.Context, cmd AddCCCmd) (cqrs.Unit, error)

type ApproveTaskCmd

type ApproveTaskCmd struct {
	cqrs.BaseCommand

	TaskID   string
	Operator approval.OperatorInfo
	Opinion  string
	FormData map[string]any
}

ApproveTaskCmd approves (or handles) a pending task.

type ApproveTaskHandler

type ApproveTaskHandler struct {
	// contains filtered or unexported fields
}

ApproveTaskHandler handles the ApproveTaskCmd command.

func NewApproveTaskHandler

func NewApproveTaskHandler(
	db orm.DB,
	taskSvc *service.TaskService,
	nodeSvc *service.NodeService,
	validSvc *service.ValidationService,
	publisher *dispatcher.EventPublisher,
) *ApproveTaskHandler

NewApproveTaskHandler creates a new ApproveTaskHandler.

func (*ApproveTaskHandler) Handle

type AssigneeProvider

type AssigneeProvider interface {
	// GetAssignees returns the assignee definitions configured on this node.
	GetAssignees() []approval.AssigneeDefinition
}

AssigneeProvider is the interface for accessing assignees from typed node data.

type CCProvider

type CCProvider interface {
	// GetCCs returns the CC recipient definitions configured on this node.
	GetCCs() []approval.CCDefinition
}

CCProvider is the interface for accessing CC list from typed node data.

type CreateFlowCmd

type CreateFlowCmd struct {
	cqrs.BaseCommand

	TenantID               string
	Code                   string
	Name                   string
	CategoryID             string
	Icon                   *string
	Description            *string
	BindingMode            approval.BindingMode
	BusinessTable          *string
	BusinessPkField        *string
	BusinessTitleField     *string
	BusinessStatusField    *string
	AdminUserIDs           []string
	IsAllInitiationAllowed bool
	InstanceTitleTemplate  string
	Initiators             []shared.CreateFlowInitiatorCmd
}

CreateFlowCmd creates a new flow with its initiator configurations.

type CreateFlowHandler

type CreateFlowHandler struct {
	// contains filtered or unexported fields
}

CreateFlowHandler handles the CreateFlowCmd command.

func NewCreateFlowHandler

func NewCreateFlowHandler(db orm.DB) *CreateFlowHandler

NewCreateFlowHandler creates a new CreateFlowHandler.

func (*CreateFlowHandler) Handle

type DeployFlowCmd

type DeployFlowCmd struct {
	cqrs.BaseCommand

	FlowID         string
	Description    *string
	FlowDefinition approval.FlowDefinition
	FormDefinition *approval.FormDefinition
}

DeployFlowCmd deploys a flow definition to an existing flow.

type DeployFlowHandler

type DeployFlowHandler struct {
	// contains filtered or unexported fields
}

DeployFlowHandler handles the DeployFlowCmd command.

func NewDeployFlowHandler

func NewDeployFlowHandler(db orm.DB, flowDefSvc *service.FlowDefinitionService) *DeployFlowHandler

NewDeployFlowHandler creates a new DeployFlowHandler.

func (*DeployFlowHandler) Handle

type MarkCCReadCmd

type MarkCCReadCmd struct {
	cqrs.BaseCommand

	InstanceID string
	UserID     string
}

MarkCCReadCmd marks CC records as read for a user.

type MarkCCReadHandler

type MarkCCReadHandler struct {
	// contains filtered or unexported fields
}

MarkCCReadHandler handles the MarkCCReadCmd command.

func NewMarkCCReadHandler

func NewMarkCCReadHandler(db orm.DB, nodeSvc *service.NodeService) *MarkCCReadHandler

NewMarkCCReadHandler creates a new MarkCCReadHandler.

func (*MarkCCReadHandler) Handle

func (h *MarkCCReadHandler) Handle(ctx context.Context, cmd MarkCCReadCmd) (cqrs.Unit, error)

type PublishVersionCmd

type PublishVersionCmd struct {
	cqrs.BaseCommand

	VersionID  string
	OperatorID string
}

PublishVersionCmd publishes a flow version.

type PublishVersionHandler

type PublishVersionHandler struct {
	// contains filtered or unexported fields
}

PublishVersionHandler handles the PublishVersionCmd command.

func NewPublishVersionHandler

func NewPublishVersionHandler(db orm.DB, publisher *dispatcher.EventPublisher) *PublishVersionHandler

NewPublishVersionHandler creates a new PublishVersionHandler.

func (*PublishVersionHandler) Handle

type ReassignTaskCmd

type ReassignTaskCmd struct {
	cqrs.BaseCommand

	TaskID        string
	NewAssigneeID string
	Operator      approval.OperatorInfo
	Reason        string
}

ReassignTaskCmd reassigns a pending task to a different user (admin operation).

type ReassignTaskHandler

type ReassignTaskHandler struct {
	// contains filtered or unexported fields
}

ReassignTaskHandler handles the ReassignTaskCmd command.

func NewReassignTaskHandler

func NewReassignTaskHandler(
	db orm.DB,
	publisher *dispatcher.EventPublisher,
	userResolver approval.UserInfoResolver,
) *ReassignTaskHandler

NewReassignTaskHandler creates a new ReassignTaskHandler.

func (*ReassignTaskHandler) Handle

type RejectTaskCmd

type RejectTaskCmd struct {
	cqrs.BaseCommand

	TaskID   string
	Operator approval.OperatorInfo
	Opinion  string
	FormData map[string]any
}

RejectTaskCmd rejects a pending task.

type RejectTaskHandler

type RejectTaskHandler struct {
	// contains filtered or unexported fields
}

RejectTaskHandler handles the RejectTaskCmd command.

func NewRejectTaskHandler

func NewRejectTaskHandler(
	db orm.DB,
	taskSvc *service.TaskService,
	nodeSvc *service.NodeService,
	validationSvc *service.ValidationService,
	publisher *dispatcher.EventPublisher,
) *RejectTaskHandler

NewRejectTaskHandler creates a new RejectTaskHandler.

func (*RejectTaskHandler) Handle

func (h *RejectTaskHandler) Handle(ctx context.Context, cmd RejectTaskCmd) (cqrs.Unit, error)

type RemoveAssigneeCmd

type RemoveAssigneeCmd struct {
	cqrs.BaseCommand

	TaskID   string
	Operator approval.OperatorInfo
}

RemoveAssigneeCmd removes an assignee by canceling their task.

type RemoveAssigneeHandler

type RemoveAssigneeHandler struct {
	// contains filtered or unexported fields
}

RemoveAssigneeHandler handles the RemoveAssigneeCmd command.

func NewRemoveAssigneeHandler

func NewRemoveAssigneeHandler(
	db orm.DB,
	taskSvc *service.TaskService,
	nodeSvc *service.NodeService,
	eng *engine.FlowEngine,
	publisher *dispatcher.EventPublisher,
) *RemoveAssigneeHandler

NewRemoveAssigneeHandler creates a new RemoveAssigneeHandler.

func (*RemoveAssigneeHandler) Handle

type ResubmitCmd

type ResubmitCmd struct {
	cqrs.BaseCommand

	InstanceID string
	Operator   approval.OperatorInfo
	FormData   map[string]any
}

ResubmitCmd resubmits a returned instance.

type ResubmitHandler

type ResubmitHandler struct {
	// contains filtered or unexported fields
}

ResubmitHandler handles the ResubmitCmd command.

func NewResubmitHandler

func NewResubmitHandler(
	db orm.DB,
	eng *engine.FlowEngine,
	validationSvc *service.ValidationService,
	publisher *dispatcher.EventPublisher,
) *ResubmitHandler

NewResubmitHandler creates a new ResubmitHandler.

func (*ResubmitHandler) Handle

func (h *ResubmitHandler) Handle(ctx context.Context, cmd ResubmitCmd) (cqrs.Unit, error)

type RollbackTaskCmd

type RollbackTaskCmd struct {
	cqrs.BaseCommand

	TaskID       string
	Operator     approval.OperatorInfo
	Opinion      string
	FormData     map[string]any
	TargetNodeID string
}

RollbackTaskCmd rolls back a task to a previous node.

type RollbackTaskHandler

type RollbackTaskHandler struct {
	// contains filtered or unexported fields
}

RollbackTaskHandler handles the RollbackTaskCmd command.

func NewRollbackTaskHandler

func NewRollbackTaskHandler(
	db orm.DB,
	taskSvc *service.TaskService,
	validationSvc *service.ValidationService,
	eng *engine.FlowEngine,
	publisher *dispatcher.EventPublisher,
) *RollbackTaskHandler

NewRollbackTaskHandler creates a new RollbackTaskHandler.

func (*RollbackTaskHandler) Handle

type StartInstanceCmd

type StartInstanceCmd struct {
	cqrs.BaseCommand

	TenantID         string
	FlowCode         string
	Applicant        approval.OperatorInfo
	BusinessRecordID *string
	FormData         map[string]any
}

StartInstanceCmd starts a new approval flow instance.

type StartInstanceHandler

type StartInstanceHandler struct {
	// contains filtered or unexported fields
}

StartInstanceHandler handles the StartInstanceCmd command.

func NewStartInstanceHandler

func NewStartInstanceHandler(
	db orm.DB,
	engine *engine.FlowEngine,
	instanceNoGenerator approval.InstanceNoGenerator,
	publisher *dispatcher.EventPublisher,
	validationSvc *service.ValidationService,
) *StartInstanceHandler

NewStartInstanceHandler creates a new StartInstanceHandler.

func (*StartInstanceHandler) Handle

type TerminateInstanceCmd

type TerminateInstanceCmd struct {
	cqrs.BaseCommand

	InstanceID string
	Operator   approval.OperatorInfo
	Reason     string
}

TerminateInstanceCmd terminates a running approval instance (admin operation).

type TerminateInstanceHandler

type TerminateInstanceHandler struct {
	// contains filtered or unexported fields
}

TerminateInstanceHandler handles the TerminateInstanceCmd command.

func NewTerminateInstanceHandler

func NewTerminateInstanceHandler(
	db orm.DB,
	taskSvc *service.TaskService,
	publisher *dispatcher.EventPublisher,
) *TerminateInstanceHandler

NewTerminateInstanceHandler creates a new TerminateInstanceHandler.

func (*TerminateInstanceHandler) Handle

type ToggleFlowActiveCmd

type ToggleFlowActiveCmd struct {
	cqrs.BaseCommand

	FlowID   string
	IsActive bool
}

ToggleFlowActiveCmd toggles the active status of a flow.

type ToggleFlowActiveHandler

type ToggleFlowActiveHandler struct {
	// contains filtered or unexported fields
}

ToggleFlowActiveHandler handles the ToggleFlowActiveCmd command.

func NewToggleFlowActiveHandler

func NewToggleFlowActiveHandler(db orm.DB) *ToggleFlowActiveHandler

NewToggleFlowActiveHandler creates a new ToggleFlowActiveHandler.

func (*ToggleFlowActiveHandler) Handle

type TransferTaskCmd

type TransferTaskCmd struct {
	cqrs.BaseCommand

	TaskID       string
	Operator     approval.OperatorInfo
	Opinion      string
	FormData     map[string]any
	TransferToID string
}

TransferTaskCmd transfers a pending task to another user.

type TransferTaskHandler

type TransferTaskHandler struct {
	// contains filtered or unexported fields
}

TransferTaskHandler handles the TransferTaskCmd command.

func NewTransferTaskHandler

func NewTransferTaskHandler(
	db orm.DB,
	taskSvc *service.TaskService,
	validationSvc *service.ValidationService,
	publisher *dispatcher.EventPublisher,
	userResolver approval.UserInfoResolver,
) *TransferTaskHandler

NewTransferTaskHandler creates a new TransferTaskHandler.

func (*TransferTaskHandler) Handle

type UpdateFlowCmd

type UpdateFlowCmd struct {
	cqrs.BaseCommand

	FlowID                 string
	Name                   string
	Icon                   *string
	Description            *string
	AdminUserIDs           []string
	IsAllInitiationAllowed bool
	InstanceTitleTemplate  string
	Initiators             []shared.CreateFlowInitiatorCmd
}

UpdateFlowCmd updates an existing flow.

type UpdateFlowHandler

type UpdateFlowHandler struct {
	// contains filtered or unexported fields
}

UpdateFlowHandler handles the UpdateFlowCmd command.

func NewUpdateFlowHandler

func NewUpdateFlowHandler(db orm.DB) *UpdateFlowHandler

NewUpdateFlowHandler creates a new UpdateFlowHandler.

func (*UpdateFlowHandler) Handle

type UrgeTaskCmd

type UrgeTaskCmd struct {
	cqrs.BaseCommand

	TaskID  string
	UrgerID string
	Message string
}

UrgeTaskCmd sends an urge notification for a pending task.

type UrgeTaskHandler

type UrgeTaskHandler struct {
	// contains filtered or unexported fields
}

UrgeTaskHandler handles the UrgeTaskCmd command.

func NewUrgeTaskHandler

func NewUrgeTaskHandler(db orm.DB, taskSvc *service.TaskService, publisher *dispatcher.EventPublisher, userResolver approval.UserInfoResolver) *UrgeTaskHandler

NewUrgeTaskHandler creates a new UrgeTaskHandler.

func (*UrgeTaskHandler) Handle

func (h *UrgeTaskHandler) Handle(ctx context.Context, cmd UrgeTaskCmd) (cqrs.Unit, error)

type WithdrawCmd

type WithdrawCmd struct {
	cqrs.BaseCommand

	InstanceID string
	Operator   approval.OperatorInfo
	Reason     string
}

WithdrawCmd withdraws an approval instance.

type WithdrawHandler

type WithdrawHandler struct {
	// contains filtered or unexported fields
}

WithdrawHandler handles the WithdrawCmd command.

func NewWithdrawHandler

func NewWithdrawHandler(
	db orm.DB,
	taskSvc *service.TaskService,
	publisher *dispatcher.EventPublisher,
) *WithdrawHandler

NewWithdrawHandler creates a new WithdrawHandler.

func (*WithdrawHandler) Handle

func (h *WithdrawHandler) Handle(ctx context.Context, cmd WithdrawCmd) (cqrs.Unit, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL