mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 21:17:27 +00:00
🔧 chore: Unify subscription plan status toggle with PATCH endpoint
Replace separate enable/disable flows with a single PATCH API that updates the enabled flag. Update frontend hooks and table actions to call the unified endpoint and keep UI behavior consistent. Introduce a minimal admin controller handler and route for the status update.
This commit is contained in:
@@ -106,6 +106,16 @@ func GetJsonString(data any) string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// NormalizeBillingPreference clamps the billing preference to valid values.
|
||||
func NormalizeBillingPreference(pref string) string {
|
||||
switch strings.TrimSpace(pref) {
|
||||
case "subscription_first", "wallet_first", "subscription_only", "wallet_only":
|
||||
return strings.TrimSpace(pref)
|
||||
default:
|
||||
return "subscription_first"
|
||||
}
|
||||
}
|
||||
|
||||
// MaskEmail masks a user email to prevent PII leakage in logs
|
||||
// Returns "***masked***" if email is empty, otherwise shows only the domain part
|
||||
func MaskEmail(email string) string {
|
||||
|
||||
Reference in New Issue
Block a user