4 Commits

Author SHA1 Message Date
d5f94845e8 feat: better debug logs
All checks were successful
Go / build (pull_request) Successful in 1m11s
2025-12-03 20:45:48 +01:00
7913e6b900 feat: tests 2025-11-09 16:39:29 +01:00
e57185b057 feat: custom template 2025-11-09 13:04:23 +01:00
8adff6ade2 feat: use tailwind css 2025-11-06 21:36:57 +01:00
2 changed files with 8 additions and 10 deletions

View File

@@ -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, debtor *model.Entity, rate float64, repos []Repo, config *Options) (document io.ReadCloser, r report.Report, err error) { func (s *Service) Generate(creditor model.Entity, deptor *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,7 +20,6 @@ func (s *Service) Generate(creditor model.Entity, debtor *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,
@@ -47,7 +46,7 @@ func (s *Service) Generate(creditor model.Entity, debtor *model.Entity, rate flo
r = report.New( r = report.New(
issues, issues,
creditor, creditor,
debtor, deptor,
rate, rate,
) )

View File

@@ -41,7 +41,7 @@ func TestGenerate(t *testing.T) {
creditor := model.Entity{ creditor := model.Entity{
Name: "creditor", Name: "creditor",
} }
debtor := model.Entity{ deptor := model.Entity{
Name: "deptor", Name: "deptor",
} }
rate := 100.0 rate := 100.0
@@ -136,11 +136,11 @@ func TestGenerate(t *testing.T) {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
giteaClient := new(MockGiteaClient) giteaClient := new(MockGiteaClient)
pdfGenerator := new(MockPdfGenerator) 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, &debtor, rate, repos, tc.config) doc, _, err := service.Generate(creditor, &deptor, rate, repos, tc.config)
if tc.expectedError != "" { if tc.expectedError != "" {
if err == nil { if err == nil {
@@ -160,4 +160,3 @@ func TestGenerate(t *testing.T) {
}) })
} }
} }