change return type to obj
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
<tr>
|
||||
<td class="px-4 py-2 border">{ issue.ID }</td>
|
||||
|
||||
@@ -155,7 +155,7 @@ func IssueForm(props IssueFormProps) templ.Component {
|
||||
}
|
||||
|
||||
type IssueTableProps struct {
|
||||
Issues []*models.Issue
|
||||
Issues []models.Issue
|
||||
}
|
||||
|
||||
func IssueTable(props IssueTableProps) templ.Component {
|
||||
@@ -199,7 +199,7 @@ func IssueTable(props IssueTableProps) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func IssueRows(issues []*models.Issue) templ.Component {
|
||||
func IssueRows(issues []models.Issue) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user