fix insertion calendar even if no user found

This commit is contained in:
rick 2024-02-25 20:29:37 +01:00
parent 98e3a452a5
commit 77b5e29536
Signed by: Rick
GPG key ID: 5CBE8779CD27BCBA

View file

@ -31,9 +31,12 @@ func GetCalendarById(id int) (models.Calendar, error) {
func CreateCalendar(c *models.Calendar, name string) error { func CreateCalendar(c *models.Calendar, name string) error {
ctx := context.Background() ctx := context.Background()
db := get() db := get()
user, _ := GetUserByName(name) user, err := GetUserByName(name)
if err != nil {
return err
}
_, err := db.NewInsert().Model(c).Exec(ctx) _, err = db.NewInsert().Model(c).Exec(ctx)
if err != nil { if err != nil {
return err return err
} }