mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
fix updating file count.
This commit is contained in:
@@ -95,7 +95,7 @@ func CreateFile(filename string, description string, resourceID uint, storageID
|
||||
return err
|
||||
}
|
||||
err := tx.Model(&model.User{}).Where("id = ?", userID).
|
||||
UpdateColumn("FilesCount", gorm.Expr("FilesCount + ?", 1)).Error
|
||||
UpdateColumn("files_count", gorm.Expr("files_count + ?", 1)).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -131,7 +131,7 @@ func DeleteFile(id string) error {
|
||||
return err
|
||||
}
|
||||
return tx.Model(&model.User{}).Where("id = ?", f.UserID).
|
||||
UpdateColumn("FilesCount", gorm.Expr("FilesCount - ?", 1)).Error
|
||||
UpdateColumn("files_count", gorm.Expr("files_count - ?", 1)).Error
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user