Update git remote URL from git.threefold.info to git.ourworld.tf
This commit is contained in:
		
							
								
								
									
										59
									
								
								specs/modelsold/flow/flow.v
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								specs/modelsold/flow/flow.v
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
module flow
 | 
			
		||||
 | 
			
		||||
import base
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
// enums from flow_enums.v and FlowStep from flow_step.v are used as they are in the same module
 | 
			
		||||
 | 
			
		||||
// Flow represents a complete workflow with multiple steps
 | 
			
		||||
pub struct Flow {
 | 
			
		||||
	base.Base // For common fields like id, created_at, updated_at
 | 
			
		||||
pub mut:
 | 
			
		||||
	name                string
 | 
			
		||||
	description         string
 | 
			
		||||
	flow_type           string
 | 
			
		||||
	status              FlowStatus
 | 
			
		||||
	current_step_id     string // Optional: Based on Option<FlowStep> in Rust, storing just ID
 | 
			
		||||
	progress_percentage u8
 | 
			
		||||
	owner_id            string
 | 
			
		||||
	owner_name          string
 | 
			
		||||
	data                string // Serialized JSON data (jsonb in Rust)
 | 
			
		||||
	steps               []FlowStep
 | 
			
		||||
	// current_step is not directly mapped, as it's derived. current_step_id can be used.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FlowStatus defines the overall status of a flow
 | 
			
		||||
pub enum FlowStatus {
 | 
			
		||||
	in_progress
 | 
			
		||||
	completed
 | 
			
		||||
	stuck
 | 
			
		||||
	cancelled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FlowStep represents an individual step within a larger flow
 | 
			
		||||
pub struct FlowStep {
 | 
			
		||||
pub mut:
 | 
			
		||||
	id           string // UUID, from Uuid::new_v4().to_string()
 | 
			
		||||
	name         string
 | 
			
		||||
	description  string
 | 
			
		||||
	status       StepStatus
 | 
			
		||||
	order        u32
 | 
			
		||||
	started_at   ourtime.OurTime // Optional: Option<DateTime<Utc>>
 | 
			
		||||
	completed_at ourtime.OurTime // Optional: Option<DateTime<Utc>>
 | 
			
		||||
	logs         []FlowLog
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// StepStatus defines the status of an individual step within a flow
 | 
			
		||||
pub enum StepStatus {
 | 
			
		||||
	pending
 | 
			
		||||
	in_progress
 | 
			
		||||
	completed
 | 
			
		||||
	stuck
 | 
			
		||||
	skipped
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FlowLog represents a log entry within a flow step
 | 
			
		||||
pub struct FlowLog {
 | 
			
		||||
pub mut:
 | 
			
		||||
	timestamp ourtime.OurTime
 | 
			
		||||
	message   string
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user