Skip to content

Commit

Permalink
chore!: remove deprecated endpoint livechat/inquiries.queued (#33453)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavkrin authored and ggazzo committed Oct 11, 2024
1 parent 2eb56a7 commit 550234d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 87 deletions.
6 changes: 6 additions & 0 deletions .changeset/sixty-moons-walk.md
Original file line number Diff line number Diff line change
@@ -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.
34 changes: 0 additions & 34 deletions apps/meteor/app/livechat/imports/server/rest/inquiries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { LivechatInquiry, LivechatDepartment, Users } from '@rocket.chat/models'
import {
isGETLivechatInquiriesListParams,
isPOSTLivechatInquiriesTakeParams,
isGETLivechatInquiriesQueuedParams,
isGETLivechatInquiriesQueuedForUserParams,
isGETLivechatInquiriesGetOneParams,
} from '@rocket.chat/rest-typings';
Expand Down Expand Up @@ -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 },
Expand Down
24 changes: 1 addition & 23 deletions apps/meteor/tests/end-to-end/api/livechat/05-inquiries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', []);
Expand Down Expand Up @@ -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');
Expand Down
30 changes: 0 additions & 30 deletions packages/rest-typings/src/v1/omnichannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2947,33 +2947,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 = {
Expand Down Expand Up @@ -3937,9 +3910,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[] }>;
};
Expand Down

0 comments on commit 550234d

Please sign in to comment.