Home List ID

This commit is contained in:
Elia Zammuto 2022-06-11 19:48:43 +02:00
parent a6556f3505
commit 279bbcd70c
7 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,43 @@
// Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-2021 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 migration
import (
"src.techknowlogick.com/xormigrate"
"xorm.io/xorm"
)
type users20220611191202 struct {
HomeListID int64 `xorm:"bigint null index" json:"-"`
}
func (users20220611191202) TableName() string {
return "users"
}
func init() {
migrations = append(migrations, &xormigrate.Migration{
ID: "20220611191202",
Description: "Add home list for new tasks setting to users",
Migrate: func(tx *xorm.Engine) error {
return tx.Sync2(users20220611191202{})
},
Rollback: func(tx *xorm.Engine) error {
return nil
},
})
}

View File

@ -49,6 +49,7 @@ type UserSettings struct {
// If a task is created without a specified list this value should be used. Applies
// to tasks made directly in API and from clients.
DefaultListID int64 `json:"default_list_id"`
HomeListID int64 `json:"home_list_id"`
// The day when the week starts for this user. 0 = sunday, 1 = monday, etc.
WeekStart int `json:"week_start"`
// The user's language
@ -181,6 +182,7 @@ func UpdateGeneralUserSettings(c echo.Context) error {
user.DiscoverableByName = us.DiscoverableByName
user.OverdueTasksRemindersEnabled = us.OverdueTasksRemindersEnabled
user.DefaultListID = us.DefaultListID
user.HomeListID = us.HomeListID
user.WeekStart = us.WeekStart
user.Language = us.Language
user.Timezone = us.Timezone

View File

@ -72,6 +72,7 @@ func UserShow(c echo.Context) error {
DiscoverableByEmail: u.DiscoverableByEmail,
OverdueTasksRemindersEnabled: u.OverdueTasksRemindersEnabled,
DefaultListID: u.DefaultListID,
HomeListID: u.HomeListID,
WeekStart: u.WeekStart,
Language: u.Language,
Timezone: u.Timezone,

View File

@ -9160,6 +9160,10 @@ const docTemplate = `{
"description": "If a task is created without a specified list this value should be used. Applies\nto tasks made directly in API and from clients.",
"type": "integer"
},
"home_list_id": {
"description": "Used by frontend. The User List that the Users wants to be displayed inside the Home View",
"type": "integer"
},
"discoverable_by_email": {
"description": "If true, the user can be found when searching for their exact email.",
"type": "boolean"

View File

@ -9151,6 +9151,10 @@
"description": "If a task is created without a specified list this value should be used. Applies\nto tasks made directly in API and from clients.",
"type": "integer"
},
"home_list_id": {
"description": "Used by frontend. The User List that the Users wants to be displayed inside the Home View",
"type": "integer"
},
"discoverable_by_email": {
"description": "If true, the user can be found when searching for their exact email.",
"type": "boolean"

View File

@ -1285,6 +1285,10 @@ definitions:
v1.UserSettings:
properties:
default_list_id:
description: |-
Used by frontend. The User List that the Users wants to be displayed inside the Home View
type: integer
home_list_id:
description: |-
If a task is created without a specified list this value should be used. Applies
to tasks made directly in API and from clients.

View File

@ -95,6 +95,7 @@ type User struct {
DiscoverableByEmail bool `xorm:"bool default false index" json:"-"`
OverdueTasksRemindersEnabled bool `xorm:"bool default true index" json:"-"`
DefaultListID int64 `xorm:"bigint null index" json:"-"`
HomeListID int64 `xorm:"bigint null index" json:"-"`
WeekStart int `xorm:"null" json:"-"`
Language string `xorm:"varchar(50) null" json:"-"`
Timezone string `xorm:"varchar(255) null" json:"-"`
@ -490,6 +491,7 @@ func UpdateUser(s *xorm.Session, user *User) (updatedUser *User, err error) {
"discoverable_by_email",
"overdue_tasks_reminders_enabled",
"default_list_id",
"home_list_id",
"week_start",
"language",
"timezone",