feat(invoice): add send route

This commit is contained in:
2025-08-26 20:30:48 +02:00
parent 958979c62b
commit 788571162d
35 changed files with 451 additions and 193 deletions

View File

@@ -0,0 +1,35 @@
package issue
import (
"fmt"
"regexp"
"strings"
"time"
"code.gitea.io/sdk/gitea"
)
type Issue struct {
gitea.Issue
Duration time.Duration
}
func (i Issue) Shorthand() string {
str := i.Repository.Name
if strings.Contains(str, "-") {
s := strings.Split(str, "-")
str = s[len(s)-1]
} else if len(str) > 3 {
str = str[:3]
}
return fmt.Sprintf("%s-%d", strings.ToUpper(str), i.Index)
}
func (i Issue) CleanBody() string {
reBlock := regexp.MustCompile("(?s)```info(.*?)```(.*)")
block := reBlock.FindStringSubmatch(i.Body)
if len(block) < 3 {
return i.Body
}
return strings.TrimSpace(block[2])
}