Add real buckets for tasks which don't have one (#446)
Add docs for error code Add moving new tasks into the default bucket when none was provided Add moving tasks in default bucket when deleting one Fix tests again Add test for removing a bucket Fix tests Prevent removing the last bucket Remove the empty pseudo bucket Add migration to create a new bucket for each list (and put all tasks in it Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/446
This commit is contained in:
@ -544,6 +544,15 @@ func (t *Task) Create(a web.Auth) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Get the default bucket and move the task there
|
||||
if t.BucketID == 0 {
|
||||
defaultBucket, err := getDefaultBucket(t.ListID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.BucketID = defaultBucket.ID
|
||||
}
|
||||
|
||||
// Get the index for this task
|
||||
latestTask := &Task{}
|
||||
_, err = x.Where("list_id = ?", t.ListID).OrderBy("id desc").Get(latestTask)
|
||||
|
Reference in New Issue
Block a user