refactor services to use Interface and change name to app

This commit is contained in:
Robin Olsen
2026-02-22 16:16:09 +01:00
parent dbf619a054
commit 118e67dbf4
36 changed files with 247 additions and 219 deletions

View File

@@ -15,7 +15,7 @@ import (
type IssueList struct {
list list.Model
svc *service.Services
app *service.App
width int
height int
}
@@ -74,8 +74,8 @@ func renderHeaders(cols []TableColumn) string {
return lipgloss.JoinHorizontal(lipgloss.Left, parts...)
}
func NewIssueList(svc *service.Services, width, height int) IssueList {
issues, err := svc.Beads.AllIssues(context.Background())
func NewIssueList(app *service.App, width, height int) IssueList {
issues, err := app.Issues.AllIssues(context.Background())
if err != nil {
return IssueList{}
}
@@ -102,13 +102,13 @@ func NewIssueList(svc *service.Services, width, height int) IssueList {
return IssueList{
list: l,
svc: svc,
app: app,
width: width,
height: height,
}
}
func NewIssueListFromIssues(svc *service.Services, issues []models.Issue, width, height int) IssueList {
func NewIssueListFromIssues(app *service.App, issues []models.Issue, width, height int) IssueList {
// for making an IssueList from a pre-existing list of issues.
listIssues := make([]list.Item, len(issues))
for i, issue := range issues {
@@ -125,7 +125,7 @@ func NewIssueListFromIssues(svc *service.Services, issues []models.Issue, width,
l.FilterInput.Prompt = "🔍 "
return IssueList{
list: l,
svc: svc,
app: app,
width: width,
height: height,
}