feat(template): add name to the template definition
build / Go-Build (push) Successful in 3m1s
build / Go-Build (pull_request) Successful in 1m27s

This commit is contained in:
2026-05-26 14:47:03 +02:00
parent 20cb740eb6
commit 633859cabe
8 changed files with 102 additions and 12 deletions
+17
View File
@@ -0,0 +1,17 @@
package actions
import (
"log"
"tomatentum.net/svg-templater/internal/database"
)
func RenameSvg(id string, name string) error {
err := database.RenameSvg(id, name)
if err != nil {
return err
}
log.Printf("Changed template %s name to %s.\n", id, name)
return nil
}
+2 -2
View File
@@ -11,8 +11,8 @@ import (
"tomatentum.net/svg-templater/pkg/svg"
)
func Create(svgbuf []byte) (svg.TemplateData, error) {
data := svg.TemplateData{Id: generateId(), TemplateKeys: nil}
func Create(svgbuf []byte, name string) (svg.TemplateData, error) {
data := svg.TemplateData{Id: generateId(), Name: name, TemplateKeys: nil}
populateKeys(&data, svgbuf)
_, err := svg.Storage.Create(data.Id, bytes.NewReader(svgbuf))
+1
View File
@@ -4,6 +4,7 @@ const KeyRegex string = `\{\{\s*(.*?)\s*\}\}`
type TemplateData struct {
Id string
Name string
TemplateKeys []string
}