admin-dashboard-backend/modules/structs/grouptasks.go

78 lines
2.0 KiB
Go

package structs
import (
"time"
)
// structure for database
const (
GroupTasksStatusFinished uint8 = 1
GroupTasksStatusRunning uint8 = 2
GroupTasksStatusCanceled uint8 = 3
GroupTasksStatusFailed uint8 = 4
GroupTasksStatusInputRequired uint8 = 5
)
type GroupTasks struct {
Id string
Category string
GroupId string
GroupName string
CurrentTasksStep uint8
NumberOfSteps uint8
Status uint8
GlobalInputs string `gorm:"type:json"`
StartedAt time.Time
EndedAt time.Time
RememberId string `gorm:"-"` // used by the web client who requested this to open the modal after the backend sent the NewGroupTaskStarted message
}
type GroupTaskSteps struct {
Id string
GroupTasksId string
Step uint8
Status uint8
Log string `gorm:"type:text"`
Inputs string `gorm:"type:json"`
StartedAt time.Time
EndedAt time.Time
}
// read from file structure
type CategoryGroup struct {
Category string `json:"category"`
Groups []Group `json:"groups"`
}
type Group struct {
Category string `json:"category"`
Id string `json:"id"`
Name string `json:"name"`
GlobalInputs []GlobalInputs `json:"globalInputs"`
Tasks []Task `json:"tasks"`
}
type GlobalInputs struct {
ParameterName string `json:"parameterName"`
Type string `json:"type"`
DisplayName string `json:"displayName"`
}
type Task struct {
Name string `json:"name"`
OnFinish string `json:"onFinish"`
UndoPossible bool `json:"undoPossible"`
ScriptPath string `json:"scriptPath"`
Parameters []TaskParameter `json:"parameters"` // same as task inputs
Feedback string `json:"feedback"`
}
type TaskParameter struct {
ParameterName string `json:"parameterName"`
Type string `json:"type"`
DisplayName string `json:"displayName"`
Global bool `json:"global"`
}