chore!: remove deprecated endpoint livechat/inquiries.queued (#33453)

pull/33628/head
Abhinav Kumar 2 years ago committed by Guilherme Gazzo
parent 92139cd93c
commit b19ae4dbc7
  1. 6
      .changeset/sixty-moons-walk.md
  2. 34
      apps/meteor/app/livechat/imports/server/rest/inquiries.ts
  3. 24
      apps/meteor/tests/end-to-end/api/livechat/05-inquiries.ts
  4. 30
      packages/rest-typings/src/v1/omnichannel.ts

@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': major
'@rocket.chat/meteor': major
---
Removes deprecated `livechat/inquiries.queued` endpoint. Moving forward use the `livechat/inquiries.queuedForUser` endpoint.

@ -3,7 +3,6 @@ import { LivechatInquiry, LivechatDepartment, Users } from '@rocket.chat/models'
import {
isGETLivechatInquiriesListParams,
isPOSTLivechatInquiriesTakeParams,
isGETLivechatInquiriesQueuedParams,
isGETLivechatInquiriesQueuedForUserParams,
isGETLivechatInquiriesGetOneParams,
} from '@rocket.chat/rest-typings';
@ -69,39 +68,6 @@ API.v1.addRoute(
},
);
API.v1.addRoute(
'livechat/inquiries.queued',
{
authRequired: true,
permissionsRequired: ['view-l-room'],
validateParams: isGETLivechatInquiriesQueuedParams,
deprecation: {
version: '7.0.0',
alternatives: ['livechat/inquiries.queuedForUser'],
},
},
{
async get() {
const { offset, count } = await getPaginationItems(this.queryParams);
const { sort } = await this.parseJsonQuery();
const { department } = this.queryParams;
return API.v1.success(
await findInquiries({
userId: this.userId,
department,
status: LivechatInquiryStatus.QUEUED,
pagination: {
offset,
count,
sort,
},
}),
);
},
},
);
API.v1.addRoute(
'livechat/inquiries.queuedForUser',
{ authRequired: true, permissionsRequired: ['view-l-room'], validateParams: isGETLivechatInquiriesQueuedForUserParams },

@ -52,28 +52,6 @@ describe('LIVECHAT - inquiries', () => {
});
});
describe('livechat/inquiries.queued', () => {
it('should return an "unauthorized error" when the user does not have the necessary permission', async () => {
await updatePermission('view-l-room', []);
await request.get(api('livechat/inquiries.queued')).set(credentials).expect('Content-Type', 'application/json').expect(403);
});
it('should return an array of inquiries', async () => {
await updatePermission('view-l-room', ['admin']);
await request
.get(api('livechat/inquiries.queued'))
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res: Response) => {
expect(res.body).to.have.property('success', true);
expect(res.body.inquiries).to.be.an('array');
expect(res.body).to.have.property('offset');
expect(res.body).to.have.property('total');
expect(res.body).to.have.property('count');
});
});
});
describe('livechat/inquiries.getOne', () => {
it('should return an "unauthorized error" when the user does not have the necessary permission', async () => {
await updatePermission('view-l-room', []);
@ -235,7 +213,7 @@ describe('LIVECHAT - inquiries', () => {
});
it('should return an "unauthorized error" when the user does not have the necessary permission', async () => {
await updatePermission('view-l-room', []);
await request.get(api('livechat/inquiries.queued')).set(credentials).expect('Content-Type', 'application/json').expect(403);
await request.get(api('livechat/inquiries.queuedForUser')).set(credentials).expect('Content-Type', 'application/json').expect(403);
});
it('should return an array of inquiries', async () => {
await restorePermissionToRoles('view-l-room');

@ -2977,33 +2977,6 @@ const POSTLivechatInquiriesTakeParamsSchema = {
export const isPOSTLivechatInquiriesTakeParams = ajv.compile<POSTLivechatInquiriesTakeParams>(POSTLivechatInquiriesTakeParamsSchema);
type GETLivechatInquiriesQueuedParams = PaginatedRequest<{ department?: string }>;
const GETLivechatInquiriesQueuedParamsSchema = {
type: 'object',
properties: {
count: {
type: 'number',
nullable: true,
},
offset: {
type: 'number',
nullable: true,
},
sort: {
type: 'string',
nullable: true,
},
department: {
type: 'string',
nullable: true,
},
},
additionalProperties: false,
};
export const isGETLivechatInquiriesQueuedParams = ajv.compile<GETLivechatInquiriesQueuedParams>(GETLivechatInquiriesQueuedParamsSchema);
type GETLivechatInquiriesQueuedForUserParams = PaginatedRequest<{ department?: string }>;
const GETLivechatInquiriesQueuedForUserParamsSchema = {
@ -3969,9 +3942,6 @@ export type OmnichannelEndpoints = {
'/v1/livechat/inquiries.take': {
POST: (params: POSTLivechatInquiriesTakeParams) => { inquiry: ILivechatInquiryRecord };
};
'/v1/livechat/inquiries.queued': {
GET: (params: GETLivechatInquiriesQueuedParams) => PaginatedResult<{ inquiries: ILivechatInquiryRecord[] }>;
};
'/v1/livechat/inquiries.queuedForUser': {
GET: (params: GETLivechatInquiriesQueuedForUserParams) => PaginatedResult<{ inquiries: ILivechatInquiryRecord[] }>;
};

Loading…
Cancel
Save