make validation less verbose (#23)
This commit is contained in:
parent
fded3c23d0
commit
d51ed8defd
9 changed files with 22 additions and 22 deletions
|
@ -5,7 +5,7 @@ import "sort"
|
||||||
// List represents a list of tasks
|
// List represents a list of tasks
|
||||||
type List struct {
|
type List struct {
|
||||||
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"list"`
|
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"list"`
|
||||||
Title string `xorm:"varchar(250)" json:"title" valid:"required,runelength(5|250)"`
|
Title string `xorm:"varchar(250)" json:"title" valid:"required,runelength(3|250)"`
|
||||||
Description string `xorm:"varchar(1000)" json:"description" valid:"runelength(0|1000)"`
|
Description string `xorm:"varchar(1000)" json:"description" valid:"runelength(0|1000)"`
|
||||||
OwnerID int64 `xorm:"int(11) INDEX" json:"-"`
|
OwnerID int64 `xorm:"int(11) INDEX" json:"-"`
|
||||||
NamespaceID int64 `xorm:"int(11) INDEX" json:"-" param:"namespace"`
|
NamespaceID int64 `xorm:"int(11) INDEX" json:"-" param:"namespace"`
|
||||||
|
@ -13,8 +13,8 @@ type List struct {
|
||||||
Owner User `xorm:"-" json:"owner"`
|
Owner User `xorm:"-" json:"owner"`
|
||||||
Tasks []*ListTask `xorm:"-" json:"tasks"`
|
Tasks []*ListTask `xorm:"-" json:"tasks"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
|
|
@ -3,7 +3,7 @@ package models
|
||||||
// ListTask represents an task in a todolist
|
// ListTask represents an task in a todolist
|
||||||
type ListTask struct {
|
type ListTask struct {
|
||||||
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"listtask"`
|
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"listtask"`
|
||||||
Text string `xorm:"varchar(250)" json:"text" valid:"runelength(5|250)"`
|
Text string `xorm:"varchar(250)" json:"text" valid:"runelength(3|250)"`
|
||||||
Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)"`
|
Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)"`
|
||||||
Done bool `xorm:"INDEX" json:"done"`
|
Done bool `xorm:"INDEX" json:"done"`
|
||||||
DueDateUnix int64 `xorm:"int(11) INDEX" json:"dueDate"`
|
DueDateUnix int64 `xorm:"int(11) INDEX" json:"dueDate"`
|
||||||
|
@ -11,8 +11,8 @@ type ListTask struct {
|
||||||
CreatedByID int64 `xorm:"int(11)" json:"-"` // ID of the user who put that task on the list
|
CreatedByID int64 `xorm:"int(11)" json:"-"` // ID of the user who put that task on the list
|
||||||
ListID int64 `xorm:"int(11) INDEX" json:"listID" param:"list"`
|
ListID int64 `xorm:"int(11) INDEX" json:"listID" param:"list"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CreatedBy User `xorm:"-" json:"createdBy"`
|
CreatedBy User `xorm:"-" json:"createdBy"`
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ type ListUser struct {
|
||||||
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"`
|
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"`
|
||||||
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
|
|
@ -11,8 +11,8 @@ type Namespace struct {
|
||||||
|
|
||||||
Owner User `xorm:"-" json:"owner"`
|
Owner User `xorm:"-" json:"owner"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
|
|
@ -7,8 +7,8 @@ type NamespaceUser struct {
|
||||||
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"`
|
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"`
|
||||||
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
|
|
@ -7,8 +7,8 @@ type TeamList struct {
|
||||||
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"`
|
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"`
|
||||||
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
|
|
@ -7,8 +7,8 @@ type TeamNamespace struct {
|
||||||
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"`
|
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"`
|
||||||
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
|
|
@ -10,8 +10,8 @@ type Team struct {
|
||||||
CreatedBy User `xorm:"-" json:"created_by"`
|
CreatedBy User `xorm:"-" json:"created_by"`
|
||||||
Members []*TeamUser `xorm:"-" json:"members"`
|
Members []*TeamUser `xorm:"-" json:"members"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
@ -42,8 +42,8 @@ type TeamMember struct {
|
||||||
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"`
|
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"`
|
||||||
Admin bool `xorm:"tinyint(1) INDEX" json:"admin"`
|
Admin bool `xorm:"tinyint(1) INDEX" json:"admin"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
|
|
||||||
CRUDable `xorm:"-" json:"-"`
|
CRUDable `xorm:"-" json:"-"`
|
||||||
Rights `xorm:"-" json:"-"`
|
Rights `xorm:"-" json:"-"`
|
||||||
|
|
|
@ -23,8 +23,8 @@ type User struct {
|
||||||
PasswordResetToken string `xorm:"varchar(450)" json:"-"`
|
PasswordResetToken string `xorm:"varchar(450)" json:"-"`
|
||||||
EmailConfirmToken string `xorm:"varchar(450)" json:"-"`
|
EmailConfirmToken string `xorm:"varchar(450)" json:"-"`
|
||||||
|
|
||||||
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
|
Created int64 `xorm:"created" json:"created"`
|
||||||
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`
|
Updated int64 `xorm:"updated" json:"updated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName returns the table name for users
|
// TableName returns the table name for users
|
||||||
|
|
Loading…
Reference in a new issue