feat: custom template

This commit is contained in:
2025-11-09 13:04:23 +01:00
parent 8adff6ade2
commit e57185b057
9 changed files with 68 additions and 48 deletions

View File

@@ -31,6 +31,7 @@ func (s Service) createInvoice(w http.ResponseWriter, r *http.Request) {
opts := invoice.DefaultOptions
opts.Mindur = time.Duration(req.DurationThreshold)
opts.CustomTemplate = req.CustomTemplate
invoice, report, err := s.invoice.Generate(req.Creditor, &req.Debtor, req.HourlyRate, repos, &opts)
if err != nil {
s.sendErr(w, http.StatusInternalServerError, "internal server error")
@@ -71,6 +72,7 @@ func (s Service) sendInvoice(w http.ResponseWriter, r *http.Request) {
opts := invoice.DefaultOptions
opts.Mindur = time.Duration(req.Invoice.DurationThreshold)
opts.CustomTemplate = req.Invoice.CustomTemplate
invoice, report, err := s.invoice.Generate(req.Invoice.Creditor, &req.Invoice.Debtor, req.Invoice.HourlyRate, repos, &opts)
if err != nil {
s.sendErr(w, http.StatusInternalServerError, "error while processing invoice:", err)