From 3ec3bb76af7afab91d34f969f790e43ac3a48415 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 18 Mar 2024 13:40:58 +0100 Subject: [PATCH] fix(views): make parsing work --- pkg/models/project_view.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/models/project_view.go b/pkg/models/project_view.go index 813875ca4..a2220d539 100644 --- a/pkg/models/project_view.go +++ b/pkg/models/project_view.go @@ -57,9 +57,11 @@ func (p *ProjectViewKind) UnmarshalJSON(bytes []byte) error { *p = ProjectViewKindTable case "kanban": *p = ProjectViewKindKanban + default: + return fmt.Errorf("unkown project view kind: %s", value) } - return fmt.Errorf("unkown project view kind: %s", bytes) + return nil } const ( @@ -104,9 +106,11 @@ func (p *BucketConfigurationModeKind) UnmarshalJSON(bytes []byte) error { *p = BucketConfigurationModeManual case "filter": *p = BucketConfigurationModeFilter + default: + return fmt.Errorf("unkown bucket configuration mode kind: %s", value) } - return fmt.Errorf("unkown bucket configuration mode kind: %s", bytes) + return nil } type ProjectViewBucketConfiguration struct { @@ -118,7 +122,7 @@ type ProjectView struct { // The unique numeric id of this view ID int64 `xorm:"autoincr not null unique pk" json:"id" param:"view"` // The title of this view - Title string `xorm:"varchar(255) not null" json:"title" valid:"runelength(1|250)"` + Title string `xorm:"varchar(255) not null" json:"title" valid:"required,runelength(1|250)"` // The project this view belongs to ProjectID int64 `xorm:"not null index" json:"project_id" param:"project"` // The kind of this view. Can be `list`, `gantt`, `table` or `kanban`.