feat: pdf
This commit is contained in:
46
main.go
46
main.go
@@ -1,11 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/issue"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/pdf"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/report"
|
||||
)
|
||||
|
||||
@@ -27,7 +29,7 @@ func main() {
|
||||
for _, repo := range []Repo{
|
||||
{"lou-taylor", "lou-taylor-web"},
|
||||
{"lou-taylor", "lou-taylor-api"},
|
||||
// {"lou-taylor", "accounting"},
|
||||
{"lou-taylor", "accounting"},
|
||||
} {
|
||||
iss, _, err := client.ListRepoIssues(
|
||||
repo.owner,
|
||||
@@ -53,8 +55,44 @@ func main() {
|
||||
},
|
||||
)
|
||||
issues := issue.FromGiteas(is, time.Minute*15)
|
||||
r := report.Report{Issues: issues}
|
||||
fmt.Print(r.ToHTML())
|
||||
r := report.New(
|
||||
issues,
|
||||
report.Entity{
|
||||
Name: "schreifuchs.ch",
|
||||
IBAN: "CH06 0079 0042 5877 0443 7",
|
||||
Address: report.Address{
|
||||
Street: "Kilchbergerweg",
|
||||
Number: "1",
|
||||
ZIPCode: "3052",
|
||||
Place: "Zollikofen",
|
||||
Country: "Schweiz",
|
||||
},
|
||||
Contact: "Niklas Breitenstein",
|
||||
},
|
||||
report.Entity{
|
||||
Name: "Lou Taylor",
|
||||
Address: report.Address{
|
||||
Street: "Alpenstrasse",
|
||||
Number: "22",
|
||||
ZIPCode: "4950",
|
||||
Place: "Huttwil",
|
||||
Country: "Schweiz",
|
||||
},
|
||||
Contact: "Loana Groux",
|
||||
},
|
||||
16,
|
||||
)
|
||||
html := r.ToHTML()
|
||||
|
||||
// fmt.Print(html)
|
||||
pdfs, err := pdf.New("http://localhost:3030")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
ducument, err := pdfs.HtmlToPdf(html)
|
||||
|
||||
io.Copy(os.Stdout, ducument)
|
||||
}
|
||||
|
||||
func Filter[T any](slice []T, ok func(T) bool) []T {
|
||||
|
||||
Reference in New Issue
Block a user