Chore: Migrate REST API - merge v1/user in v1/users (#3827)

This commit is contained in:
Alex Junior 2022-03-04 10:18:07 -03:00 committed by GitHub
parent 4c490576fa
commit c6824e7fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 25 deletions

View File

@ -11,7 +11,6 @@ import { PermissionsEndpoints } from './permissions';
import { RolesEndpoints } from './roles'; import { RolesEndpoints } from './roles';
import { RoomsEndpoints } from './rooms'; import { RoomsEndpoints } from './rooms';
import { OauthCustomConfiguration } from './settings'; import { OauthCustomConfiguration } from './settings';
import { UserEndpoints } from './user';
import { UsersEndpoints } from './users'; import { UsersEndpoints } from './users';
import { TeamsEndpoints } from './teams'; import { TeamsEndpoints } from './teams';
import { E2eEndpoints } from './e2e'; import { E2eEndpoints } from './e2e';
@ -30,7 +29,6 @@ export type Endpoints = ChannelsEndpoints &
RolesEndpoints & RolesEndpoints &
RoomsEndpoints & RoomsEndpoints &
OauthCustomConfiguration & OauthCustomConfiguration &
UserEndpoints &
UsersEndpoints & UsersEndpoints &
TeamsEndpoints & TeamsEndpoints &
E2eEndpoints & E2eEndpoints &

View File

@ -1,23 +0,0 @@
import { INotificationPreferences, IUser, IUserPreferences, IUserRegistered } from '../../IUser';
export type UserEndpoints = {
'users.info': {
GET: (params: { userId: IUser['_id'] }) => {
user: IUser;
success: boolean;
};
POST: (params: { userId: IUser['_id'] }) => {
user: IUser;
success: boolean;
};
};
'users.setPreferences': {
POST: (params: { userId: IUser['_id']; data: Partial<INotificationPreferences> }) => {
user: IUserPreferences;
success: boolean;
};
};
'users.register': {
POST: (params: { name: string; email: string; username: string; pass: string }) => { user: IUserRegistered };
};
};

View File

@ -1,5 +1,6 @@
import type { ITeam } from '../../ITeam'; import type { ITeam } from '../../ITeam';
import type { IUser } from '../../IUser'; import type { IUser } from '../../IUser';
import { INotificationPreferences, IUserPreferences, IUserRegistered } from '../../IUser';
export type UsersEndpoints = { export type UsersEndpoints = {
'users.2fa.sendEmailCode': { 'users.2fa.sendEmailCode': {
@ -11,4 +12,23 @@ export type UsersEndpoints = {
'users.listTeams': { 'users.listTeams': {
GET: (params: { userId: IUser['_id'] }) => { teams: Array<ITeam> }; GET: (params: { userId: IUser['_id'] }) => { teams: Array<ITeam> };
}; };
'users.info': {
GET: (params: { userId: IUser['_id'] }) => {
user: IUser;
success: boolean;
};
POST: (params: { userId: IUser['_id'] }) => {
user: IUser;
success: boolean;
};
};
'users.setPreferences': {
POST: (params: { userId: IUser['_id']; data: Partial<INotificationPreferences> }) => {
user: IUserPreferences;
success: boolean;
};
};
'users.register': {
POST: (params: { name: string; email: string; username: string; pass: string }) => { user: IUserRegistered };
};
}; };