✨ Update usage grpc call
This commit is contained in:
@ -238,3 +238,13 @@ func DeleteAttachment(item models.Attachment, txs ...*gorm.DB) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func CountAttachmentUsage(id []uint, delta int) (int64, error) {
|
||||
if tx := database.C.Model(&models.Attachment{}).
|
||||
Where("id IN ?", id).
|
||||
Update("used_count", gorm.Expr("used_count + ?", delta)); tx.Error != nil {
|
||||
return tx.RowsAffected, tx.Error
|
||||
} else {
|
||||
return tx.RowsAffected, nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user