feat(api): fix POST /invoice
This commit is contained in:
@@ -6,26 +6,27 @@ import (
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/internal/api/httpinvoce"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/internal/config"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/internal/email"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/pdf"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice"
|
||||
)
|
||||
|
||||
func RegisterRoutes(log *slog.Logger, mux *http.ServeMux) error {
|
||||
gotenberg, err := pdf.New("http://localhost:3030")
|
||||
func RegisterRoutes(log *slog.Logger, mux *http.ServeMux, cfg *config.Config) error {
|
||||
gotenberg, err := pdf.New(cfg.PDF.Hostname)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
giteaC, err := gitea.NewClient(
|
||||
"https://git.schreifuchs.ch",
|
||||
gitea.SetToken("6a8ea8f9de039b0950c634bfea40c6f97f94b06b"),
|
||||
cfg.Gitea.URL,
|
||||
gitea.SetToken(cfg.Gitea.Token),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
invoicer := invoice.New(log, giteaC, gotenberg)
|
||||
mailer, err := email.New(email.Config{})
|
||||
mailer, err := email.New(cfg.Email)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user