-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEW] Add Livechat inquiries endpoints #14779
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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);
}
}
}, | ||
}); | ||
|
||
API.v1.addRoute('livechat/inquiry.take', { authRequired: true }, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better renaming this route to livechat/inquiries.list
, ok?
No description provided.