fix(iios): use extended query parser so nested metadata filters parse

NestJS 11 runs Express 5, whose default 'simple' query parser ignores nested
params like ?metadata[key]=value — so GET /v1/threads silently dropped the
metadata filter, causing e.g. an app's "reuse existing thread for this customer"
check to match ANY thread. Set the qs-based 'extended' parser.

Verified: filtering by a non-existent metadata value now returns 0 (was returning
all); the be-crm support smoke goes 12/12 (was 10/12 once a prior thread existed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-11 14:33:28 +05:30
parent b918a21083
commit 77dd5bac82
+4
View File
@@ -9,6 +9,10 @@ import { PolicyDeniedFilter } from './platform/policy-denied.filter';
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule, { rawBody: true });
// Express 5 defaults to the 'simple' query parser, which ignores nested params like
// ?metadata[key]=value — so generic metadata filters would be silently dropped. Use the
// qs-based 'extended' parser so those parse into a nested object.
app.getHttpAdapter().getInstance().set('query parser', 'extended');
app.use(traceMiddleware); // request-scoped trace context + x-trace-id header (P9)
app.useGlobalPipes(
new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true }),