Documentation
¶
Index ¶
- Variables
- type AddAssigneeCmd
- type AddAssigneeHandler
- type AddCCCmd
- type AddCCHandler
- type ApproveTaskCmd
- type ApproveTaskHandler
- 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 ResubmitInstanceCmd
- type ResubmitInstanceHandler
- 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 WithdrawInstanceCmd
- type WithdrawInstanceHandler
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, NewWithdrawInstanceHandler, NewResubmitInstanceHandler, 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.UserInfo
Caller approval.CallerContext
}
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, 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
Operator approval.UserInfo
Caller approval.CallerContext
}
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, instanceSvc *service.InstanceService, userResolver approval.UserInfoResolver) *AddCCHandler
NewAddCCHandler creates a new AddCCHandler.
type ApproveTaskCmd ¶
type ApproveTaskCmd struct {
cqrs.BaseCommand
TaskID string
Operator approval.UserInfo
Opinion string
FormData map[string]any
Attachments []string
Caller approval.CallerContext
}
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, formStorage *storage.Dispatcher, ) *ApproveTaskHandler
NewApproveTaskHandler creates a new ApproveTaskHandler. formStorage refreshes the table-mode physical projection after an approver edits form data; it may be nil in test fixtures that do not exercise table-mode storage.
func (*ApproveTaskHandler) Handle ¶
func (h *ApproveTaskHandler) Handle(ctx context.Context, cmd ApproveTaskCmd) (cqrs.Unit, error)
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
BusinessStatusField *string
AdminUserIDs []string
IsAllInitiationAllowed bool
InstanceTitleTemplate string
Initiators []shared.CreateFlowInitiatorCmd
Caller approval.CallerContext
}
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
StorageMode approval.StorageMode
FlowDefinition approval.FlowDefinition
FormDefinition *approval.FormDefinition
Caller approval.CallerContext
}
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
Caller approval.CallerContext
}
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
Caller approval.CallerContext
}
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, flowCache *engine.FlowCache, formStorage *storage.Dispatcher) *PublishVersionHandler
NewPublishVersionHandler creates a new PublishVersionHandler. flowCache may be nil in test fixtures; production wiring always supplies it so archived versions are evicted from the compiled-flow cache before any new instance picks up a stale plan. formStorage provisions the version's physical form table when its StorageMode is StorageTable; it may be nil in test fixtures that do not exercise table-mode storage.
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.UserInfo
Reason string
Caller approval.CallerContext
}
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, taskSvc *service.TaskService, 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.UserInfo
Opinion string
FormData map[string]any
Attachments []string
Caller approval.CallerContext
}
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, formStorage *storage.Dispatcher, ) *RejectTaskHandler
NewRejectTaskHandler creates a new RejectTaskHandler. formStorage refreshes the table-mode physical projection after a rejecter edits form data; it may be nil in test fixtures that do not exercise table-mode storage.
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.UserInfo
Caller approval.CallerContext
}
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, ) *RemoveAssigneeHandler
NewRemoveAssigneeHandler creates a new RemoveAssigneeHandler.
func (*RemoveAssigneeHandler) Handle ¶
func (h *RemoveAssigneeHandler) Handle(ctx context.Context, cmd RemoveAssigneeCmd) (cqrs.Unit, error)
type ResubmitInstanceCmd ¶ added in v0.35.0
type ResubmitInstanceCmd struct {
cqrs.BaseCommand
InstanceID string
Operator approval.UserInfo
FormData map[string]any
Caller approval.CallerContext
}
ResubmitInstanceCmd resubmits a returned instance.
type ResubmitInstanceHandler ¶ added in v0.35.0
type ResubmitInstanceHandler struct {
// contains filtered or unexported fields
}
ResubmitInstanceHandler handles the ResubmitInstanceCmd command.
func NewResubmitInstanceHandler ¶ added in v0.35.0
func NewResubmitInstanceHandler( db orm.DB, eng *engine.FlowEngine, validationSvc *service.ValidationService, instanceSvc *service.InstanceService, formStorage *storage.Dispatcher, ) *ResubmitInstanceHandler
NewResubmitInstanceHandler creates a new ResubmitInstanceHandler. formStorage refreshes the version's physical projection row — replacing the instance's prior row, never appending — when its StorageMode is StorageTable; it may be nil in test fixtures that do not exercise table-mode storage.
func (*ResubmitInstanceHandler) Handle ¶ added in v0.35.0
func (h *ResubmitInstanceHandler) Handle(ctx context.Context, cmd ResubmitInstanceCmd) (cqrs.Unit, error)
type RollbackTaskCmd ¶
type RollbackTaskCmd struct {
cqrs.BaseCommand
TaskID string
Operator approval.UserInfo
Opinion string
FormData map[string]any
TargetNodeID string
Attachments []string
Caller approval.CallerContext
}
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, instanceSvc *service.InstanceService, validationSvc *service.ValidationService, eng *engine.FlowEngine, formStorage *storage.Dispatcher, ) *RollbackTaskHandler
NewRollbackTaskHandler creates a new RollbackTaskHandler. formStorage refreshes the table-mode physical projection after a rollback rewrites form data; it may be nil in test fixtures that do not exercise table-mode storage.
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.UserInfo
BusinessRef *string
FormData map[string]any
// Globals is the host-supplied global-variable snapshot persisted onto the
// instance (Instance.Globals) and resolved by condition evaluation — field
// subjects and expression bindings alike. Snapshotting at start keeps
// routing deterministic across re-evaluation.
Globals map[string]any
Caller approval.CallerContext
}
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, validationSvc *service.ValidationService, refProvider approval.BusinessRefProvider, formStorage *storage.Dispatcher, ) *StartInstanceHandler
NewStartInstanceHandler creates a new StartInstanceHandler. formStorage projects the submitted form data into the version's physical table when its StorageMode is StorageTable; it may be nil in test fixtures that do not exercise table-mode storage.
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.UserInfo
Reason string
Caller approval.CallerContext
}
TerminateInstanceCmd force-closes an approval instance (admin operation). Running, returned, and withdrawn instances can all be terminated — the state machine is the single authority on which statuses may close.
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, instanceSvc *service.InstanceService, ) *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
Caller approval.CallerContext
}
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.UserInfo
Opinion string
FormData map[string]any
TransferToID string
Attachments []string
Caller approval.CallerContext
}
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, userResolver approval.UserInfoResolver, formStorage *storage.Dispatcher, ) *TransferTaskHandler
NewTransferTaskHandler creates a new TransferTaskHandler. formStorage refreshes the table-mode physical projection after a transferring user edits form data; it may be nil in test fixtures that do not exercise table-mode storage.
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
BindingMode approval.BindingMode
BusinessTable *string
BusinessPkField *string
BusinessStatusField *string
AdminUserIDs []string
IsAllInitiationAllowed bool
InstanceTitleTemplate string
Initiators []shared.CreateFlowInitiatorCmd
Caller approval.CallerContext
}
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
Caller approval.CallerContext
}
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, 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 WithdrawInstanceCmd ¶ added in v0.35.0
type WithdrawInstanceCmd struct {
cqrs.BaseCommand
InstanceID string
Operator approval.UserInfo
Reason string
Caller approval.CallerContext
}
WithdrawInstanceCmd withdraws an approval instance.
type WithdrawInstanceHandler ¶ added in v0.35.0
type WithdrawInstanceHandler struct {
// contains filtered or unexported fields
}
WithdrawInstanceHandler handles the WithdrawInstanceCmd command.
func NewWithdrawInstanceHandler ¶ added in v0.35.0
func NewWithdrawInstanceHandler( db orm.DB, taskSvc *service.TaskService, instanceSvc *service.InstanceService, ) *WithdrawInstanceHandler
NewWithdrawInstanceHandler creates a new WithdrawInstanceHandler.
func (*WithdrawInstanceHandler) Handle ¶ added in v0.35.0
func (h *WithdrawInstanceHandler) Handle(ctx context.Context, cmd WithdrawInstanceCmd) (cqrs.Unit, error)
Source Files
¶
- add_assignee.go
- add_cc.go
- approve_task.go
- create_flow.go
- deploy_flow.go
- flow_validation.go
- mark_cc_read.go
- module.go
- publish_version.go
- reassign_task.go
- reject_task.go
- remove_assignee.go
- resubmit_instance.go
- rollback_task.go
- start_instance.go
- terminate_instance.go
- toggle_flow_active.go
- transfer_task.go
- update_flow.go
- urge_task.go
- withdraw_instance.go