From b73786f7fe2fce1985dc58d8b8a72ed34a05f286 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 25 Nov 2018 21:38:50 +0000 Subject: [PATCH] Make validation less verbose (#24) --- pkg/models/list.go | 2 +- pkg/models/list_tasks.go | 2 +- pkg/models/list_tasks_create_update.go | 2 +- pkg/models/namespace.go | 2 +- pkg/models/user.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/models/list.go b/pkg/models/list.go index 97bcdc92..6ae7e6ce 100644 --- a/pkg/models/list.go +++ b/pkg/models/list.go @@ -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"` diff --git a/pkg/models/list_tasks.go b/pkg/models/list_tasks.go index 85bf08c9..07e2852a 100644 --- a/pkg/models/list_tasks.go +++ b/pkg/models/list_tasks.go @@ -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:"-"` diff --git a/pkg/models/list_tasks_create_update.go b/pkg/models/list_tasks_create_update.go index 810aef7a..7f6b8de9 100644 --- a/pkg/models/list_tasks_create_update.go +++ b/pkg/models/list_tasks_create_update.go @@ -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 } diff --git a/pkg/models/namespace.go b/pkg/models/namespace.go index debec602..95d1f21a 100644 --- a/pkg/models/namespace.go +++ b/pkg/models/namespace.go @@ -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"` diff --git a/pkg/models/user.go b/pkg/models/user.go index 5bd31e09..9f13d983 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -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:"-"`