fix: add prisma termsOfUse privacyPolicy columns, clean payload on server, update lang pt-BR and remove slogan truncation
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 1m1s
Details
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 1m1s
Details
This commit is contained in:
parent
82b0e0a054
commit
445caaa994
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="pt-BR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,8 @@ model SystemSettings {
|
||||||
brandSlogan String @default("Acelere seus estudos em informática e pacote Office no estilo Netflix.") @map("brand_slogan")
|
brandSlogan String @default("Acelere seus estudos em informática e pacote Office no estilo Netflix.") @map("brand_slogan")
|
||||||
cnpj String @default("") @map("cnpj")
|
cnpj String @default("") @map("cnpj")
|
||||||
address String @default("") @map("address")
|
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")
|
smtpHost String? @map("smtp_host")
|
||||||
smtpPort Int? @default(587) @map("smtp_port")
|
smtpPort Int? @default(587) @map("smtp_port")
|
||||||
|
|
|
||||||
19
server.ts
19
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) => {
|
app.post('/api/admin/settings', authenticateToken, requireAdmin, async (req: AuthenticatedRequest, res: Response) => {
|
||||||
const newSettings = req.body;
|
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();
|
const settings = await prisma.systemSettings.findFirst();
|
||||||
if (settings) {
|
if (settings) {
|
||||||
await prisma.systemSettings.update({
|
await prisma.systemSettings.update({
|
||||||
where: { id: settings.id },
|
where: { id: settings.id },
|
||||||
data: newSettings
|
data: cleanedSettings
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await prisma.systemSettings.create({
|
await prisma.systemSettings.create({
|
||||||
data: newSettings
|
data: cleanedSettings
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ export default function Navbar({ user, activeView, setView, onLogout, settings }
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{settings?.brandSlogan && (
|
{settings?.brandSlogan && (
|
||||||
<span className="text-[10px] text-zinc-400 font-medium ml-10 mt-0.5 max-w-[200px] truncate hidden md:block">
|
<span className="text-[10px] text-zinc-400 font-medium ml-10 mt-0.5 max-w-[350px] leading-tight hidden md:block">
|
||||||
{settings.brandSlogan}
|
{settings.brandSlogan}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue