feat: add due date filters for list command

- --due: show only nodes with a due date set
- --due-within N: show only nodes due within N days (includes overdue)

Implemented in service layer with post-fetch filtering, threaded through
API client and server, and exposed via CLI flags.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 05:06:35 +02:00
parent 8357c80e75
commit f2521be158
5 changed files with 48 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import (
"axolotl/store"
"encoding/json"
"net/http"
"strconv"
"strings"
)
@@ -84,6 +85,14 @@ func (s *server) listNodes(w http.ResponseWriter, r *http.Request) {
if v := q.Get("mention"); v != "" {
filter.Rels = append(filter.Rels, service.RelInput{Type: models.RelMentions, Target: v})
}
if q.Get("has_due_date") == "true" {
filter.HasDueDate = true
}
if v := q.Get("due_within"); v != "" {
if n, err := strconv.Atoi(v); err == nil {
filter.DueWithin = &n
}
}
nodes, err := svc.List(filter)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())