admin: new route to fill URLIds if they are not defined

This commit is contained in:
nemunaire 2018-01-23 01:00:24 +01:00
commit 5fdb35eabc
4 changed files with 56 additions and 0 deletions

View file

@ -60,6 +60,14 @@ func CreateTheme(name string, url_id string, authors string, intro string) (Them
}
}
func (t *Theme) FixURLId() bool {
if t.URLId == "" {
t.URLId = ToURLid(t.Name)
return true
}
return false
}
func (t Theme) Update() (int64, error) {
if res, err := DBExec("UPDATE themes SET name = ?, url_id = ?, authors = ?, intro = ? WHERE id_theme = ?", t.Name, t.URLId, t.Authors, t.Intro, t.Id); err != nil {
return 0, err