feat(notify): convert email lists to NotifyEmailEntry struct with toggle support
- Change balance_notify_extra_emails and account_quota_notify_emails
from []string to []NotifyEmailEntry{email, disabled, verified}
- Add per-email enable/disable toggle for both user and admin notifications
- Add PUT /user/notify-email/toggle API endpoint
- Fix critical bug: API key auth cache snapshot missing balance notify
fields (Email, Username, BalanceNotifyEnabled, etc.), causing
notifications to never fire on cached request paths
- Bump cache snapshot version 3→4 to invalidate stale entries
- Add SQL migration 104 to convert old format data
- Backward compatible: parseNotifyEmails auto-detects old/new format
- User balance notify: max 3 emails (primary + 2 extra)
- Admin quota notify: unlimited emails, each with toggle
This commit is contained in:
@@ -22,6 +22,16 @@ export interface FetchOptions {
|
||||
signal?: AbortSignal
|
||||
}
|
||||
|
||||
// ==================== Notification Types ====================
|
||||
|
||||
/** Notification email entry with enable/disable and verification state.
|
||||
* email="" is a placeholder for the primary email (user's registration email or admin email). */
|
||||
export interface NotifyEmailEntry {
|
||||
email: string
|
||||
disabled: boolean
|
||||
verified: boolean
|
||||
}
|
||||
|
||||
// ==================== User & Auth Types ====================
|
||||
|
||||
export interface User {
|
||||
@@ -35,7 +45,7 @@ export interface User {
|
||||
allowed_groups: number[] | null // Allowed group IDs (null = all non-exclusive groups)
|
||||
balance_notify_enabled: boolean
|
||||
balance_notify_threshold: number | null
|
||||
balance_notify_extra_emails: string[]
|
||||
balance_notify_extra_emails: NotifyEmailEntry[]
|
||||
subscriptions?: UserSubscription[] // User's active subscriptions
|
||||
created_at: string
|
||||
updated_at: string
|
||||
|
||||
Reference in New Issue
Block a user