feat(svg): added svg template delete endpoint
build / Go-Build (push) Successful in 1m23s
build / Go-Build (pull_request) Successful in 1m23s

This commit is contained in:
2026-05-15 17:24:45 +02:00
parent 372bf4f97f
commit e39821a3e2
8 changed files with 82 additions and 4 deletions
+17
View File
@@ -15,6 +15,7 @@ const SVGTABLECREATE string = `
const INSERTSVGSQL string = "INSERT INTO svg VALUES (?, ?);"
const GETSPECIFICSVGSQL string = "SELECT * FROM svg WHERE name = ?;"
const GETSVGSQL string = "SELECT * FROM svg;"
const DELETESVGSQL string = "DELETE FROM svg WHERE name = ?;"
func InsertSVG(data *svg.TemplateData) error {
json, err := json.Marshal(data.TemplateKeys)
@@ -72,3 +73,19 @@ func GetSpecificSVG(id string) (svg.TemplateData, error) {
}
return svg.TemplateData{Id: id, TemplateKeys: keys}, nil
}
func DeleteSvg(id string) (bool, error) {
res, err := database.Exec(DELETESVGSQL, id)
if err != nil {
return false, err
}
num, err := res.RowsAffected()
if err != nil {
return false, err
}
if num == 0 {
return false, nil
}
return true, nil
}