Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(status): describe the status list's mediaUrl as the gateway route
Yudhi Armyndhariseb1cb256f610
diff --git a/src/modules/status/dto/status-response.dto.spec.ts b/src/modules/status/dto/status-response.dto.spec.tsnew file mode 100644index 000000000..760cedaaf--- /dev/null+++ b/src/modules/status/dto/status-response.dto.spec.ts@@ -0,0 +1,19 @@+import { DECORATORS } from '@nestjs/swagger';+import { StatusDto } from './status-response.dto';++// The GET status routes answer from the status store (StatusStoreService.toStatus), not the engine, so+// the published schema must describe that shape: a gateway media path, and no inline media bytes.+describe('StatusDto', () => {+ const property = (name: string): { description?: string } | undefined =>+ Reflect.getMetadata(DECORATORS.API_MODEL_PROPERTIES, StatusDto.prototype, name) as+ { description?: string } | undefined;++ it('does not advertise a media field the store never returns', () => {+ expect(property('media')).toBeUndefined();+ });++ it('describes mediaUrl as the authenticated gateway media route', () => {+ expect(property('mediaUrl')?.description).toMatch(/\/sessions\/\{sessionId\}\/status\/\{statusId\}\/media/);+ expect(property('mediaUrl')?.description).toMatch(/X-API-Key/);+ });+});diff --git a/src/modules/status/dto/status-response.dto.ts b/src/modules/status/dto/status-response.dto.tsindex 9ffc2d8bd..71e1f32be 100644--- a/src/modules/status/dto/status-response.dto.ts+++ b/src/modules/status/dto/status-response.dto.ts@@ -37,16 +37,13 @@ export class StatusDto {@ApiPropertyOptional({ description: 'Caption, for an image or video status.' })caption?: string;- @ApiPropertyOptional({ description: 'Media URL as the engine reported it.' })- mediaUrl?: string;-@ApiPropertyOptional({- type: Object,description:- 'Downloaded media bytes, present only when the engine fetched them and they fit the inbound ' +- 'media cap. Absent is not an error — fetch the bytes from the media route instead.',+ 'Same-origin path to GET /sessions/{sessionId}/status/{statusId}/media, which needs X-API-Key like ' ++ 'any other route. Present only when the stored status kept its media.',+ example: '/api/sessions/my-session/status/ABCD1234/media',})- media?: object;+ mediaUrl?: string;@ApiPropertyOptional({ description: 'Background colour of a text or voice status.', example: '#0a5c36' })backgroundColor?: string;