Skip to content

Commit

Permalink
Fix server crash
Browse files Browse the repository at this point in the history
  • Loading branch information
1-Harshit committed Aug 1, 2023
1 parent eaa7f9d commit 89a5e36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions application/db.events.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func updateEvent(ctx *gin.Context, event *ProformaEvent) error {
return tx.Error
}

func updateEventCalID(event *ProformaEvent) error {
tx := db.Clauses(clause.Returning{}).Where("id = ?", event.ID).Updates(event)
return tx.Error
}

func deleteEvent(ctx *gin.Context, id uint) error {
tx := db.WithContext(ctx).Where("id = ?", id).Delete(&ProformaEvent{})
return tx.Error
Expand Down
4 changes: 2 additions & 2 deletions application/util.calendar.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func insertCalenderEvent(event *ProformaEvent, proforma *Proforma, loc *time.Loc
}

event.CalID = cevent.Id
err = updateEvent(nil, event)
err = updateEventCalID(event)
if err != nil {
logrus.Errorf("Unable to update event. %v", err)
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func insertCalenderApplicationDeadline(proforma *Proforma, event *ProformaEvent)
}

event.CalID = cevent.Id
err = updateEvent(nil, event)
err = updateEventCalID(event)
if err != nil {
logrus.Errorf("Unable to update event. %v", err)
}
Expand Down

0 comments on commit 89a5e36

Please sign in to comment.