Fix expense error in AfterDelete hook

This commit is contained in:
qowevisa 2024-11-16 20:30:47 +02:00
parent d230ee7cf2
commit 7b461ce985

View File

@ -125,9 +125,6 @@ func (e *Expense) AfterDelete(tx *gorm.DB) (err error) {
if card.UserID != e.UserID { if card.UserID != e.UserID {
return ERROR_EXPENSE_INVALID_USERID return ERROR_EXPENSE_INVALID_USERID
} }
if card.Balance < e.Value {
return ERROR_EXPENSE_CARD_INSUFFICIENT_BALANCE
}
card.Balance += e.Value card.Balance += e.Value
if err := tx.Save(card).Error; err != nil { if err := tx.Save(card).Error; err != nil {
return err return err