feat(views): add new model and migration
This commit is contained in:
59
pkg/models/project_view.go
Normal file
59
pkg/models/project_view.go
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
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"
|
||||
}
|
Reference in New Issue
Block a user