fix insertion calendar even if no user found
This commit is contained in:
parent
98e3a452a5
commit
77b5e29536
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue