FEAT: Adiciona limite de tamanho para o corpo da requisição e ajusta retorno de mensagem no serviço Whatsapp
All checks were successful
Deploy Dev / deploy (push) Successful in 2s

This commit is contained in:
Rafael Alves Lopes 2026-05-22 14:38:56 -03:00
parent 22e4742384
commit e1a31f3f07
2 changed files with 7 additions and 2 deletions

View File

@ -1,13 +1,14 @@
import 'reflect-metadata';
import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { json, urlencoded } from 'express';
import { AppModule } from './app.module';
import { loadEnv } from './infra/config/load-env';
async function bootstrap() {
loadEnv();
const app = await NestFactory.create(AppModule);
const app = await NestFactory.create(AppModule, { bodyParser: false });
const frontendUrl = process.env.FRONTEND_URL || 'http://localhost:3000';
const allowedOrigins = new Set(
frontendUrl
@ -18,6 +19,10 @@ async function bootstrap() {
allowedOrigins.add('http://localhost:3000');
allowedOrigins.add('http://localhost:5173');
const port = Number(process.env.PORT || process.env.BACKEND_PORT || 3001);
const requestBodyLimit = process.env.REQUEST_BODY_LIMIT || '25mb';
app.use(json({ limit: requestBodyLimit }));
app.use(urlencoded({ extended: true, limit: requestBodyLimit }));
app.enableCors({
origin(origin, callback) {

View File

@ -584,7 +584,7 @@ export class WhatsappService implements OnModuleInit {
}
if (!cleanMessage) {
return `*Atendente: ${cleanSenderName}*`;
return '';
}
return `*Atendente: ${cleanSenderName}*\n\n${cleanMessage}`;