From 513284f589d62b5d421e83bfa7785761369889a7 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Sun, 26 Dec 2021 17:55:23 +0800 Subject: [PATCH] update --- calendar/event.go | 5 +++++ 1 file changed, 5 insertions(+) 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 }