Implement premium features and GDPR compliance in bot and WebUI
- Added new models for premium tier configurations and assignments, enabling feature limits for free and premium users. - Introduced GDPR deletion logging and commands for user data management. - Enhanced logging configuration with retention days for audit logs. - Updated bot commands and job processing to include new premium and GDPR functionalities. - Improved localization with new keys for premium features and GDPR commands in both English and German. - Added UI components for managing premium settings and logging retention in the WebUI.
This commit is contained in:
35
packages/shared/src/premium.test.ts
Normal file
35
packages/shared/src/premium.test.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
DEFAULT_PREMIUM_TIER_CONFIGS,
|
||||
GuildPremiumAssignSchema,
|
||||
isAssignmentActive,
|
||||
limitKeyForResource,
|
||||
PremiumTierConfigSchema
|
||||
} from './premium.js';
|
||||
|
||||
describe('premium schemas', () => {
|
||||
it('parses default free config', () => {
|
||||
const parsed = PremiumTierConfigSchema.parse(DEFAULT_PREMIUM_TIER_CONFIGS.FREE);
|
||||
expect(parsed.maxTags).toBe(15);
|
||||
expect(parsed.features.feeds).toBe(true);
|
||||
});
|
||||
|
||||
it('maps resources to limit keys', () => {
|
||||
expect(limitKeyForResource('tags')).toBe('maxTags');
|
||||
expect(limitKeyForResource('backups')).toBe('maxBackups');
|
||||
});
|
||||
|
||||
it('validates guild assignment and expiry', () => {
|
||||
expect(
|
||||
GuildPremiumAssignSchema.parse({
|
||||
guildId: '123456789012345678',
|
||||
tier: 'PREMIUM',
|
||||
note: null,
|
||||
expiresAt: null
|
||||
}).tier
|
||||
).toBe('PREMIUM');
|
||||
expect(isAssignmentActive(null)).toBe(true);
|
||||
expect(isAssignmentActive(new Date(Date.now() - 1000))).toBe(false);
|
||||
expect(isAssignmentActive(new Date(Date.now() + 60_000))).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user