feat(settings): add default subscriptions for new users

- add default subscriptions to admin settings

- auto-assign subscriptions on register and admin user creation

- add validation/tests and align settings UI with subscription selector patterns
This commit is contained in:
PMExtra
2026-03-02 03:41:50 +08:00
parent 3613695f91
commit 7e02082209
21 changed files with 730 additions and 30 deletions

View File

@@ -284,6 +284,13 @@ func ProvideAPIKeyAuthCacheInvalidator(apiKeyService *APIKeyService) APIKeyAuthC
return apiKeyService
}
// ProvideSettingService wires SettingService with group reader for default subscription validation.
func ProvideSettingService(settingRepo SettingRepository, groupRepo GroupRepository, cfg *config.Config) *SettingService {
svc := NewSettingService(settingRepo, cfg)
svc.SetDefaultSubscriptionGroupReader(groupRepo)
return svc
}
// ProviderSet is the Wire provider set for all services
var ProviderSet = wire.NewSet(
// Core services
@@ -326,7 +333,7 @@ var ProviderSet = wire.NewSet(
ProvideRateLimitService,
NewAccountUsageService,
NewAccountTestService,
NewSettingService,
ProvideSettingService,
NewDataManagementService,
ProvideOpsSystemLogSink,
NewOpsService,
@@ -339,6 +346,7 @@ var ProviderSet = wire.NewSet(
ProvideEmailQueueService,
NewTurnstileService,
NewSubscriptionService,
wire.Bind(new(DefaultSubscriptionAssigner), new(*SubscriptionService)),
ProvideConcurrencyService,
NewUsageRecordWorkerPool,
ProvideSchedulerSnapshotService,