diff --git a/api/task.go b/api/task.go index fbf263e..67c0245 100644 --- a/api/task.go +++ b/api/task.go @@ -86,24 +86,6 @@ func Task(g *gin.RouterGroup, db database.Database) { return nil, err } - if update.ItemID != nil && *update.ItemID != task.ItemID { - _, err := l.FindItem(c.Request.Context(), *update.ItemID) - if err != nil { - return nil, err - } - - logs, err := l.ListLogs(c.Request.Context(), models.LogFilter{ - TaskIDs: []string{task.ID}, - }) - if err != nil { - return nil, err - } - - if len(logs) > 0 { - return nil, slerrors.Forbidden("You cannot change the item if the task has logs.") - } - } - if update.ProjectID != nil && *update.ProjectID != task.ProjectID { project, err := l.FindProject(c.Request.Context(), *update.ProjectID) if err != nil { diff --git a/database/postgres/tasks.go b/database/postgres/tasks.go index e7f2e49..71b9e2d 100644 --- a/database/postgres/tasks.go +++ b/database/postgres/tasks.go @@ -101,6 +101,11 @@ func (r *taskRepository) Update(ctx context.Context, task models.Task) error { if err != nil { return err } + + _, err = r.db.NamedExecContext(ctx, `UPDATE log SET item_id = :item_id WHERE task_id=:task_id`, &task) + if err != nil { + return err + } return nil } diff --git a/svelte-ui/src/forms/TaskForm.svelte b/svelte-ui/src/forms/TaskForm.svelte index b60c029..62e7473 100644 --- a/svelte-ui/src/forms/TaskForm.svelte +++ b/svelte-ui/src/forms/TaskForm.svelte @@ -117,7 +117,7 @@ import ProjectSelect from "../components/ProjectSelect.svelte";