Add default list setting #875

Merged
konrad merged 6 commits from sytone/api:main into main 2 years ago
sytone commented 2 years ago

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 2 years ago
51f9d8f690 Add default list setting
sytone added 1 commit 2 years ago
350f59c479 Fix fmt issue
konrad requested changes 2 years ago
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)
)
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.
Poster

Updated and renames, tests updated.

Updated and renames, tests updated.
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.
Poster

Updated to match.

Updated to match.
pkg/user/user.go Outdated
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.
Poster

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 2 years ago
sytone added 1 commit 2 years ago
e8135dcf75 Fix swagger issues
sytone added 1 commit 2 years ago
302064b4bb Updated xorm to bigint
Poster

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 2 years ago
15f1b15dbf Update to match swagger formatting
sytone requested review from konrad 2 years ago
konrad approved these changes 2 years ago
konrad left a comment
Owner

Looks good, thanks!

Looks good, thanks!
konrad merged commit 3277f6acf7 into main 2 years ago
konrad referenced this issue from a commit 2 years ago

Reviewers

konrad approved these changes 2 years ago
continuous-integration/drone/pr Build is passing
The pull request has been merged as 3277f6acf7.
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/api#875
Loading…
There is no content yet.