Make validation less verbose (#24)

This commit is contained in:
konrad 2018-11-25 21:38:50 +00:00 committed by Gitea
parent e5c1588576
commit b73786f7fe
5 changed files with 5 additions and 5 deletions

View file

@ -10,7 +10,7 @@ type List struct {
OwnerID int64 `xorm:"int(11) INDEX" json:"-"`
NamespaceID int64 `xorm:"int(11) INDEX" json:"-" param:"namespace"`
Owner User `xorm:"-" json:"owner"`
Owner User `xorm:"-" json:"owner" valid:"-"`
Tasks []*ListTask `xorm:"-" json:"tasks"`
Created int64 `xorm:"created" json:"created"`

View file

@ -14,7 +14,7 @@ type ListTask struct {
Created int64 `xorm:"created" json:"created"`
Updated int64 `xorm:"updated" json:"updated"`
CreatedBy User `xorm:"-" json:"createdBy"`
CreatedBy User `xorm:"-" json:"createdBy" valid:"-"`
CRUDable `xorm:"-" json:"-"`
Rights `xorm:"-" json:"-"`

View file

@ -76,7 +76,7 @@ func (i *ListTask) Update() (err error) {
ot.Done = false
}
_, err = x.ID(i.ID).Cols("text", "description", "done", "due_date_unix", "reminder_unix").Update(ot)
_, err = x.ID(i.ID).Cols("text", "description", "done", "due_date_unix", "reminders_unix").Update(ot)
*i = ot
return
}

View file

@ -9,7 +9,7 @@ type Namespace struct {
Description string `xorm:"varchar(1000)" json:"description" valid:"runelength(0|250)"`
OwnerID int64 `xorm:"int(11) not null INDEX" json:"-"`
Owner User `xorm:"-" json:"owner"`
Owner User `xorm:"-" json:"owner" valid:"-"`
Created int64 `xorm:"created" json:"created"`
Updated int64 `xorm:"updated" json:"updated"`

View file

@ -15,7 +15,7 @@ type UserLogin struct {
// User holds information about an user
type User struct {
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(5|250)"`
Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)"`
Password string `xorm:"varchar(250) not null" json:"-"`
Email string `xorm:"varchar(250)" json:"email" valid:"email,length(0|250)"`
IsActive bool `json:"-"`