Add default list setting #875

Merged
konrad merged 6 commits from sytone/api:main into main 2021-06-02 21:20:23 +00:00
Contributor

Description

Add the setting to the API for a default list.

I have never coded in go before so went with the flow. 😄

Checklist

  • I added or improved tests
  • I added or improved docs for my feature
    • Swagger (including mage do-the-swag)
    • Error codes
    • New config options (including adding them to config.yml.saml and running mage generate-docs)
# Description Add the setting to the API for a default list. I have never coded in go before so went with the flow. 😄 # Checklist * [ ] I added or improved tests * [ ] I added or improved docs for my feature * [ ] Swagger (including `mage do-the-swag`) * [ ] Error codes * [ ] New config options (including adding them to `config.yml.saml` and running `mage generate-docs`)
sytone added 1 commit 2021-05-27 18:30:16 +00:00
continuous-integration/drone/pr Build is failing Details
51f9d8f690
Add default list setting
sytone added 1 commit 2021-05-27 19:59:17 +00:00
continuous-integration/drone/pr Build is failing Details
350f59c479
Fix fmt issue
konrad requested changes 2021-05-27 20:55:38 +00:00
konrad left a comment
Owner

Thanks for the PR! Please see the comments below.

It looks like the CI fail is related to swagger docs not being up to date. Could you regenerate them? (You already seem to have done that, not sure why the CI fails nontheless. It should work with a regeneration though)

Thanks for the PR! Please see the comments below. It looks like the CI fail is related to swagger docs not being up to date. Could you regenerate them? (You already seem to have done that, not sure why the CI fails nontheless. It should work with a regeneration though)
@ -0,0 +22,4 @@
)
type users20210527105701 struct {
DefaultListForNewTasks int `xorm:"int default 1 index" json:"-"`
Owner

A few things:

  • This should be an int64 as all other ids are. Same for the xorm tag (I think that is bigint, take a look at the other ID fields).
  • Please make the field nullable and remove the default value. That will also remove the need to update all the tests.
  • I think the field would be better named something like DefaultListID - that way it's clear what this is.
A few things: * This should be an `int64` as all other ids are. Same for the xorm tag (I think that is bigint, take a look at the other ID fields). * Please make the field nullable and remove the default value. That will also remove the need to update all the tests. * I think the field would be better named something like `DefaultListID` - that way it's clear what this is.
Author
Contributor

Updated and renames, tests updated.

Updated and renames, tests updated.
@ -47,1 +47,4 @@
OverdueTasksRemindersEnabled bool `json:"overdue_tasks_reminders_enabled"`
// If a task is created without a specified list this value should be used. Applies
// to tasks made directly in API and from clients.
DefaultListForNewTasks int `json:"default_list_for_new_tasks"`
Owner

Should be int64 as well.

Should be `int64` as well.
Author
Contributor

Updated to match.

Updated to match.
pkg/user/user.go Outdated
@ -71,6 +71,7 @@ type User struct {
DiscoverableByName bool `xorm:"bool default false index" json:"-"`
DiscoverableByEmail bool `xorm:"bool default false index" json:"-"`
OverdueTasksRemindersEnabled bool `xorm:"bool default true index" json:"-"`
DefaultListForNewTasks int `xorm:"int default 1 index" json:"-"`
Owner

Please see the comments on the migration.

Please see the comments on the migration.
Author
Contributor

Updated to match migraiton, now null by default, bigint which maps to int64 as verified in the xorm documents.

Updated to match migraiton, now null by default, bigint which maps to int64 as verified in the xorm documents.
sytone added 1 commit 2021-06-01 23:47:15 +00:00
sytone added 1 commit 2021-06-02 17:15:33 +00:00
continuous-integration/drone/pr Build is passing Details
e8135dcf75
Fix swagger issues
Add editor config for consistency
sytone added 1 commit 2021-06-02 17:29:12 +00:00
continuous-integration/drone/pr Build is passing Details
302064b4bb
Updated xorm to bigint
Update model to int64
Made value null by default
Updated tests to not set by default
Updated Swagger documents
Author
Contributor

Updated the code to reflect comments. Was out on vacation and also had to reset my WSL environment, took a bit as I had not used go before but worked my way through it.

Updated the code to reflect comments. Was out on vacation and also had to reset my WSL environment, took a bit as I had not used go before but worked my way through it.
sytone added 1 commit 2021-06-02 17:37:00 +00:00
continuous-integration/drone/pr Build is passing Details
15f1b15dbf
Update to match swagger formatting
Update to match yaml files
sytone requested review from konrad 2021-06-02 17:37:39 +00:00
konrad approved these changes 2021-06-02 21:20:04 +00:00
konrad left a comment
Owner

Looks good, thanks!

Looks good, thanks!
konrad merged commit 3277f6acf7 into main 2021-06-02 21:20:23 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#875
No description provided.