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:
@@ -4,6 +4,7 @@ import { applyFeedTemplate, SocialFeedTypeSchema } from '@nexumi/shared';
|
||||
import { z } from 'zod';
|
||||
import { ensureGuild } from '../../guild.js';
|
||||
import { logger } from '../../logger.js';
|
||||
import { assertPremiumLimit, PremiumLimitError } from '../../premium.js';
|
||||
import type { BotContext } from '../../types.js';
|
||||
import { fetchFeedItems, type FeedItem, type FetchResult } from './fetchers.js';
|
||||
|
||||
@@ -49,6 +50,16 @@ export async function addFeed(
|
||||
await ensureGuild(prisma, guildId);
|
||||
const sourceId = normalizeFeedSource(input.type, input.source);
|
||||
|
||||
const currentCount = await prisma.socialFeed.count({ where: { guildId } });
|
||||
try {
|
||||
await assertPremiumLimit(prisma, guildId, 'feeds', currentCount);
|
||||
} catch (error) {
|
||||
if (error instanceof PremiumLimitError) {
|
||||
throw new FeedError(error.code === 'feature_disabled' ? 'premium_feature' : 'premium_limit');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
return prisma.socialFeed.create({
|
||||
data: {
|
||||
guildId,
|
||||
|
||||
Reference in New Issue
Block a user