diff --git a/calendar/event.go b/calendar/event.go index 5942b66..ccec497 100644 --- a/calendar/event.go +++ b/calendar/event.go @@ -32,6 +32,11 @@ func (e *Event) BeforeSave(tx *gorm.DB) (err error) { if e.CalendarID == "" { return errors.ErrorBadRequest } + if e.Location == "" { + loc := "" + tx.Raw("select name from calendars where id = ?", e.CalendarID).Scan(&loc) + e.Location = loc + } return }