change return type to obj
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||||
|
|
||||||
"github.com/steveyegge/beads"
|
"github.com/steveyegge/beads"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,6 +27,22 @@ func NewBeadsService(ctx context.Context, storage beads.Storage, prefix string)
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *BeadsService) AllIssues(ctx context.Context) ([]*models.Issue, error) {
|
func (s *BeadsService) AllIssues(ctx context.Context) ([]models.Issue, error) {
|
||||||
return s.Storage.SearchIssues(ctx, "", models.IssueFilter{})
|
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 {
|
type IssueTableProps struct {
|
||||||
Issues []*models.Issue
|
Issues []models.Issue
|
||||||
}
|
}
|
||||||
|
|
||||||
templ IssueTable(props IssueTableProps) {
|
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 {
|
for _, issue := range issues {
|
||||||
<tr>
|
<tr>
|
||||||
<td class="px-4 py-2 border">{ issue.ID }</td>
|
<td class="px-4 py-2 border">{ issue.ID }</td>
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ func IssueForm(props IssueFormProps) templ.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IssueTableProps struct {
|
type IssueTableProps struct {
|
||||||
Issues []*models.Issue
|
Issues []models.Issue
|
||||||
}
|
}
|
||||||
|
|
||||||
func IssueTable(props IssueTableProps) templ.Component {
|
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) {
|
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
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user