CountWebhooksByUser returns the total number of webhooks (enabled + disabled) the user owns. Used by CreateWebhook to enforce the per-user cap from account_limits.max_webhooks.
(ctx context.Context, userID string)
| 304 | // disabled) the user owns. Used by CreateWebhook to enforce the |
| 305 | // per-user cap from account_limits.max_webhooks. |
| 306 | func (s *Store) CountWebhooksByUser(ctx context.Context, userID string) (int, error) { |
| 307 | var n int |
| 308 | err := s.pool.QueryRow(ctx, |
| 309 | `SELECT COUNT(*) FROM webhooks WHERE user_id = $1`, userID, |
| 310 | ).Scan(&n) |
| 311 | if err != nil { |
| 312 | return 0, err |
| 313 | } |
| 314 | return n, nil |
| 315 | } |
| 316 | |
| 317 | // MaxWebhooksForUser returns the per-user cap from account_limits. |
| 318 | // Users without an account_limits row default to 50 — the column |
no test coverage detected