feat(api): update template

This commit is contained in:
Leons Aleksandrovs
2025-07-13 14:19:47 +03:00
parent 23f8cde5af
commit fa095def44
4 changed files with 63 additions and 7 deletions
+10
View File
@@ -72,3 +72,13 @@ func Get(where string, args ...any) ([]Template, error) {
return results, nil
}
func Update(id int, name string, template string) error {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
query := `UPDATE templates SET name = $1, template = $2 WHERE id = $3`
_, err := db.Pool.Exec(ctx, query, name, template, id)
return err
}