diff --git a/pkg/migration/20240313230538.go b/pkg/migration/20240313230538.go
new file mode 100644
index 000000000..f68606fa5
--- /dev/null
+++ b/pkg/migration/20240313230538.go
@@ -0,0 +1,101 @@
+// Vikunja is a to-do list application to facilitate your life.
+// Copyright 2018-present Vikunja and contributors. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public Licensee as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public Licensee for more details.
+//
+// You should have received a copy of the GNU Affero General Public Licensee
+// along with this program. If not, see .
+
+package migration
+
+import (
+ "src.techknowlogick.com/xormigrate"
+ "time"
+ "xorm.io/xorm"
+)
+
+type projectView20240313230538 struct {
+ ID int64 `xorm:"autoincr not null unique pk" json:"id" param:"view"`
+ Title string `xorm:"varchar(255) not null" json:"title" valid:"runelength(1|250)"`
+ ProjectID int64 `xorm:"not null index" json:"project_id" param:"project"`
+ ViewKind int `xorm:"not null" json:"view_kind"`
+ Filter string `xorm:"text null default null" query:"filter" json:"filter"`
+ Position float64 `xorm:"double null" json:"position"`
+ Updated time.Time `xorm:"updated not null" json:"updated"`
+ Created time.Time `xorm:"created not null" json:"created"`
+}
+
+func (projectView20240313230538) TableName() string {
+ return "project_views"
+}
+
+type projects20240313230538 struct {
+ ID int64 `xorm:"autoincr not null unique pk" json:"id" param:"view"`
+}
+
+func (projects20240313230538) TableName() string {
+ return "projects"
+}
+
+func init() {
+ migrations = append(migrations, &xormigrate.Migration{
+ ID: "20240313230538",
+ Description: "Add project views table",
+ Migrate: func(tx *xorm.Engine) error {
+ err := tx.Sync2(projectView20240313230538{})
+ if err != nil {
+ return err
+ }
+
+ projects := []*projects20240313230538{}
+ err = tx.Find(&projects)
+ if err != nil {
+ return err
+ }
+
+ createView := func(projectID int64, kind int, title string, position float64) error {
+ view := &projectView20240313230538{
+ Title: title,
+ ProjectID: projectID,
+ ViewKind: kind,
+ Position: position,
+ }
+
+ _, err := tx.Insert(view)
+ return err
+ }
+
+ for _, project := range projects {
+ err = createView(project.ID, 0, "List", 100)
+ if err != nil {
+ return err
+ }
+ err = createView(project.ID, 1, "Gantt", 200)
+ if err != nil {
+ return err
+ }
+ err = createView(project.ID, 2, "Table", 300)
+ if err != nil {
+ return err
+ }
+ err = createView(project.ID, 3, "Kanban", 400)
+ if err != nil {
+ return err
+ }
+ }
+
+ return nil
+ },
+ Rollback: func(tx *xorm.Engine) error {
+ return nil
+ },
+ })
+}
diff --git a/pkg/models/models.go b/pkg/models/models.go
index f8404978c..96d8b3b0f 100644
--- a/pkg/models/models.go
+++ b/pkg/models/models.go
@@ -62,6 +62,7 @@ func GetTables() []interface{} {
&TypesenseSync{},
&Webhook{},
&Reaction{},
+ &ProjectView{},
}
}
diff --git a/pkg/models/project_view.go b/pkg/models/project_view.go
new file mode 100644
index 000000000..012f065fa
--- /dev/null
+++ b/pkg/models/project_view.go
@@ -0,0 +1,59 @@
+// Vikunja is a to-do list application to facilitate your life.
+// Copyright 2018-present Vikunja and contributors. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public Licensee as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public Licensee for more details.
+//
+// You should have received a copy of the GNU Affero General Public Licensee
+// along with this program. If not, see .
+
+package models
+
+import (
+ "code.vikunja.io/web"
+ "time"
+)
+
+type ProjectViewKind int
+
+const (
+ ProjectViewKindList ProjectViewKind = iota
+ ProjectViewKindGantt
+ ProjectViewKindTable
+ ProjectViewKindKanban
+)
+
+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)"`
+ // 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`.
+ ViewKind ProjectViewKind `xorm:"not null" json:"view_kind"`
+
+ // The filter query to match tasks by. Check out https://vikunja.io/docs/filters for a full explanation.
+ Filter string `xorm:"text null default null" query:"filter" json:"filter"`
+ // The position of this view in the list. The list of all views will be sorted by this parameter.
+ Position float64 `xorm:"double null" json:"position"`
+
+ // A timestamp when this view was updated. You cannot change this value.
+ Updated time.Time `xorm:"updated not null" json:"updated"`
+ // A timestamp when this reaction was created. You cannot change this value.
+ Created time.Time `xorm:"created not null" json:"created"`
+
+ web.CRUDable `xorm:"-" json:"-"`
+ web.Rights `xorm:"-" json:"-"`
+}
+
+func (p *ProjectView) TableName() string {
+ return "project_views"
+}
diff --git a/pkg/models/task_collection.go b/pkg/models/task_collection.go
index f32658fa4..745369d24 100644
--- a/pkg/models/task_collection.go
+++ b/pkg/models/task_collection.go
@@ -33,7 +33,7 @@ type TaskCollection struct {
OrderBy []string `query:"order_by" json:"order_by"`
OrderByArr []string `query:"order_by[]" json:"-"`
- // The filter query to match tasks by. Check out https://vikunja.io/docs/filters for a full explanation of the feature.
+ // The filter query to match tasks by. Check out https://vikunja.io/docs/filters for a full explanation.
Filter string `query:"filter" json:"filter"`
// The time zone which should be used for date match (statements like "now" resolve to different actual times)
FilterTimezone string `query:"filter_timezone" json:"-"`