feat: simplify SOP to immediate-effect configuration
This commit is contained in:
@@ -45,15 +45,21 @@ type TenantMember struct {
|
||||
|
||||
type Scenario struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
Name string `json:"name" gorm:"size:128;not null"`
|
||||
Industry string `json:"industry" gorm:"size:64;not null"`
|
||||
RoleName string `json:"role_name" gorm:"size:64;not null"`
|
||||
Goal string `json:"goal" gorm:"type:text;not null"`
|
||||
TriggerText string `json:"trigger_text" gorm:"type:text;not null"`
|
||||
Visibility string `json:"visibility" gorm:"size:24;not null"`
|
||||
Status string `json:"status" gorm:"size:24;not null"`
|
||||
CreatedBy uint64 `json:"created_by" gorm:"not null"`
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
ScenarioKey string `json:"scenario_key" gorm:"size:128;not null;index"`
|
||||
PublicKey string `json:"public_key" gorm:"size:128;not null;index"`
|
||||
AllowedOrigins datatypes.JSON `json:"allowed_origins" gorm:"type:json;not null"`
|
||||
Name string `json:"name" gorm:"size:128;not null"`
|
||||
Industry string `json:"industry" gorm:"size:64;not null"`
|
||||
RoleName string `json:"role_name" gorm:"size:64;not null"`
|
||||
Goal string `json:"goal" gorm:"type:text;not null"`
|
||||
TriggerText string `json:"trigger_text" gorm:"type:text;not null"`
|
||||
Visibility string `json:"visibility" gorm:"size:24;not null"`
|
||||
Status string `json:"status" gorm:"size:24;not null"`
|
||||
CreatedBy uint64 `json:"created_by" gorm:"not null"`
|
||||
InputSchema datatypes.JSON `json:"input_schema" gorm:"type:json;not null"`
|
||||
OutputSchema datatypes.JSON `json:"output_schema" gorm:"type:json;not null"`
|
||||
ResultSchema datatypes.JSON `json:"result_schema" gorm:"type:json;not null"`
|
||||
}
|
||||
|
||||
type ScenarioField struct {
|
||||
@@ -62,6 +68,7 @@ type ScenarioField struct {
|
||||
ScenarioID uint64 `json:"scenario_id" gorm:"not null;index"`
|
||||
FieldKey string `json:"field_key" gorm:"size:64;not null"`
|
||||
FieldName string `json:"field_name" gorm:"size:128;not null"`
|
||||
SourcePath string `json:"source_path" gorm:"size:255;not null"`
|
||||
FieldType string `json:"field_type" gorm:"size:32;not null"`
|
||||
Required bool `json:"required" gorm:"not null"`
|
||||
Options datatypes.JSON `json:"options" gorm:"type:json;not null"`
|
||||
@@ -69,6 +76,18 @@ type ScenarioField struct {
|
||||
SortOrder int `json:"sort_order" gorm:"not null"`
|
||||
}
|
||||
|
||||
type ScenarioRule struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
ScenarioID uint64 `json:"scenario_id" gorm:"not null;index"`
|
||||
RuleKey string `json:"rule_key" gorm:"size:64;not null"`
|
||||
Name string `json:"name" gorm:"size:128;not null"`
|
||||
Condition datatypes.JSON `json:"condition" gorm:"type:json;not null"`
|
||||
Actions datatypes.JSON `json:"actions" gorm:"type:json;not null"`
|
||||
Priority int `json:"priority" gorm:"not null"`
|
||||
Status string `json:"status" gorm:"size:24;not null"`
|
||||
}
|
||||
|
||||
type SOP struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
@@ -88,7 +107,6 @@ type SOPVersion struct {
|
||||
StartNodeKey string `json:"start_node_key" gorm:"size:64;not null"`
|
||||
PublishedAt *time.Time `json:"published_at"`
|
||||
CreatedBy uint64 `json:"created_by" gorm:"not null"`
|
||||
ReviewedBy *uint64 `json:"reviewed_by"`
|
||||
}
|
||||
|
||||
type SOPNode struct {
|
||||
@@ -132,18 +150,47 @@ type KnowledgeCardVersion struct {
|
||||
Status string `json:"status" gorm:"size:24;not null"`
|
||||
}
|
||||
|
||||
type KnowledgeItem struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
ScenarioID uint64 `json:"scenario_id" gorm:"not null;index"`
|
||||
ItemKey string `json:"key" gorm:"size:64;not null"`
|
||||
Name string `json:"name" gorm:"size:128;not null"`
|
||||
Type string `json:"type" gorm:"size:64;not null"`
|
||||
Content datatypes.JSON `json:"content" gorm:"type:json;not null"`
|
||||
Status string `json:"status" gorm:"size:24;not null"`
|
||||
SortOrder int `json:"sort_order" gorm:"not null"`
|
||||
}
|
||||
|
||||
type KnowledgeRelation struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
ScenarioID uint64 `json:"scenario_id" gorm:"not null;index"`
|
||||
FromKnowledgeID uint64 `json:"from_knowledge_id" gorm:"not null;index"`
|
||||
RelationType string `json:"relation_type" gorm:"size:64;not null"`
|
||||
ToKnowledgeID uint64 `json:"to_knowledge_id" gorm:"not null;index"`
|
||||
Condition datatypes.JSON `json:"condition" gorm:"type:json;not null"`
|
||||
SortOrder int `json:"sort_order" gorm:"not null"`
|
||||
}
|
||||
|
||||
type SOPRun struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
SOPID uint64 `json:"sop_id" gorm:"not null;index"`
|
||||
SOPVersionID uint64 `json:"sop_version_id" gorm:"not null;index"`
|
||||
OperatorID uint64 `json:"operator_id" gorm:"not null;index"`
|
||||
CurrentNodeKey string `json:"current_node_key" gorm:"size:64;not null"`
|
||||
Status string `json:"status" gorm:"size:24;not null"`
|
||||
Answers datatypes.JSON `json:"answers" gorm:"type:json;not null"`
|
||||
Result string `json:"result" gorm:"size:64;not null"`
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
CompletedAt *time.Time `json:"completed_at"`
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
SOPID uint64 `json:"sop_id" gorm:"not null;index"`
|
||||
SOPVersionID uint64 `json:"sop_version_id" gorm:"not null;index"`
|
||||
OperatorID uint64 `json:"operator_id" gorm:"not null;index"`
|
||||
ExternalRef string `json:"external_ref" gorm:"size:191;not null;index"`
|
||||
CurrentNodeKey string `json:"current_node_key" gorm:"size:64;not null"`
|
||||
Status string `json:"status" gorm:"size:24;not null"`
|
||||
Answers datatypes.JSON `json:"answers" gorm:"type:json;not null"`
|
||||
Input datatypes.JSON `json:"input" gorm:"type:json;not null"`
|
||||
Derived datatypes.JSON `json:"derived" gorm:"type:json;not null"`
|
||||
Outputs datatypes.JSON `json:"outputs" gorm:"type:json;not null"`
|
||||
KnowledgeSnapshot datatypes.JSON `json:"knowledge_snapshot" gorm:"type:json;not null"`
|
||||
Result string `json:"result" gorm:"size:64;not null"`
|
||||
FinalResult datatypes.JSON `json:"final_result" gorm:"type:json"`
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
CompletedAt *time.Time `json:"completed_at"`
|
||||
}
|
||||
|
||||
type SOPRunEvent struct {
|
||||
@@ -155,6 +202,14 @@ type SOPRunEvent struct {
|
||||
Payload datatypes.JSON `json:"payload" gorm:"type:json;not null"`
|
||||
}
|
||||
|
||||
type PublicRunSession struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
RunID uint64 `json:"run_id" gorm:"not null;index"`
|
||||
TokenHash string `json:"-" gorm:"size:64;not null;uniqueIndex"`
|
||||
ExpiresAt time.Time `json:"expires_at" gorm:"not null"`
|
||||
}
|
||||
|
||||
type SOPFeedback struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
@@ -176,6 +231,23 @@ type AuditLog struct {
|
||||
Payload datatypes.JSON `json:"payload" gorm:"type:json;not null"`
|
||||
}
|
||||
|
||||
type MultiTableOutbox struct {
|
||||
Base
|
||||
TenantID uint64 `gorm:"not null;index"`
|
||||
AuditLogID *uint64 `gorm:"uniqueIndex"`
|
||||
Resource string `gorm:"size:64;not null;index"`
|
||||
ResourceID uint64 `gorm:"not null;index"`
|
||||
Action string `gorm:"size:64;not null"`
|
||||
Payload datatypes.JSON `gorm:"type:json;not null"`
|
||||
DedupeKey string `gorm:"size:191;not null;uniqueIndex"`
|
||||
Status string `gorm:"size:24;not null;index"`
|
||||
Attempts int `gorm:"not null"`
|
||||
AvailableAt time.Time `gorm:"not null;index"`
|
||||
LastError string `gorm:"type:text;not null"`
|
||||
}
|
||||
|
||||
func (MultiTableOutbox) TableName() string { return "multitable_outbox" }
|
||||
|
||||
type RefreshToken struct {
|
||||
Base
|
||||
TenantID uint64 `json:"tenant_id" gorm:"not null;index"`
|
||||
|
||||
Reference in New Issue
Block a user