diff --git a/internal/service/beads.go b/internal/service/beads.go index 4751ca4..e9a191d 100644 --- a/internal/service/beads.go +++ b/internal/service/beads.go @@ -1,10 +1,11 @@ package service import ( - "github.com/LazyBachelor/LazyPM/internal/models" "context" "fmt" + "github.com/LazyBachelor/LazyPM/internal/models" + "github.com/steveyegge/beads" ) @@ -26,6 +27,22 @@ func NewBeadsService(ctx context.Context, storage beads.Storage, prefix string) }, nil } -func (s *BeadsService) AllIssues(ctx context.Context) ([]*models.Issue, error) { - return s.Storage.SearchIssues(ctx, "", models.IssueFilter{}) +func (s *BeadsService) AllIssues(ctx context.Context) ([]models.Issue, error) { + issuesPtr, err := s.Storage.SearchIssues(ctx, "", models.IssueFilter{}) + if err != nil { + return nil, err + } + + if len(issuesPtr) == 0 { + return []models.Issue{}, nil + } + + issues := make([]models.Issue, 0, len(issuesPtr)) + for _, issuePtr := range issuesPtr { + if issuePtr != nil { + issues = append(issues, *issuePtr) + } + } + + return issues, nil } diff --git a/pkg/web/components/issue.templ b/pkg/web/components/issue.templ index b8bcc23..8ed9493 100644 --- a/pkg/web/components/issue.templ +++ b/pkg/web/components/issue.templ @@ -77,7 +77,7 @@ templ IssueForm(props IssueFormProps) { } type IssueTableProps struct { - Issues []*models.Issue + Issues []models.Issue } templ IssueTable(props IssueTableProps) { @@ -96,7 +96,7 @@ templ IssueTable(props IssueTableProps) { ) } -templ IssueRows(issues []*models.Issue) { +templ IssueRows(issues []models.Issue) { for _, issue := range issues {