Skip to content

Commit

Permalink
return auth
Browse files Browse the repository at this point in the history
  • Loading branch information
jrCleber committed Aug 14, 2023
1 parent 0a16892 commit 74ab771
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 22 additions & 1 deletion src/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion src/whatsapp/services/monitor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,20 @@ 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,
owner: value.wuid,
profileName: (await value.getProfileName()) || 'not loaded',
profilePictureUrl: value.profilePictureUrl,
},
auth,
});
}
}

return instances.find((i) => i.instance.instanceName === instanceName) ?? instances;
return instances;
}

private delInstanceFiles() {
Expand Down

0 comments on commit 74ab771

Please sign in to comment.