use transaction
parent
d9232010fc
commit
95dba85b9f
|
@ -35,8 +35,7 @@ func HasEventAccess(c *gin.Context, e *Event, cid string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func ChangeCalGroup(cal_id, to string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
func ChangeCalGroup(tx *gorm.DB, cal_id, to string) error {
|
||||
affected := tx.Exec(`update calendars set group_id = (
|
||||
select id from groups where name = ?
|
||||
) where id = ?`, to, cal_id).RowsAffected
|
||||
|
@ -47,5 +46,4 @@ func ChangeCalGroup(cal_id, to string) error {
|
|||
select id from groups where name = ?
|
||||
) where calendar_id = ?`, to, cal_id)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue