diff --git a/pkg/integrations/list_test.go b/pkg/integrations/list_test.go index 7b0e50f63a..75a91c82e9 100644 --- a/pkg/integrations/list_test.go +++ b/pkg/integrations/list_test.go @@ -178,15 +178,10 @@ func TestList(t *testing.T) { assert.Error(t, err) assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields, "title: non zero value required") }) - t.Run("Almost empty title", func(t *testing.T) { - _, err := testHandler.testUpdateWithUser(nil, map[string]string{"list": "1"}, `{"title":"nn"}`) - assert.Error(t, err) - assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields[0], "does not validate as runelength(3|250)") - }) t.Run("Title too long", func(t *testing.T) { _, err := testHandler.testUpdateWithUser(nil, map[string]string{"list": "1"}, `{"title":"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea taki"}`) assert.Error(t, err) - assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields[0], "does not validate as runelength(3|250)") + assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields[0], "does not validate as runelength(1|250)") }) t.Run("Rights check", func(t *testing.T) { t.Run("Forbidden", func(t *testing.T) { @@ -371,15 +366,10 @@ func TestList(t *testing.T) { assert.Error(t, err) assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields, "title: non zero value required") }) - t.Run("Almost empty title", func(t *testing.T) { - _, err := testHandler.testCreateWithUser(nil, map[string]string{"namespace": "1"}, `{"title":"nn"}`) - assert.Error(t, err) - assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields[0], "does not validate as runelength(3|250)") - }) t.Run("Title too long", func(t *testing.T) { _, err := testHandler.testCreateWithUser(nil, map[string]string{"namespace": "1"}, `{"title":"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea taki"}`) assert.Error(t, err) - assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields[0], "does not validate as runelength(3|250)") + assert.Contains(t, err.(*echo.HTTPError).Message.(models.ValidationHTTPError).InvalidFields[0], "does not validate as runelength(1|250)") }) t.Run("Rights check", func(t *testing.T) { diff --git a/pkg/models/label.go b/pkg/models/label.go index 9f487e1be1..e1f2c0142f 100644 --- a/pkg/models/label.go +++ b/pkg/models/label.go @@ -27,7 +27,7 @@ type Label struct { // The unique, numeric id of this label. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"label"` // The title of the lable. You'll see this one on tasks associated with it. - Title string `xorm:"varchar(250) not null" json:"title" valid:"runelength(3|250)" minLength:"3" maxLength:"250"` + Title string `xorm:"varchar(250) not null" json:"title" valid:"runelength(1|250)" minLength:"3" maxLength:"250"` // The label description. Description string `xorm:"longtext null" json:"description"` // The color this label has diff --git a/pkg/models/list.go b/pkg/models/list.go index 4d1e9a63a8..1c8f49e4fe 100644 --- a/pkg/models/list.go +++ b/pkg/models/list.go @@ -32,7 +32,7 @@ type List struct { // The unique, numeric id of this list. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"list"` // The title of the list. You'll see this in the namespace overview. - Title string `xorm:"varchar(250) not null" json:"title" valid:"required,runelength(3|250)" minLength:"3" maxLength:"250"` + Title string `xorm:"varchar(250) not null" json:"title" valid:"required,runelength(1|250)" minLength:"3" maxLength:"250"` // The description of the list. Description string `xorm:"longtext null" json:"description"` // The unique list short identifier. Used to build task identifiers. diff --git a/pkg/models/namespace.go b/pkg/models/namespace.go index c9453f9bcd..1ee13c0d52 100644 --- a/pkg/models/namespace.go +++ b/pkg/models/namespace.go @@ -31,7 +31,7 @@ type Namespace struct { // The unique, numeric id of this namespace. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"namespace"` // The name of this namespace. - Title string `xorm:"varchar(250) not null" json:"title" valid:"required,runelength(5|250)" minLength:"5" maxLength:"250"` + Title string `xorm:"varchar(250) not null" json:"title" valid:"required,runelength(1|250)" minLength:"5" maxLength:"250"` // The description of the namespace Description string `xorm:"longtext null" json:"description"` OwnerID int64 `xorm:"int(11) not null INDEX" json:"-"` diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index adc43f7c2d..f6e58eabcc 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -38,7 +38,7 @@ type Task struct { // The unique, numeric id of this task. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"listtask"` // The task text. This is what you'll see in the list. - Title string `xorm:"varchar(250) not null" json:"title" valid:"runelength(3|250)" minLength:"3" maxLength:"250"` + Title string `xorm:"varchar(250) not null" json:"title" valid:"runelength(1|250)" minLength:"3" maxLength:"250"` // The task description. Description string `xorm:"longtext null" json:"description"` // Whether a task is done or not. diff --git a/pkg/models/teams.go b/pkg/models/teams.go index f1dbabf142..73e93a5bbb 100644 --- a/pkg/models/teams.go +++ b/pkg/models/teams.go @@ -29,7 +29,7 @@ type Team struct { // The unique, numeric id of this team. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"team"` // The name of this team. - Name string `xorm:"varchar(250) not null" json:"name" valid:"required,runelength(5|250)" minLength:"5" maxLength:"250"` + Name string `xorm:"varchar(250) not null" json:"name" valid:"required,runelength(1|250)" minLength:"5" maxLength:"250"` // The team's description. Description string `xorm:"longtext null" json:"description"` CreatedByID int64 `xorm:"int(11) not null INDEX" json:"-"` diff --git a/pkg/user/user.go b/pkg/user/user.go index 243926e213..e46272bf58 100644 --- a/pkg/user/user.go +++ b/pkg/user/user.go @@ -46,7 +46,7 @@ type User struct { // The unique, numeric id of this user. ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` // The username of the user. Is always unique. - Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)" minLength:"3" maxLength:"250"` + Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(1|250)" minLength:"3" maxLength:"250"` Password string `xorm:"varchar(250) not null" json:"-"` // The user's email address. Email string `xorm:"varchar(250) null" json:"email,omitempty" valid:"email,length(0|250)" maxLength:"250"`