READ ISSUES - WEB

This commit is contained in:
Ine Maria Nilssen Aanonsen
2026-02-23 13:51:42 +01:00
parent 2e4185e30f
commit d1ef4e9491
10 changed files with 202 additions and 92 deletions

View File

@@ -2,7 +2,9 @@ package handler
import (
"net/http"
"strings"
"github.com/LazyBachelor/LazyPM/internal/models"
"github.com/LazyBachelor/LazyPM/pkg/web/components"
"github.com/LazyBachelor/LazyPM/pkg/web/routes"
)
@@ -11,16 +13,20 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
svc := Services(r)
hx := HTMX(r)
issues, err := svc.Beads.AllIssues(r.Context())
query := strings.TrimSpace(r.URL.Query().Get("q"))
filter := models.IssueFilter{Limit: 100}
issuesPtr, err := svc.Beads.SearchIssues(r.Context(), query, filter)
if err != nil {
http.Error(w, "failed to retrieve issues", http.StatusInternalServerError)
return
}
issues := models.IssuesPtrToIssues(issuesPtr)
props := routes.IndexProps{
IssueTable: components.IssueTableProps{
Issues: issues,
},
SearchQuery: query,
}
if hx.IsHxRequest() {