diff --git a/src/docs/swagger.yaml b/src/docs/swagger.yaml index 5fa8cf25..dce5a266 100644 --- a/src/docs/swagger.yaml +++ b/src/docs/swagger.yaml @@ -145,7 +145,28 @@ paths: '200': description: Successful response content: - application/json: {} + application/json: + schema: + type: array + items: + type: object + properties: + instance: + type: object + properties: + instanceName: + type: string + owner: + type: string + profileName: + type: string + profilePictureUrl: + type: string + auth: + type: object + properties: + jwt: + type: string /instance/connect/{instanceName}: get: tags: diff --git a/src/whatsapp/services/monitor.service.ts b/src/whatsapp/services/monitor.service.ts index 1a67d394..81b083e0 100644 --- a/src/whatsapp/services/monitor.service.ts +++ b/src/whatsapp/services/monitor.service.ts @@ -96,6 +96,7 @@ export class WAMonitoringService { for await (const [key, value] of Object.entries(this.waInstances)) { if (value && value.connectionStatus.state === 'open') { + const auth = await this.repository.auth.find(key); instances.push({ instance: { instanceName: key, @@ -103,11 +104,12 @@ export class WAMonitoringService { profileName: (await value.getProfileName()) || 'not loaded', profilePictureUrl: value.profilePictureUrl, }, + auth, }); } } - return instances.find((i) => i.instance.instanceName === instanceName) ?? instances; + return instances; } private delInstanceFiles() {