@@ -39,6 +39,8 @@ import { getUserFromParams, getUserListFromParams } from '../helpers/getUserFrom
3939import { ExtractRoutesFromAPI } from '../ApiClass' ;
4040import { validateBadRequestErrorResponse } from '@rocket.chat/rest-typings' ;
4141import { validateUnauthorizedErrorResponse } from '@rocket.chat/rest-typings' ;
42+ import { withUserIdProps } from '@rocket.chat/rest-typings/dist/v1/groups/BaseProps' ;
43+
4244
4345async function getRoomFromParams ( params : { roomId ?: string } | { roomName ?: string } ) : Promise < IRoom > {
4446 if (
@@ -897,51 +899,14 @@ API.v1.addRoute(
897899
898900
899901
900- type GroupsBaseProps = { roomId : string ; roomName ?: string } | { roomId ?: string ; roomName : string } ;
901- const withGroupBaseProperties = ( properties : Record < string , any > = { } , required : string [ ] = [ ] ) => ( {
902- oneOf : [
903- {
904- type : 'object' ,
905- properties : {
906- roomId : {
907- type : 'string' ,
908- } ,
909- ...properties ,
910- } ,
911- required : [ 'roomId' ] . concat ( required ) ,
912- additionalProperties : false ,
913- } ,
914- {
915- type : 'object' ,
916- properties : {
917- roomName : {
918- type : 'string' ,
919- } ,
920- ...properties ,
921- } ,
922- required : [ 'roomName' ] . concat ( required ) ,
923- additionalProperties : false ,
924- } ,
925- ] ,
926- } ) ;
927902
928- type WithUserId = GroupsBaseProps & { userId : string } ;
929- const withUserIdSchema = withGroupBaseProperties (
930- {
931- userId : {
932- type : 'string' ,
933- } ,
934- } ,
935- [ 'userId' ] ,
936- ) ;
937- export const GroupsRemoveModeratorProps = ajv . compile < WithUserId > ( withUserIdSchema ) ;
938903
939904
940905const groupsEndpoints = API . v1 . post (
941906 "groups.removeModerator" ,
942907 {
943908 authRequired :true ,
944- body : GroupsRemoveModeratorProps ,
909+ body : withUserIdProps ,
945910 response :{
946911 400 :validateBadRequestErrorResponse ,
947912 401 :validateUnauthorizedErrorResponse ,
0 commit comments