feat: rename workflow_run_log to workflow_run

This commit is contained in:
Fu Diwei
2025-01-04 16:53:58 +08:00
parent 01ede08a79
commit b686579acc
9 changed files with 167 additions and 53 deletions

View File

@@ -0,0 +1,40 @@
package domain
import "time"
type WorkflowRun struct {
Meta
WorkflowId string `json:"workflowId" db:"workflowId"`
Trigger string `json:"trigger" db:"trigger"`
StartedAt time.Time `json:"startedAt" db:"startedAt"`
CompletedAt time.Time `json:"completedAt" db:"completedAt"`
Logs []WorkflowRunLog `json:"logs" db:"logs"`
Succeeded bool `json:"succeeded" db:"succeeded"`
Error string `json:"error" db:"error"`
}
type WorkflowRunLog struct {
NodeId string `json:"nodeId"`
NodeName string `json:"nodeName"`
Error string `json:"error"`
Outputs []WorkflowRunLogOutput `json:"outputs"`
}
type WorkflowRunLogOutput struct {
Time string `json:"time"`
Title string `json:"title"`
Content string `json:"content"`
Error string `json:"error"`
}
type WorkflowRunLogs []WorkflowRunLog
func (r WorkflowRunLogs) FirstError() string {
for _, log := range r {
if log.Error != "" {
return log.Error
}
}
return ""
}