Skip to content

Commit

Permalink
modify param check
Browse files Browse the repository at this point in the history
  • Loading branch information
wizard-xie committed Jul 21, 2021
1 parent 360bc71 commit d8e3ced
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions dbmodels/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type CLAOfLink struct {
}

type OrgRepo struct {
Platform string `json:"platform" required:"true"`
OrgID string `json:"org_id" required:"true"`
RepoID string `json:"repo_id" required:"true"`
Platform string `json:"platform"`
OrgID string `json:"org_id"`
RepoID string `json:"repo_id"`
}

func (this OrgRepo) OrgRepoID() string {
Expand Down
9 changes: 4 additions & 5 deletions models/corporation-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ import (
"fmt"
"strings"

"github.com/huaweicloud/golangsdk"
"github.com/opensourceways/app-cla-server/dbmodels"
"github.com/opensourceways/app-cla-server/util"
)

type CorporationManagerAuthentication struct {
User string `json:"user" required:"true"`
Password string `json:"password" required:"true"`
User string `json:"user"`
Password string `json:"password"`
dbmodels.OrgRepo
}

func (this CorporationManagerAuthentication) Validate() IModelError {
if _, err := golangsdk.BuildRequestBody(this, ""); err != nil {
return newModelError(ErrEmptyPayload, fmt.Errorf("necessary parameters error: %s", err.Error()))
if this.Platform == "" || this.OrgID == "" || this.Password == "" || this.User == "" {
return newModelError(ErrEmptyPayload, fmt.Errorf("necessary parameters is empty"))
}

return nil
Expand Down

0 comments on commit d8e3ced

Please sign in to comment.