57 lines
2.0 KiB
Go
57 lines
2.0 KiB
Go
package dto
|
|
|
|
import "joylink.club/bj-rtsts-server/db/model"
|
|
|
|
type PageProjectRunConfigReqDto struct {
|
|
PageQueryDto
|
|
Name string `json:"name" form:"name"`
|
|
}
|
|
|
|
type ProjectRunConfigReqDto struct {
|
|
Id int32 `json:"id" form:"id"`
|
|
Name string `json:"name" form:"name" binding:"required"`
|
|
Description string `json:"description" form:"description"`
|
|
ConfigContent string `json:"config" form:"config" binding:"required"`
|
|
}
|
|
|
|
type ProjectRunConfigDto struct {
|
|
Id int32 `json:"id" form:"id"`
|
|
Name string `json:"name" form:"name"`
|
|
Description string `json:"description" form:"description"`
|
|
ConfigContent string `json:"config" form:"config"`
|
|
CreatedAt JsonTime `json:"createdAt" time_format:"2006-01-02 15:04:05"`
|
|
UpdateAt JsonTime `json:"updateAt" time_format:"2006-01-02 15:04:05"`
|
|
}
|
|
|
|
type RunConfigDescription struct {
|
|
FieldName string `json:"fieldName" form:"fieldName"`
|
|
Description string `json:"description" form:"description"`
|
|
Type string `json:"type" form:"type"`
|
|
DefaultValue string `json:"defaultValue" form:"defaultValue"`
|
|
SelectOptions []*RunConfigSelectOption `json:"selectOptions" form:"selectOptions"`
|
|
ItemTypeFields []*RunConfigDescription `json:"itemTypeFields" form:"itemTypeFields"`
|
|
}
|
|
type RunConfigSelectOption struct {
|
|
Label string `json:"label" form:"label"`
|
|
Value int32 `json:"value" form:"value"`
|
|
}
|
|
|
|
func ConvertToRunConfigDto(gi *model.ProjectRunConfig) *ProjectRunConfigDto {
|
|
return &ProjectRunConfigDto{
|
|
Id: gi.ID,
|
|
Name: gi.Name,
|
|
Description: gi.Description,
|
|
ConfigContent: gi.ConfigContent,
|
|
CreatedAt: JsonTime(gi.CreateTime),
|
|
UpdateAt: JsonTime(gi.UpdateTime),
|
|
}
|
|
}
|
|
|
|
func ConvertToRunConfigFromSlice(giSlice []*model.ProjectRunConfig) []*ProjectRunConfigDto {
|
|
var result []*ProjectRunConfigDto
|
|
for _, gi := range giSlice {
|
|
result = append(result, ConvertToRunConfigDto(gi))
|
|
}
|
|
return result
|
|
}
|