feat(lists): drag tasks and list entries onto another list; remember open list and view; live pill in lists
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m3s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m3s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6abcfa655b
commit
25bb787a8e
13 files changed
+298
-52
No files matched your search
@@ -444,6 +444,35 @@ func (s *Store) UpdateListItem(itemID string, content *string, category *string,
|
||||
return &it, nil
|
||||
}
|
||||
|
||||
// MoveListItem moves an item into another list, where it lands at the top like a new entry
|
||||
// (content, category, quantity and checked state stay). Permissions are checked by the caller.
|
||||
func (s *Store) MoveListItem(itemID, targetListID string) (*domain.ListItem, error) {
|
||||
var sourceListID string
|
||||
if err := s.db.QueryRow(`SELECT list_id FROM list_items WHERE id = ?`, itemID).Scan(&sourceListID); err != nil {
|
||||
return nil, ErrListNotFound
|
||||
}
|
||||
now := domain.NowISO()
|
||||
if _, err := s.db.Exec(`UPDATE list_items SET list_id = ?, sort_order = 0 WHERE id = ?`, targetListID, itemID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, _ = s.db.Exec(`UPDATE lists SET updated_at = ? WHERE id IN (?, ?)`, now, sourceListID, targetListID)
|
||||
|
||||
var it domain.ListItem
|
||||
var dInt int
|
||||
err := s.db.QueryRow(
|
||||
`SELECT li.id, li.list_id, li.content, li.category, li.quantity, li.is_completed, li.completed_by, li.completed_by_name,
|
||||
li.created_by, COALESCE(u.display_name, ''), li.sort_order, li.created_at, li.completed_at
|
||||
FROM list_items li LEFT JOIN users u ON u.id = li.created_by AND li.created_by != ''
|
||||
WHERE li.id = ?`,
|
||||
itemID,
|
||||
).Scan(&it.ID, &it.ListID, &it.Content, &it.Category, &it.Quantity, &dInt, &it.CompletedBy, &it.CompletedByName, &it.CreatedBy, &it.CreatedByName, &it.SortOrder, &it.CreatedAt, &it.CompletedAt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
it.IsCompleted = dInt != 0
|
||||
return &it, nil
|
||||
}
|
||||
|
||||
func (s *Store) DeleteListItem(itemID string) (string, error) {
|
||||
var listID string
|
||||
_ = s.db.QueryRow(`SELECT list_id FROM list_items WHERE id = ?`, itemID).Scan(&listID)
|
||||
|
||||
Reference in new issue
Block a user