-
Notifications
You must be signed in to change notification settings - Fork 121
/
req_system.go
27 lines (23 loc) · 1.08 KB
/
req_system.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package vo
import (
"github.com/astaxie/beego/validation"
"github.com/nvwa-io/nvwa-io/nvwa-server/entities"
)
type ReqSystem struct {
System entities.SystemEntity `json:"system"`
}
// validate request system params
func (t *ReqSystem) Valid(valid validation.Validation) error {
//valid.Min(t.App.ProjectId, 1, "project_id").Message(lang.I("project.id.invalid"))
//valid.Required(t.App.Name, "name").Message(lang.I("app.name.not.empty"))
//valid.Required(t.App.RepoUrl, "repo_url").Message(lang.I("app.repo_url.not.empty"))
//valid.Required(t.App.DeployUser, "deploy_user").Message(lang.I("app.deploy_user.not.empty"))
//valid.Min(t.App.DeployType, 1, "deploy_type").Message(lang.I("app.deploy_type.invalid"))
//valid.Min(t.App.AppType, 1, "app_type").Message(lang.I("app.app_type.invalid"))
//valid.Required(t.App.RepoType, "repo_type").Message(lang.I("app.repo_type.not.empty"))
//valid.Required(t.App.CmdTimeout, "cmd_timeout").Message(lang.I("app.cmd_timeout.not.empty"))
if valid.HasErrors() {
return valid.Errors[0]
}
return nil
}