From c6824e7fcfa4006b2e8d3c95af6857cca2d5114f Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Fri, 4 Mar 2022 10:18:07 -0300 Subject: [PATCH] Chore: Migrate REST API - merge v1/user in v1/users (#3827) --- app/definitions/rest/v1/index.ts | 2 -- app/definitions/rest/v1/user.ts | 23 ----------------------- app/definitions/rest/v1/users.ts | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 app/definitions/rest/v1/user.ts diff --git a/app/definitions/rest/v1/index.ts b/app/definitions/rest/v1/index.ts index e292cb99b..61f19572e 100644 --- a/app/definitions/rest/v1/index.ts +++ b/app/definitions/rest/v1/index.ts @@ -11,7 +11,6 @@ import { PermissionsEndpoints } from './permissions'; import { RolesEndpoints } from './roles'; import { RoomsEndpoints } from './rooms'; import { OauthCustomConfiguration } from './settings'; -import { UserEndpoints } from './user'; import { UsersEndpoints } from './users'; import { TeamsEndpoints } from './teams'; import { E2eEndpoints } from './e2e'; @@ -30,7 +29,6 @@ export type Endpoints = ChannelsEndpoints & RolesEndpoints & RoomsEndpoints & OauthCustomConfiguration & - UserEndpoints & UsersEndpoints & TeamsEndpoints & E2eEndpoints & diff --git a/app/definitions/rest/v1/user.ts b/app/definitions/rest/v1/user.ts deleted file mode 100644 index 737ed9a58..000000000 --- a/app/definitions/rest/v1/user.ts +++ /dev/null @@ -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 }) => { - user: IUserPreferences; - success: boolean; - }; - }; - 'users.register': { - POST: (params: { name: string; email: string; username: string; pass: string }) => { user: IUserRegistered }; - }; -}; diff --git a/app/definitions/rest/v1/users.ts b/app/definitions/rest/v1/users.ts index 337a2182f..7bed1d145 100644 --- a/app/definitions/rest/v1/users.ts +++ b/app/definitions/rest/v1/users.ts @@ -1,5 +1,6 @@ import type { ITeam } from '../../ITeam'; import type { IUser } from '../../IUser'; +import { INotificationPreferences, IUserPreferences, IUserRegistered } from '../../IUser'; export type UsersEndpoints = { 'users.2fa.sendEmailCode': { @@ -11,4 +12,23 @@ export type UsersEndpoints = { 'users.listTeams': { GET: (params: { userId: IUser['_id'] }) => { teams: Array }; }; + '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 }) => { + user: IUserPreferences; + success: boolean; + }; + }; + 'users.register': { + POST: (params: { name: string; email: string; username: string; pass: string }) => { user: IUserRegistered }; + }; };