Compare commits
2 Commits
d5f94845e8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a5ea229bf | |||
| acaece2659 |
@@ -9,7 +9,7 @@ import (
|
|||||||
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/report"
|
"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 {
|
if config == nil {
|
||||||
config = &DefaultOptions
|
config = &DefaultOptions
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
|
|||||||
repo.Repo,
|
repo.Repo,
|
||||||
gitea.ListIssueOption{
|
gitea.ListIssueOption{
|
||||||
ListOptions: gitea.ListOptions{Page: 0, PageSize: 99999},
|
ListOptions: gitea.ListOptions{Page: 0, PageSize: 99999},
|
||||||
|
Type: gitea.IssueTypeIssue,
|
||||||
Since: config.Since,
|
Since: config.Since,
|
||||||
Before: config.Before,
|
Before: config.Before,
|
||||||
State: config.IssueState,
|
State: config.IssueState,
|
||||||
@@ -46,7 +47,7 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
|
|||||||
r = report.New(
|
r = report.New(
|
||||||
issues,
|
issues,
|
||||||
creditor,
|
creditor,
|
||||||
deptor,
|
debtor,
|
||||||
rate,
|
rate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func TestGenerate(t *testing.T) {
|
|||||||
creditor := model.Entity{
|
creditor := model.Entity{
|
||||||
Name: "creditor",
|
Name: "creditor",
|
||||||
}
|
}
|
||||||
deptor := model.Entity{
|
debtor := model.Entity{
|
||||||
Name: "deptor",
|
Name: "deptor",
|
||||||
}
|
}
|
||||||
rate := 100.0
|
rate := 100.0
|
||||||
@@ -140,7 +140,7 @@ pdfGenerator := new(MockPdfGenerator)
|
|||||||
tc.setupMocks(giteaClient, pdfGenerator)
|
tc.setupMocks(giteaClient, pdfGenerator)
|
||||||
|
|
||||||
service := New(slog.Default(), 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 tc.expectedError != "" {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -160,3 +160,4 @@ pdfGenerator := new(MockPdfGenerator)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user