Chore: Server API types - teams.updateRoom (#3774)

* chore: type the API call `teams.updateRoom`

* chore: creating the interface `IServerTeamUpdateRoom`

* chore: minor tweak after merge
This commit is contained in:
Alex Junior 2022-03-02 23:22:59 -03:00 committed by GitHub
parent 7de686b0e8
commit 214cf52cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 5 deletions

View File

@ -1,5 +1,6 @@
import { IRocketChatRecord } from './IRocketChatRecord'; import { IRocketChatRecord } from './IRocketChatRecord';
import { IUser } from './IUser'; import { IUser } from './IUser';
import { IServerRoomItem } from './IRoom';
export enum TEAM_TYPE { export enum TEAM_TYPE {
PUBLIC = 0, PUBLIC = 0,
@ -46,3 +47,16 @@ export interface ITeamStats {
totalTeams: number; totalTeams: number;
teamStats: Array<ITeamStatData>; teamStats: Array<ITeamStatData>;
} }
export interface IServerTeamUpdateRoom
extends Omit<
IServerRoomItem,
'topic' | 'joinCodeRequired' | 'description' | 'jitsiTimeout' | 'usersCount' | 'e2eKeyId' | 'avatarETag'
> {
broadcast: boolean;
msgs: number;
default: boolean;
sysMes: boolean;
teamId: string;
teamDefault: boolean;
}

View File

@ -1,10 +1,13 @@
import { IRoom } from '../../IRoom'; import { IRoom } from '../../IRoom';
import { ITeam, TEAM_TYPE } from '../../ITeam'; import { IServerTeamUpdateRoom, ITeam, TEAM_TYPE } from '../../ITeam';
export type TeamsEndpoints = { export type TeamsEndpoints = {
'teams.removeRoom': { 'teams.removeRoom': {
POST: (params: { roomId: string; teamId: string }) => { room: IRoom }; POST: (params: { roomId: string; teamId: string }) => { room: IRoom };
}; };
'teams.updateRoom': {
POST: (params: { roomId: string; isDefault: boolean }) => { room: IServerTeamUpdateRoom };
};
'teams.convertToChannel': { 'teams.convertToChannel': {
POST: (params: { teamId: string; roomsToRemove?: string[] }) => {}; POST: (params: { teamId: string; roomsToRemove?: string[] }) => {};
}; };

View File

@ -13,7 +13,7 @@ import { E2E_PRIVATE_KEY, E2E_PUBLIC_KEY, E2E_RANDOM_PASSWORD_KEY } from '../enc
import UserPreferences from '../userPreferences'; import UserPreferences from '../userPreferences';
import { ICertificate, IRocketChat } from '../../definitions'; import { ICertificate, IRocketChat } from '../../definitions';
async function removeServerKeys({ server, userId }: { server: string; userId: string | null }) { async function removeServerKeys({ server, userId }: { server: string; userId?: string | null }) {
await UserPreferences.removeItem(`${RocketChat.TOKEN_KEY}-${server}`); await UserPreferences.removeItem(`${RocketChat.TOKEN_KEY}-${server}`);
if (userId) { if (userId) {
await UserPreferences.removeItem(`${RocketChat.TOKEN_KEY}-${userId}`); await UserPreferences.removeItem(`${RocketChat.TOKEN_KEY}-${userId}`);

View File

@ -191,10 +191,8 @@ export const removeTeamMember = ({ teamId, userId, rooms }: { teamId: string; us
...(rooms?.length && { rooms }) ...(rooms?.length && { rooms })
}); });
export const updateTeamRoom = ({ roomId, isDefault }: { roomId: string; isDefault: boolean }): any => export const updateTeamRoom = ({ roomId, isDefault }: { roomId: string; isDefault: boolean }) =>
// RC 3.13.0 // RC 3.13.0
// TODO: missing definitions from server
// @ts-ignore
sdk.post('teams.updateRoom', { roomId, isDefault }); sdk.post('teams.updateRoom', { roomId, isDefault });
export const deleteTeam = ({ teamId, roomsToRemove }: { teamId: string; roomsToRemove: string[] }): any => export const deleteTeam = ({ teamId, roomsToRemove }: { teamId: string; roomsToRemove: string[] }): any =>