Korrigiere Reihenfolge, um Foreign Keys zu respektieren

This commit is contained in:
Gonne 2023-10-21 16:37:47 +02:00
parent 9632545d94
commit ba839a2e86

View file

@ -107,8 +107,8 @@ func (r *RequestRepo) Execute(request models.Request) error {
_, err = r.db.Exec("UPDATE officeHour SET active=true WHERE id=?", request.OfficeHour.Id)
r.db.Exec("DELETE FROM request WHERE officeHour=?", request.OfficeHour.Id)
case models.RequestDelete:
err = r.officeHourRepo.Delete(request.OfficeHour)
r.db.Exec("DELETE FROM request WHERE officeHour=?", request.OfficeHour.Id)
err = r.officeHourRepo.Delete(request.OfficeHour)
default:
log.Printf("Executing request: Action type %d unknown.", request.Action)
_, err = r.db.Exec("DELETE FROM request WHERE id=?", request.Id)