[NEW] Add Livechat inquiries endpoints#14779
Merged
renatobecker-zz merged 3 commits intodevelopfrom Jun 11, 2019
Merged
Conversation
renatobecker-zz
suggested changes
Jun 11, 2019
renatobecker-zz
left a comment
There was a problem hiding this comment.
Hey!
I left just some comments here...
Thanks!
| } | ||
| const { offset, count } = this.getPaginationItems(); | ||
| const { sort } = this.parseJsonQuery(); | ||
| const cursor = LivechatInquiry.find({ status: 'open' }, { |
There was a problem hiding this comment.
I know we decided to return the entire inquiry object, but due to the large number of agents available, it would be better to return only a few fields, such as:
{
"_id": "jz9WE69S9zmvpW2Fd",
"rid": "Q3ZLHdXYmPk8PxfPm",
"name": "Renato Becker",
"ts": "2019-06-11T02:15:54.761Z",
"status": "open"
}
| if (!hasPermission(this.userId, 'view-livechat-manager')) { | ||
| return API.v1.unauthorized(); | ||
| } | ||
| const { inquiryId, userId } = this.bodyParams; |
There was a problem hiding this comment.
What do you think about using the check approach? Like this:
{
try {
check(this.bodyParams, {
inquiriId: string,
userId: Match.Maybe(String),
});
...
} catch (e) {
return API.v1.failure(e);
}
}
renatobecker-zz
suggested changes
Jun 11, 2019
| }, | ||
| }); | ||
|
|
||
| API.v1.addRoute('livechat/inquiry.take', { authRequired: true }, { |
There was a problem hiding this comment.
I think it would be better renaming this route to livechat/inquiries.take, ok?
| import { Users } from '../../../../models'; | ||
| import { LivechatInquiry } from '../../../lib/LivechatInquiry'; | ||
|
|
||
| API.v1.addRoute('livechat/inquiries', { authRequired: true }, { |
There was a problem hiding this comment.
I think it would be better renaming this route to livechat/inquiries.list, ok?
renatobecker-zz
approved these changes
Jun 11, 2019
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.