Skip to content

Commit

Permalink
fix: Include phone param on get-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Aug 8, 2022
1 parent fcb6a50 commit 46cc839
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/controller/deviceController.js
Expand Up @@ -470,11 +470,11 @@ export async function loadAndGetAllMessagesInChat(req, res) {
}
export async function getMessages(req, res) {
const { phone } = req.params;
const { count = 20, direction = 'before', id = 0 } = req.query;
const { count = 20, direction = 'before', id = null } = req.query;
try {
const response = await req.client.getMessages(`${phone}`, {
count: parseInt(count),
direction: direction,
direction: direction.toString(),
id: id,
});
return res.status(200).json({ status: 'success', response: response });
Expand Down
12 changes: 11 additions & 1 deletion src/swagger.json
Expand Up @@ -1604,7 +1604,7 @@
"deprecated": false
}
},
"/get-messages": {
"/get-messages/{phone}": {
"get": {
"tags": ["Chat"],
"summary": "Get messages in Chat",
Expand All @@ -1622,6 +1622,16 @@
"example": "application/json"
}
},
{
"in": "path",
"name": "phone",
"schema": {
"type": "string"
},
"required": true,
"description": "The contact ID, with @c.us or @g.us"
},

{
"name": "count",
"in": "query",
Expand Down

0 comments on commit 46cc839

Please sign in to comment.