diff options
Diffstat (limited to 'server/controllers/api/users/index.ts')
-rw-r--r-- | server/controllers/api/users/index.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 5939f6125..d339c2a1c 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -1,10 +1,20 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as RateLimit from 'express-rate-limit' | 2 | import * as RateLimit from 'express-rate-limit' |
3 | import { tokensRouter } from '@server/controllers/api/users/token' | ||
4 | import { Hooks } from '@server/lib/plugins/hooks' | ||
5 | import { MUser, MUserAccountDefault } from '@server/types/models' | ||
3 | import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared' | 6 | import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared' |
7 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' | ||
8 | import { UserRegister } from '../../../../shared/models/users/user-register.model' | ||
9 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' | ||
4 | import { logger } from '../../../helpers/logger' | 10 | import { logger } from '../../../helpers/logger' |
5 | import { generateRandomString, getFormattedObjects } from '../../../helpers/utils' | 11 | import { generateRandomString, getFormattedObjects } from '../../../helpers/utils' |
12 | import { CONFIG } from '../../../initializers/config' | ||
6 | import { WEBSERVER } from '../../../initializers/constants' | 13 | import { WEBSERVER } from '../../../initializers/constants' |
14 | import { sequelizeTypescript } from '../../../initializers/database' | ||
7 | import { Emailer } from '../../../lib/emailer' | 15 | import { Emailer } from '../../../lib/emailer' |
16 | import { Notifier } from '../../../lib/notifier' | ||
17 | import { deleteUserToken } from '../../../lib/oauth-model' | ||
8 | import { Redis } from '../../../lib/redis' | 18 | import { Redis } from '../../../lib/redis' |
9 | import { createUserAccountAndChannelAndPlaylist, sendVerifyUserEmail } from '../../../lib/user' | 19 | import { createUserAccountAndChannelAndPlaylist, sendVerifyUserEmail } from '../../../lib/user' |
10 | import { | 20 | import { |
@@ -18,9 +28,9 @@ import { | |||
18 | setDefaultPagination, | 28 | setDefaultPagination, |
19 | setDefaultSort, | 29 | setDefaultSort, |
20 | userAutocompleteValidator, | 30 | userAutocompleteValidator, |
21 | usersListValidator, | ||
22 | usersAddValidator, | 31 | usersAddValidator, |
23 | usersGetValidator, | 32 | usersGetValidator, |
33 | usersListValidator, | ||
24 | usersRegisterValidator, | 34 | usersRegisterValidator, |
25 | usersRemoveValidator, | 35 | usersRemoveValidator, |
26 | usersSortValidator, | 36 | usersSortValidator, |
@@ -35,22 +45,13 @@ import { | |||
35 | usersVerifyEmailValidator | 45 | usersVerifyEmailValidator |
36 | } from '../../../middlewares/validators' | 46 | } from '../../../middlewares/validators' |
37 | import { UserModel } from '../../../models/account/user' | 47 | import { UserModel } from '../../../models/account/user' |
38 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' | ||
39 | import { meRouter } from './me' | 48 | import { meRouter } from './me' |
40 | import { deleteUserToken } from '../../../lib/oauth-model' | 49 | import { myAbusesRouter } from './my-abuses' |
41 | import { myBlocklistRouter } from './my-blocklist' | 50 | import { myBlocklistRouter } from './my-blocklist' |
42 | import { myVideoPlaylistsRouter } from './my-video-playlists' | ||
43 | import { myVideosHistoryRouter } from './my-history' | 51 | import { myVideosHistoryRouter } from './my-history' |
44 | import { myNotificationsRouter } from './my-notifications' | 52 | import { myNotificationsRouter } from './my-notifications' |
45 | import { Notifier } from '../../../lib/notifier' | ||
46 | import { mySubscriptionsRouter } from './my-subscriptions' | 53 | import { mySubscriptionsRouter } from './my-subscriptions' |
47 | import { CONFIG } from '../../../initializers/config' | 54 | import { myVideoPlaylistsRouter } from './my-video-playlists' |
48 | import { sequelizeTypescript } from '../../../initializers/database' | ||
49 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' | ||
50 | import { UserRegister } from '../../../../shared/models/users/user-register.model' | ||
51 | import { MUser, MUserAccountDefault } from '@server/types/models' | ||
52 | import { Hooks } from '@server/lib/plugins/hooks' | ||
53 | import { tokensRouter } from '@server/controllers/api/users/token' | ||
54 | 55 | ||
55 | const auditLogger = auditLoggerFactory('users') | 56 | const auditLogger = auditLoggerFactory('users') |
56 | 57 | ||
@@ -72,6 +73,7 @@ usersRouter.use('/', mySubscriptionsRouter) | |||
72 | usersRouter.use('/', myBlocklistRouter) | 73 | usersRouter.use('/', myBlocklistRouter) |
73 | usersRouter.use('/', myVideosHistoryRouter) | 74 | usersRouter.use('/', myVideosHistoryRouter) |
74 | usersRouter.use('/', myVideoPlaylistsRouter) | 75 | usersRouter.use('/', myVideoPlaylistsRouter) |
76 | usersRouter.use('/', myAbusesRouter) | ||
75 | usersRouter.use('/', meRouter) | 77 | usersRouter.use('/', meRouter) |
76 | 78 | ||
77 | usersRouter.get('/autocomplete', | 79 | usersRouter.get('/autocomplete', |