Changeset 0.26.0 (#165)
This commit is contained in:
69
server/models/workflow.go
Normal file
69
server/models/workflow.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ── Workflow ────────────────────────────────
|
||||
|
||||
// Workflow is a team-owned or global staged process definition.
|
||||
type Workflow struct {
|
||||
ID string `json:"id"`
|
||||
TeamID *string `json:"team_id,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
Branding json.RawMessage `json:"branding"`
|
||||
EntryMode string `json:"entry_mode"` // public_link | team_only
|
||||
IsActive bool `json:"is_active"`
|
||||
Version int `json:"version"`
|
||||
OnComplete json.RawMessage `json:"on_complete,omitempty"`
|
||||
Retention json.RawMessage `json:"retention"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
// Joined data (not stored directly)
|
||||
Stages []WorkflowStage `json:"stages,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowPatch contains optional fields for updating a workflow.
|
||||
type WorkflowPatch struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Branding *json.RawMessage `json:"branding,omitempty"`
|
||||
EntryMode *string `json:"entry_mode,omitempty"`
|
||||
IsActive *bool `json:"is_active,omitempty"`
|
||||
OnComplete *json.RawMessage `json:"on_complete,omitempty"`
|
||||
Retention *json.RawMessage `json:"retention,omitempty"`
|
||||
}
|
||||
|
||||
// ── Workflow Stage ──────────────────────────
|
||||
|
||||
// WorkflowStage is an ordered step within a workflow definition.
|
||||
type WorkflowStage struct {
|
||||
ID string `json:"id"`
|
||||
WorkflowID string `json:"workflow_id"`
|
||||
Ordinal int `json:"ordinal"`
|
||||
Name string `json:"name"`
|
||||
PersonaID *string `json:"persona_id,omitempty"`
|
||||
AssignmentTeamID *string `json:"assignment_team_id,omitempty"`
|
||||
FormTemplate json.RawMessage `json:"form_template"`
|
||||
HistoryMode string `json:"history_mode"` // full | summary | fresh
|
||||
AutoTransition bool `json:"auto_transition"`
|
||||
TransitionRules json.RawMessage `json:"transition_rules"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// ── Workflow Version (immutable snapshot) ───
|
||||
|
||||
// WorkflowVersion is an immutable snapshot of a workflow definition
|
||||
// at a point in time. Active workflow instances run against a pinned version.
|
||||
type WorkflowVersion struct {
|
||||
ID string `json:"id"`
|
||||
WorkflowID string `json:"workflow_id"`
|
||||
VersionNumber int `json:"version_number"`
|
||||
Snapshot json.RawMessage `json:"snapshot"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user