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
Add default list setting
Some checks failed
continuous-integration/drone/pr Build is failing
51f9d8f690
sytone added 1 commit 2021-05-27 19:59:17 +00:00
Fix fmt issue
Some checks failed
continuous-integration/drone/pr Build is failing
350f59c479
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
Merge branch 'main' of ssh://kolaente.dev:9022/vikunja/api into main
Some checks failed
continuous-integration/drone/pr Build is failing
d9c91bc03a
sytone added 1 commit 2021-06-02 17:15:33 +00:00
Fix swagger issues
All checks were successful
continuous-integration/drone/pr Build is passing
e8135dcf75
Add editor config for consistency
sytone added 1 commit 2021-06-02 17:29:12 +00:00
Updated xorm to bigint
All checks were successful
continuous-integration/drone/pr Build is passing
302064b4bb
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
Update to match swagger formatting
All checks were successful
continuous-integration/drone/pr Build is passing
15f1b15dbf
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
No due date set.
Dependencies

No dependencies set.

Reference: vikunja/vikunja#875
No description provided.