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:
@@ -5,6 +5,13 @@ import type {
|
||||
} from '@nexumi/shared';
|
||||
import type { SocialFeed } from '@prisma/client';
|
||||
import { prisma } from '../prisma';
|
||||
import { assertPremiumLimit, PremiumLimitError } from '../premium';
|
||||
|
||||
export class FeedPremiumError extends Error {
|
||||
constructor(public readonly code: 'premium_limit' | 'premium_feature') {
|
||||
super(code);
|
||||
}
|
||||
}
|
||||
|
||||
function toDashboard(feed: SocialFeed): SocialFeedDashboard {
|
||||
return {
|
||||
@@ -31,6 +38,15 @@ export async function createFeed(
|
||||
input: SocialFeedDashboardCreate
|
||||
): Promise<SocialFeedDashboard> {
|
||||
await prisma.guild.upsert({ where: { id: guildId }, update: {}, create: { id: guildId } });
|
||||
const currentCount = await prisma.socialFeed.count({ where: { guildId } });
|
||||
try {
|
||||
await assertPremiumLimit(prisma, guildId, 'feeds', currentCount);
|
||||
} catch (error) {
|
||||
if (error instanceof PremiumLimitError) {
|
||||
throw new FeedPremiumError(error.code === 'feature_disabled' ? 'premium_feature' : 'premium_limit');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
const feed = await prisma.socialFeed.create({
|
||||
data: {
|
||||
guildId,
|
||||
|
||||
Reference in New Issue
Block a user