348f2e3451
Add nullable brand_limit / question_limit columns on tenants so ops admins can override the plan-derived brand-library quotas per account. When set, these take precedence over config.yml plan defaults across the brand-library summary, question materialization, and the daily monitoring worker's primary-client plan resolution. Ops side exposes them on admin-user create plus a new PUT /admin-users/:id/limits endpoint, invalidating the brand-library summary cache on change. The ops-web AdminUsers view gains matching inputs on the create and edit modals. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
19 lines
465 B
Go
19 lines
465 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestAdminUserInvalidateQuotaSummaryCache(t *testing.T) {
|
|
cache := &recordingCache{}
|
|
svc := NewAdminUserService(nil, nil, "").WithCache(cache)
|
|
|
|
svc.invalidateQuotaSummaryCache(context.Background(), 42)
|
|
|
|
if want := []string{"workspace:quota_summary:42", "brand:library_summary:42"}; !reflect.DeepEqual(cache.deletedKeys, want) {
|
|
t.Fatalf("deleted keys = %v, want %v", cache.deletedKeys, want)
|
|
}
|
|
}
|