(userId int, planId int)
| 401 | } |
| 402 | |
| 403 | func CountUserSubscriptionsByPlan(userId int, planId int) (int64, error) { |
| 404 | if userId <= 0 || planId <= 0 { |
| 405 | return 0, errors.New("invalid userId or planId") |
| 406 | } |
| 407 | var count int64 |
| 408 | if err := DB.Model(&UserSubscription{}). |
| 409 | Where("user_id = ? AND plan_id = ?", userId, planId). |
| 410 | Count(&count).Error; err != nil { |
| 411 | return 0, err |
| 412 | } |
| 413 | return count, nil |
| 414 | } |
| 415 | |
| 416 | func getUserGroupByIdTx(tx *gorm.DB, userId int) (string, error) { |
| 417 | if userId <= 0 { |
no outgoing calls
no test coverage detected