Skip to content
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

Merged
merged 3 commits into from
Jun 11, 2019
Merged

Conversation

MarcosSpessatto
Copy link
Contributor

No description provided.

Copy link

@renatobecker-zz renatobecker-zz left a 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' }, {
Copy link

@renatobecker-zz renatobecker-zz Jun 11, 2019

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;

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 }, {

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 }, {

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?

@renatobecker-zz renatobecker-zz added this to In progress in Omnichannel Roadmap via automation Jun 11, 2019
Omnichannel Roadmap automation moved this from In progress to Reviewer approved Jun 11, 2019
@renatobecker-zz renatobecker-zz merged commit ab6a0f3 into develop Jun 11, 2019
Omnichannel Roadmap automation moved this from Reviewer approved to Done Jun 11, 2019
@renatobecker-zz renatobecker-zz deleted the rest-inquiries branch June 11, 2019 19:21
@renatobecker-zz renatobecker-zz changed the title [NEW] Add endpoints to list inquiries and take a inquiry [NEW] Add Livechat inquiries endpoints Jun 11, 2019
@sampaiodiego sampaiodiego mentioned this pull request Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants