From a7207d4d44d8dda6b7bca2d6bc538ebd57723a66 Mon Sep 17 00:00:00 2001 From: NAME-ASHWANIYADAV <22ashwaniyadav@gmail.com> Date: Sat, 28 Feb 2026 18:58:58 +0000 Subject: [PATCH 1/2] chore: migrate removeInvite/:_id endpoint to chained API pattern with AJV validation --- apps/meteor/app/api/server/v1/invites.ts | 24 ++++++++++++++---------- packages/rest-typings/src/v1/invites.ts | 3 --- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/apps/meteor/app/api/server/v1/invites.ts b/apps/meteor/app/api/server/v1/invites.ts index 637da81892c03..a2eda450be182 100644 --- a/apps/meteor/app/api/server/v1/invites.ts +++ b/apps/meteor/app/api/server/v1/invites.ts @@ -170,19 +170,23 @@ const invites = API.v1 return API.v1.success((await findOrCreateInvite(this.userId, { rid, days, maxUses })) as IInvite); }, - ); - -API.v1.addRoute( - 'removeInvite/:_id', - { authRequired: true }, - { - async delete() { + ) + .delete( + 'removeInvite/:_id', + { + authRequired: true, + response: { + 200: ajv.compile({ + type: 'boolean', + }), + }, + }, + async function () { const { _id } = this.urlParams; return API.v1.success(await removeInvite(this.userId, { _id })); }, - }, -); + ); API.v1.addRoute( 'useInviteToken', @@ -239,5 +243,5 @@ type InvitesEndpoints = ExtractRoutesFromAPI; declare module '@rocket.chat/rest-typings' { // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface - interface Endpoints extends InvitesEndpoints {} + interface Endpoints extends InvitesEndpoints { } } diff --git a/packages/rest-typings/src/v1/invites.ts b/packages/rest-typings/src/v1/invites.ts index c3c18fff48228..d97b767ac8dae 100644 --- a/packages/rest-typings/src/v1/invites.ts +++ b/packages/rest-typings/src/v1/invites.ts @@ -82,9 +82,6 @@ const SendInvitationEmailParamsSchema: JSONSchemaType export const isSendInvitationEmailParams = ajv.compile(SendInvitationEmailParamsSchema); export type InvitesEndpoints = { - '/v1/removeInvite/:_id': { - DELETE: () => boolean; - }; '/v1/useInviteToken': { POST: (params: UseInviteTokenProps) => { room: { From 3da4b4d07d17e343d466a9559cbb0ac22e26dce1 Mon Sep 17 00:00:00 2001 From: NAME-ASHWANIYADAV <22ashwaniyadav@gmail.com> Date: Tue, 10 Mar 2026 11:50:53 +0000 Subject: [PATCH 2/2] fix: resolve eslint warnings in invites.ts --- apps/meteor/app/api/server/v1/invites.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/meteor/app/api/server/v1/invites.ts b/apps/meteor/app/api/server/v1/invites.ts index a2eda450be182..816476eb22b27 100644 --- a/apps/meteor/app/api/server/v1/invites.ts +++ b/apps/meteor/app/api/server/v1/invites.ts @@ -242,6 +242,6 @@ API.v1.addRoute( type InvitesEndpoints = ExtractRoutesFromAPI; declare module '@rocket.chat/rest-typings' { - // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface - interface Endpoints extends InvitesEndpoints { } + // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type, @typescript-eslint/no-empty-interface + interface Endpoints extends InvitesEndpoints {} }