feat: node section assignment for sidebar filtering + search fix

Backend:
- Migration 004: add 'section' column to nodes table
  (NULL=inbox, values: clients/projects/recipes/documents/archive)
- Create(parentID, type, title, section) — section stored on root nodes
- ListRoots(includeDeleted, section) — filters by section
  (section='inbox' returns nodes with NULL section)
- GET /api/nodes?section=X filters root nodes by section
- POST /api/nodes accepts 'section' field in body

Frontend:
- Sidebar separates 'НАВИГАЦИЯ' (virtual sections) from 'ДЕЛА' (real nodes)
- Each section loads only its own nodes: GET /api/nodes?section=clients etc.
- Creating from a section sets the section automatically
- Inbox shows only nodes with no section
- selectBySearch(id) closes result dropdown after selection
- All types shown in Russian (Дело, Заметка, Папка, etc.)

Acceptance: go build pass, go test pass (all packages),
  manual: Pro projects section shows only project-nodes,
  clients only client-nodes, inbox only unsectioned nodes.
This commit is contained in:
2026-05-31 01:26:46 +08:00
parent 14ff1a25b9
commit 9ee6df0d3f
11 changed files with 141 additions and 72 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ func runNodeCreate(vault, parentID, typ, title string) error {
defer db.Close()
repo := nodes.NewRepository(db)
n, err := repo.Create(parentID, typ, title)
n, err := repo.Create(parentID, typ, title, "")
if err != nil {
return err
}
@@ -65,7 +65,7 @@ func runNodeList(vault, parentID string) error {
repo := nodes.NewRepository(db)
var list []nodes.Node
if parentID == "" {
list, err = repo.ListRoots(false)
list, err = repo.ListRoots(false, "")
} else {
list, err = repo.ListChildren(parentID, false)
}