Documentation
¶
Index ¶
- Variables
- type AddAssigneeCmd
- type AddAssigneeHandler
- type AddCCCmd
- type AddCCHandler
- type ApproveTaskCmd
- type ApproveTaskHandler
- type AssigneeProvider
- type CCProvider
- type CreateFlowCmd
- type CreateFlowHandler
- type DeployFlowCmd
- type DeployFlowHandler
- type MarkCCReadCmd
- type MarkCCReadHandler
- type PublishVersionCmd
- type PublishVersionHandler
- type ReassignTaskCmd
- type ReassignTaskHandler
- type RejectTaskCmd
- type RejectTaskHandler
- type RemoveAssigneeCmd
- type RemoveAssigneeHandler
- type ResubmitCmd
- type ResubmitHandler
- type RollbackTaskCmd
- type RollbackTaskHandler
- type StartInstanceCmd
- type StartInstanceHandler
- type TerminateInstanceCmd
- type TerminateInstanceHandler
- type ToggleFlowActiveCmd
- type ToggleFlowActiveHandler
- type TransferTaskCmd
- type TransferTaskHandler
- type UpdateFlowCmd
- type UpdateFlowHandler
- type UrgeTaskCmd
- type UrgeTaskHandler
- type WithdrawCmd
- type WithdrawHandler
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module( "vef:approval:command", fx.Provide( fx.Private, NewCreateFlowHandler, NewDeployFlowHandler, NewPublishVersionHandler, NewUpdateFlowHandler, NewToggleFlowActiveHandler, NewApproveTaskHandler, NewRejectTaskHandler, NewTransferTaskHandler, NewRollbackTaskHandler, NewStartInstanceHandler, NewWithdrawHandler, NewResubmitHandler, NewAddCCHandler, NewMarkCCReadHandler, NewAddAssigneeHandler, NewRemoveAssigneeHandler, NewUrgeTaskHandler, NewTerminateInstanceHandler, NewReassignTaskHandler, ), fx.Invoke(registerHandlers), )
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 ¶
func (h *AddAssigneeHandler) Handle(ctx context.Context, cmd AddAssigneeCmd) (cqrs.Unit, error)
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.
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 ¶
func (h *ApproveTaskHandler) Handle(ctx context.Context, cmd ApproveTaskCmd) (cqrs.Unit, error)
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 ¶
func (h *CreateFlowHandler) Handle(ctx context.Context, cmd CreateFlowCmd) (*approval.Flow, error)
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 ¶
func (h *DeployFlowHandler) Handle(ctx context.Context, cmd DeployFlowCmd) (*approval.FlowVersion, error)
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 ¶
func (h *PublishVersionHandler) Handle(ctx context.Context, cmd PublishVersionCmd) (cqrs.Unit, error)
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 ¶
func (h *ReassignTaskHandler) Handle(ctx context.Context, cmd ReassignTaskCmd) (cqrs.Unit, error)
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 ¶
func (h *RemoveAssigneeHandler) Handle(ctx context.Context, cmd RemoveAssigneeCmd) (cqrs.Unit, error)
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 ¶
func (h *RollbackTaskHandler) Handle(ctx context.Context, cmd RollbackTaskCmd) (cqrs.Unit, error)
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 ¶
func (h *StartInstanceHandler) Handle(ctx context.Context, cmd StartInstanceCmd) (*approval.Instance, error)
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 ¶
func (h *TerminateInstanceHandler) Handle(ctx context.Context, cmd TerminateInstanceCmd) (cqrs.Unit, error)
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 ¶
func (h *ToggleFlowActiveHandler) Handle(ctx context.Context, cmd ToggleFlowActiveCmd) (cqrs.Unit, error)
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 ¶
func (h *TransferTaskHandler) Handle(ctx context.Context, cmd TransferTaskCmd) (cqrs.Unit, error)
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 ¶
func (h *UpdateFlowHandler) Handle(ctx context.Context, cmd UpdateFlowCmd) (*approval.Flow, error)
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)