feat(invoice): add send route
This commit is contained in:
29
internal/api/httpinvoce/resource.go
Normal file
29
internal/api/httpinvoce/resource.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package httpinvoce
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/internal/email"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/model"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
log *slog.Logger
|
||||
invoice invoicer
|
||||
mail mailer
|
||||
}
|
||||
|
||||
func New(log *slog.Logger, invoice invoicer, mail mailer) *Service {
|
||||
return &Service{log: log, invoice: invoice, mail: mail}
|
||||
}
|
||||
|
||||
type invoicer interface {
|
||||
Generate(creditor, deptor model.Entity, mindur time.Duration, rate float64, repos []invoice.Repo) (document io.ReadCloser, err error)
|
||||
}
|
||||
|
||||
type mailer interface {
|
||||
Send(m email.Mail) (err error)
|
||||
}
|
||||
Reference in New Issue
Block a user