MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / CountWebhooksByUser

Method CountWebhooksByUser

internal/identity/webhooks.go:306–315  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

304// disabled) the user owns. Used by CreateWebhook to enforce the
305// per-user cap from account_limits.max_webhooks.
306func (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

Callers 1

CreateWebhookMethod · 0.95

Implementers 1

Storeinternal/identity/store.go

Calls 2

ScanMethod · 0.80
QueryRowMethod · 0.80

Tested by

no test coverage detected