feat(invoice): add send route
This commit is contained in:
35
internal/api/routes.go
Normal file
35
internal/api/routes.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/internal/api/httpinvoce"
|
||||
"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")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
giteaC, err := gitea.NewClient(
|
||||
"https://git.schreifuchs.ch",
|
||||
gitea.SetToken("6a8ea8f9de039b0950c634bfea40c6f97f94b06b"),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
invoicer := invoice.New(log, giteaC, gotenberg)
|
||||
mailer, err := email.New(email.Config{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpinvoce.New(log, invoicer, mailer).RegisterRoutes(mux)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user