update_client_version.go 1.1 KB
package command

import (
	"fmt"
	"github.com/tiptok/godevp/pkg/domain"

	"github.com/astaxie/beego/validation"
)

type UpdateClientVersionCommand struct {
	// dcc
	Id int64 `json:"id" valid:"Required"`
	// 提交人
	Commiter string `json:"commiter,omitempty"`
	// 项目名称
	ProjectName string `json:"projectName,omitempty"`
	// 版本号
	Version string `json:"version,omitempty"`
	// 标题
	Title string `json:"title,omitempty"`
	// 其他备注信息
	Remark string `json:"remark,omitempty"`
	// 客户端安装包信息
	ClientPackageInfo []*domain.ClientPackageInfo `json:"clientPackageInfo,omitempty"`
}

func (updateClientVersionCommand *UpdateClientVersionCommand) Valid(validation *validation.Validation) {
	validation.SetError("CustomValid", "未实现的自定义认证")
}

func (updateClientVersionCommand *UpdateClientVersionCommand) ValidateCommand() error {
	valid := validation.Validation{}
	b, err := valid.Valid(updateClientVersionCommand)
	if err != nil {
		return err
	}
	if !b {
		for _, validErr := range valid.Errors {
			return fmt.Errorf("%s  %s", validErr.Key, validErr.Message)
		}
	}
	return nil
}