diff --git a/index.html b/index.html index 2da8ca1..5633526 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d992644..6054ce9 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -271,6 +271,8 @@ model SystemSettings { brandSlogan String @default("Acelere seus estudos em informática e pacote Office no estilo Netflix.") @map("brand_slogan") cnpj String @default("") @map("cnpj") address String @default("") @map("address") + termsOfUse String? @map("terms_of_use") @db.Text + privacyPolicy String? @map("privacy_policy") @db.Text smtpHost String? @map("smtp_host") smtpPort Int? @default(587) @map("smtp_port") diff --git a/server.ts b/server.ts index 29c3389..98f521c 100644 --- a/server.ts +++ b/server.ts @@ -1274,15 +1274,30 @@ app.get('/api/admin/settings', authenticateToken, requireAdmin, async (req: Auth app.post('/api/admin/settings', authenticateToken, requireAdmin, async (req: AuthenticatedRequest, res: Response) => { const newSettings = req.body; + const allowedKeys = [ + 'trialDurationDays', 'asaasEnvironment', 'asaasApiKey', 'asaasWebhookUrl', + 'asaasWebhookSecret', 'helpText', 'enableBoleto', 'enableInstallmentBoleto', + 'maxBoletoInstallments', 'evolutionApiUrl', 'evolutionApiKey', 'evolutionInstance', + 'whatsappConnected', 'whatsappPhoneNumber', 'brandName', 'brandSlogan', 'cnpj', + 'address', 'smtpHost', 'smtpPort', 'smtpUser', 'smtpPass', 'smtpFrom', 'smtpSecure', + 'termsOfUse', 'privacyPolicy' + ]; + const cleanedSettings: any = {}; + for (const key of allowedKeys) { + if (newSettings[key] !== undefined) { + cleanedSettings[key] = newSettings[key]; + } + } + const settings = await prisma.systemSettings.findFirst(); if (settings) { await prisma.systemSettings.update({ where: { id: settings.id }, - data: newSettings + data: cleanedSettings }); } else { await prisma.systemSettings.create({ - data: newSettings + data: cleanedSettings }); } diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index c73ba56..ab5d854 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -116,7 +116,7 @@ export default function Navbar({ user, activeView, setView, onLogout, settings } {settings?.brandSlogan && ( - + {settings.brandSlogan} )}