feat: add interactive inbox view
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user