feat: add interactive inbox view

This commit is contained in:
2026-06-05 00:59:57 +08:00
parent 02d68ca3f4
commit 035f877280
13 changed files with 163 additions and 8 deletions
+17
View File
@@ -169,6 +169,23 @@ func (r *Repository) ListRoots(includeDeleted bool) ([]Node, error) {
return scanNodes(rows)
}
// ListInboxRoots returns active root nodes that are not assigned to a specific section.
func (r *Repository) ListInboxRoots(includeDeleted bool) ([]Node, error) {
q := `SELECT ` + nodeColumns + ` FROM nodes
WHERE parent_id IS NULL AND COALESCE(section, '') IN ('', 'inbox')`
if !includeDeleted {
q += " AND deleted_at IS NULL"
}
q += " ORDER BY updated_at DESC, sort_order, title"
rows, err := r.db.Query(q)
if err != nil {
return nil, err
}
defer rows.Close()
return scanNodes(rows)
}
// CountChildren returns the number of non-deleted children for a parent,
// optionally filtered by one or more types.
func (r *Repository) CountChildren(parentID string, types ...string) (int, error) {