2 Commits

Author SHA1 Message Date
9a5ea229bf feat/user-templates (#9)
All checks were successful
Go / build (push) Successful in 14s
feat: user templates
2025-12-03 21:27:46 +01:00
acaece2659 fix: do not list pull requests
All checks were successful
Go / build (push) Successful in 45s
Release / publish (push) Successful in 1m7s
2025-12-01 21:29:58 +01:00
2 changed files with 10 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ import (
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/report"
)
func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate float64, repos []Repo, config *Options) (document io.ReadCloser, r report.Report, err error) {
func (s *Service) Generate(creditor model.Entity, debtor *model.Entity, rate float64, repos []Repo, config *Options) (document io.ReadCloser, r report.Report, err error) {
if config == nil {
config = &DefaultOptions
}
@@ -20,6 +20,7 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
repo.Repo,
gitea.ListIssueOption{
ListOptions: gitea.ListOptions{Page: 0, PageSize: 99999},
Type: gitea.IssueTypeIssue,
Since: config.Since,
Before: config.Before,
State: config.IssueState,
@@ -46,7 +47,7 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
r = report.New(
issues,
creditor,
deptor,
debtor,
rate,
)

View File

@@ -41,7 +41,7 @@ func TestGenerate(t *testing.T) {
creditor := model.Entity{
Name: "creditor",
}
deptor := model.Entity{
debtor := model.Entity{
Name: "deptor",
}
rate := 100.0
@@ -135,12 +135,12 @@ func TestGenerate(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
giteaClient := new(MockGiteaClient)
pdfGenerator := new(MockPdfGenerator)
tc.setupMocks(giteaClient, pdfGenerator)
pdfGenerator := new(MockPdfGenerator)
tc.setupMocks(giteaClient, pdfGenerator)
service := New(slog.Default(), giteaClient, pdfGenerator)
doc, _, err := service.Generate(creditor, &deptor, rate, repos, tc.config)
doc, _, err := service.Generate(creditor, &debtor, rate, repos, tc.config)
if tc.expectedError != "" {
if err == nil {
@@ -159,4 +159,5 @@ pdfGenerator := new(MockPdfGenerator)
}
})
}
}
}