master
Evan Chen 2021-12-26 17:55:23 +08:00
parent 00bb55b5c3
commit 513284f589
1 changed files with 5 additions and 0 deletions

View File

@ -32,6 +32,11 @@ func (e *Event) BeforeSave(tx *gorm.DB) (err error) {
if e.CalendarID == "" { if e.CalendarID == "" {
return errors.ErrorBadRequest return errors.ErrorBadRequest
} }
if e.Location == "" {
loc := ""
tx.Raw("select name from calendars where id = ?", e.CalendarID).Scan(&loc)
e.Location = loc
}
return return
} }