feat: added dependency config setup (wip)

This commit is contained in:
Marvin Zhang
2024-12-15 23:09:10 +08:00
parent 3b54a63bed
commit c5c08dfba6
9 changed files with 295 additions and 88 deletions

View File

@@ -14,7 +14,6 @@ type Dependency struct {
Version string `json:"version" bson:"version"`
Status string `json:"status" bson:"status"`
Error string `json:"error,omitempty" bson:"error,omitempty"`
Logs []string `json:"logs,omitempty" bson:"logs,omitempty"`
NodeIds []primitive.ObjectID `json:"node_ids,omitempty" bson:"-"`
Versions []string `json:"versions,omitempty" bson:"-"`
}

View File

@@ -3,10 +3,9 @@ package models
type DependencyConfig struct {
any `collection:"dependency_configs"`
BaseModel[DependencyConfig] `bson:",inline"`
Key string `json:"key" bson:"key"`
Name string `json:"name" bson:"name"`
Cmd string `json:"cmd" bson:"cmd"`
Proxy string `json:"proxy" bson:"proxy"`
SetupNodeIds []string `json:"setup_node_ids" bson:"setup_node_ids"`
SetupScriptPath string `json:"setup_script_path" bson:"setup_script_path"`
Key string `json:"key" bson:"key"`
Name string `json:"name" bson:"name"`
ExecCmd string `json:"exec_cmd" bson:"exec_cmd"`
PkgCmd string `json:"pkg_cmd" bson:"pkg_cmd"`
Proxy string `json:"proxy" bson:"proxy"`
}

View File

@@ -0,0 +1,13 @@
package models
import "go.mongodb.org/mongo-driver/bson/primitive"
type DependencyConfigSetup struct {
any `collection:"dependency_config_setups"`
BaseModel[DependencyConfigSetup] `bson:",inline"`
DependencyConfigId primitive.ObjectID `json:"dependency_config_id" bson:"dependency_config_id"`
NodeId primitive.ObjectID `json:"node_id" bson:"node_id"`
Version string `json:"version" bson:"version"`
Status string `json:"status" bson:"status"`
Error string `json:"error,omitempty" bson:"error,omitempty"`
}

View File

@@ -5,6 +5,6 @@ import "go.mongodb.org/mongo-driver/bson/primitive"
type DependencyLog struct {
any `collection:"dependency_logs"`
BaseModel[DependencyLog] `bson:",inline"`
DependencyId primitive.ObjectID `json:"dependency_id" bson:"dependency_id"`
TargetId primitive.ObjectID `json:"target_id" bson:"target_id"`
Content string `json:"content" bson:"content"`
}