rts-sim-testing-service/dto/projectRunConfig.go
2023-10-24 16:37:27 +08:00

44 lines
1.3 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"`
Description string `json:"description" form:"description"`
ConfigContent string `json:"config" form:"config"`
}
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"`
}
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
}