@flusys/nestjs-auth 0.1.0-beta.3 → 1.0.0-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +274 -301
- package/cjs/config/auth.constants.js +22 -4
- package/cjs/controllers/authentication.controller.js +222 -38
- package/cjs/controllers/branch.controller.js +46 -4
- package/cjs/controllers/company-selection.controller.js +27 -20
- package/cjs/controllers/company.controller.js +46 -4
- package/cjs/controllers/user-permission.controller.js +40 -37
- package/cjs/controllers/user.controller.js +222 -23
- package/cjs/dtos/authentication.dto.js +119 -13
- package/cjs/dtos/user-permission.dto.js +28 -0
- package/cjs/dtos/user.dto.js +19 -4
- package/cjs/entities/index.js +5 -1
- package/cjs/entities/pending-registration.entity.js +125 -0
- package/cjs/entities/user-company-permission.entity.js +0 -6
- package/cjs/entities/user-token.entity.js +129 -0
- package/cjs/guards/auth-throttler.guard.js +53 -0
- package/cjs/interceptors/clear-token.interceptor.js +3 -6
- package/cjs/interceptors/set-token.interceptor.js +38 -31
- package/cjs/interfaces/auth-email-provider.interface.js +45 -0
- package/cjs/interfaces/authentication.interface.js +0 -3
- package/cjs/interfaces/index.js +2 -0
- package/cjs/interfaces/user-enricher.interface.js +4 -0
- package/cjs/modules/auth.module.js +8 -20
- package/cjs/services/auth-config.service.js +42 -47
- package/cjs/services/auth-datasource.provider.js +18 -34
- package/cjs/services/auth-email.service.js +471 -0
- package/cjs/services/authentication.service.js +240 -153
- package/cjs/services/branch.service.js +15 -48
- package/cjs/services/company-selection-session.service.js +1 -1
- package/cjs/services/company.service.js +7 -36
- package/cjs/services/index.js +1 -0
- package/cjs/services/user-permission.service.js +9 -29
- package/cjs/services/user.service.js +228 -107
- package/cjs/strategies/jwt.strategy.js +14 -1
- package/cjs/validators/password.validator.js +45 -0
- package/config/auth.constants.d.ts +5 -0
- package/controllers/authentication.controller.d.ts +13 -9
- package/controllers/company-selection.controller.d.ts +6 -2
- package/controllers/user.controller.d.ts +33 -0
- package/dtos/authentication.dto.d.ts +21 -3
- package/dtos/company-branch.dto.d.ts +0 -1
- package/dtos/company.dto.d.ts +0 -1
- package/dtos/user-permission.dto.d.ts +4 -0
- package/dtos/user.dto.d.ts +1 -2
- package/entities/index.d.ts +7 -3
- package/entities/pending-registration.entity.d.ts +17 -0
- package/entities/user-company-permission.entity.d.ts +0 -2
- package/entities/user-token.entity.d.ts +15 -0
- package/fesm/config/auth.constants.js +11 -8
- package/fesm/controllers/authentication.controller.js +224 -40
- package/fesm/controllers/branch.controller.js +49 -7
- package/fesm/controllers/company-selection.controller.js +28 -21
- package/fesm/controllers/company.controller.js +49 -7
- package/fesm/controllers/user-permission.controller.js +41 -38
- package/fesm/controllers/user.controller.js +225 -26
- package/fesm/dtos/authentication.dto.js +123 -111
- package/fesm/dtos/user-permission.dto.js +28 -0
- package/fesm/dtos/user.dto.js +20 -5
- package/fesm/entities/index.js +7 -1
- package/fesm/entities/pending-registration.entity.js +115 -0
- package/fesm/entities/user-company-permission.entity.js +0 -6
- package/fesm/entities/user-token.entity.js +113 -0
- package/fesm/guards/auth-throttler.guard.js +43 -0
- package/fesm/interceptors/clear-token.interceptor.js +2 -5
- package/fesm/interceptors/set-token.interceptor.js +37 -30
- package/fesm/interfaces/auth-email-provider.interface.js +38 -0
- package/fesm/interfaces/authentication.interface.js +1 -7
- package/fesm/interfaces/index.js +2 -0
- package/fesm/interfaces/user-enricher.interface.js +26 -0
- package/fesm/modules/auth.module.js +10 -22
- package/fesm/services/auth-config.service.js +42 -47
- package/fesm/services/auth-datasource.provider.js +19 -35
- package/fesm/services/auth-email.service.js +420 -0
- package/fesm/services/authentication.service.js +238 -151
- package/fesm/services/branch.service.js +16 -49
- package/fesm/services/company-selection-session.service.js +1 -1
- package/fesm/services/company.service.js +8 -37
- package/fesm/services/index.js +1 -0
- package/fesm/services/user-permission.service.js +10 -30
- package/fesm/services/user.service.js +229 -108
- package/fesm/strategies/jwt.strategy.js +14 -1
- package/fesm/validators/password.validator.js +48 -0
- package/guards/auth-throttler.guard.d.ts +7 -0
- package/interceptors/set-token.interceptor.d.ts +1 -0
- package/interfaces/auth-email-provider.interface.d.ts +6 -0
- package/interfaces/auth-module-options.interface.d.ts +4 -1
- package/interfaces/authentication.interface.d.ts +14 -0
- package/interfaces/index.d.ts +2 -0
- package/interfaces/user-enricher.interface.d.ts +64 -0
- package/interfaces/user.interface.d.ts +1 -0
- package/modules/auth.module.d.ts +0 -1
- package/package.json +4 -4
- package/services/auth-config.service.d.ts +5 -1
- package/services/auth-email.service.d.ts +51 -0
- package/services/authentication.service.d.ts +21 -12
- package/services/branch.service.d.ts +2 -5
- package/services/company-selection-session.service.d.ts +1 -1
- package/services/company.service.d.ts +1 -4
- package/services/index.d.ts +1 -0
- package/services/user-permission.service.d.ts +0 -1
- package/services/user.service.d.ts +20 -6
- package/validators/password.validator.d.ts +10 -0
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "UserPermissionController", {
|
|
|
10
10
|
});
|
|
11
11
|
const _common = require("@nestjs/common");
|
|
12
12
|
const _swagger = require("@nestjs/swagger");
|
|
13
|
-
const
|
|
13
|
+
const _nestjsshared = require("@flusys/nestjs-shared");
|
|
14
14
|
const _userpermissiondto = require("../dtos/user-permission.dto");
|
|
15
15
|
const _userpermissionservice = require("../services/user-permission.service");
|
|
16
16
|
function _define_property(obj, key, value) {
|
|
@@ -41,12 +41,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
let UserPermissionController = class UserPermissionController {
|
|
44
|
-
|
|
45
|
-
// USER-COMPANY PERMISSIONS
|
|
46
|
-
// ========================================================================
|
|
47
|
-
/**
|
|
48
|
-
* Batch assign/revoke user-company permissions
|
|
49
|
-
*/ async assignUserCompany(dto) {
|
|
44
|
+
async assignUserCompany(dto) {
|
|
50
45
|
let addedCount = 0;
|
|
51
46
|
let removedCount = 0;
|
|
52
47
|
for (const item of dto.items){
|
|
@@ -66,11 +61,8 @@ let UserPermissionController = class UserPermissionController {
|
|
|
66
61
|
message: `Processed ${addedCount} additions and ${removedCount} removals`
|
|
67
62
|
};
|
|
68
63
|
}
|
|
69
|
-
|
|
70
|
-
* Get user's companies
|
|
71
|
-
*/ async getUserCompanies(userId) {
|
|
64
|
+
async getUserCompanies(userId) {
|
|
72
65
|
const permissions = await this.userPermissionService.findUserCompanies(userId);
|
|
73
|
-
// Map to DTO format with populated company details
|
|
74
66
|
const data = permissions.map((permission)=>({
|
|
75
67
|
id: permission.id,
|
|
76
68
|
userId: permission.userId,
|
|
@@ -79,15 +71,12 @@ let UserPermissionController = class UserPermissionController {
|
|
|
79
71
|
companySlug: permission.company?.slug || ''
|
|
80
72
|
}));
|
|
81
73
|
return {
|
|
74
|
+
success: true,
|
|
75
|
+
message: 'User companies retrieved successfully',
|
|
82
76
|
data
|
|
83
77
|
};
|
|
84
78
|
}
|
|
85
|
-
|
|
86
|
-
// USER-BRANCH PERMISSIONS
|
|
87
|
-
// ========================================================================
|
|
88
|
-
/**
|
|
89
|
-
* Batch assign/revoke user-branch permissions
|
|
90
|
-
*/ async assignUserBranch(dto) {
|
|
79
|
+
async assignUserBranch(dto) {
|
|
91
80
|
let addedCount = 0;
|
|
92
81
|
let removedCount = 0;
|
|
93
82
|
for (const item of dto.items){
|
|
@@ -107,11 +96,8 @@ let UserPermissionController = class UserPermissionController {
|
|
|
107
96
|
message: `Processed ${addedCount} additions and ${removedCount} removals`
|
|
108
97
|
};
|
|
109
98
|
}
|
|
110
|
-
|
|
111
|
-
* Get user's branches
|
|
112
|
-
*/ async getUserBranches(userId) {
|
|
99
|
+
async getUserBranches(userId) {
|
|
113
100
|
const permissions = await this.userPermissionService.findUserBranches(userId);
|
|
114
|
-
// Map to DTO format with populated branch details
|
|
115
101
|
const data = permissions.map((permission)=>({
|
|
116
102
|
id: permission.id,
|
|
117
103
|
userId: permission.userId,
|
|
@@ -121,10 +107,11 @@ let UserPermissionController = class UserPermissionController {
|
|
|
121
107
|
companyId: permission.branch?.companyId || ''
|
|
122
108
|
}));
|
|
123
109
|
return {
|
|
110
|
+
success: true,
|
|
111
|
+
message: 'User branches retrieved successfully',
|
|
124
112
|
data
|
|
125
113
|
};
|
|
126
114
|
}
|
|
127
|
-
// NOTE: @Inject() required for bundled code - type metadata may be lost during esbuild
|
|
128
115
|
constructor(userPermissionService){
|
|
129
116
|
_define_property(this, "userPermissionService", void 0);
|
|
130
117
|
this.userPermissionService = userPermissionService;
|
|
@@ -132,6 +119,7 @@ let UserPermissionController = class UserPermissionController {
|
|
|
132
119
|
};
|
|
133
120
|
_ts_decorate([
|
|
134
121
|
(0, _common.Post)('user-company/assign'),
|
|
122
|
+
(0, _nestjsshared.RequirePermission)(_nestjsshared.USER_PERMISSIONS.UPDATE),
|
|
135
123
|
(0, _swagger.ApiOperation)({
|
|
136
124
|
summary: 'Batch assign/revoke user-company permissions',
|
|
137
125
|
description: `
|
|
@@ -186,22 +174,29 @@ Batch operation to assign or revoke user permissions to companies.
|
|
|
186
174
|
_ts_metadata("design:returntype", Promise)
|
|
187
175
|
], UserPermissionController.prototype, "assignUserCompany", null);
|
|
188
176
|
_ts_decorate([
|
|
189
|
-
(0, _common.
|
|
177
|
+
(0, _common.Post)('get-user-company'),
|
|
178
|
+
(0, _nestjsshared.RequirePermission)(_nestjsshared.USER_PERMISSIONS.READ),
|
|
190
179
|
(0, _swagger.ApiOperation)({
|
|
191
180
|
summary: 'Get user companies',
|
|
192
181
|
description: 'Returns all companies the user has access to.'
|
|
193
182
|
}),
|
|
194
|
-
(0, _swagger.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
183
|
+
(0, _swagger.ApiBody)({
|
|
184
|
+
schema: {
|
|
185
|
+
properties: {
|
|
186
|
+
userId: {
|
|
187
|
+
type: 'string'
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
required: [
|
|
191
|
+
'userId'
|
|
192
|
+
]
|
|
193
|
+
}
|
|
199
194
|
}),
|
|
200
195
|
(0, _swagger.ApiResponse)({
|
|
201
196
|
status: 200,
|
|
202
197
|
type: _userpermissiondto.UserCompaniesResponseDto
|
|
203
198
|
}),
|
|
204
|
-
_ts_param(0, (0, _common.
|
|
199
|
+
_ts_param(0, (0, _common.Body)('userId')),
|
|
205
200
|
_ts_metadata("design:type", Function),
|
|
206
201
|
_ts_metadata("design:paramtypes", [
|
|
207
202
|
String
|
|
@@ -210,6 +205,7 @@ _ts_decorate([
|
|
|
210
205
|
], UserPermissionController.prototype, "getUserCompanies", null);
|
|
211
206
|
_ts_decorate([
|
|
212
207
|
(0, _common.Post)('user-branch/assign'),
|
|
208
|
+
(0, _nestjsshared.RequirePermission)(_nestjsshared.USER_PERMISSIONS.UPDATE),
|
|
213
209
|
(0, _swagger.ApiOperation)({
|
|
214
210
|
summary: 'Batch assign/revoke user-branch permissions',
|
|
215
211
|
description: `
|
|
@@ -264,22 +260,29 @@ Batch operation to assign or revoke user permissions to branches.
|
|
|
264
260
|
_ts_metadata("design:returntype", Promise)
|
|
265
261
|
], UserPermissionController.prototype, "assignUserBranch", null);
|
|
266
262
|
_ts_decorate([
|
|
267
|
-
(0, _common.
|
|
263
|
+
(0, _common.Post)('get-user-branch'),
|
|
264
|
+
(0, _nestjsshared.RequirePermission)(_nestjsshared.USER_PERMISSIONS.READ),
|
|
268
265
|
(0, _swagger.ApiOperation)({
|
|
269
266
|
summary: 'Get user branches',
|
|
270
267
|
description: 'Returns all branches the user has access to.'
|
|
271
268
|
}),
|
|
272
|
-
(0, _swagger.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
269
|
+
(0, _swagger.ApiBody)({
|
|
270
|
+
schema: {
|
|
271
|
+
properties: {
|
|
272
|
+
userId: {
|
|
273
|
+
type: 'string'
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
required: [
|
|
277
|
+
'userId'
|
|
278
|
+
]
|
|
279
|
+
}
|
|
277
280
|
}),
|
|
278
281
|
(0, _swagger.ApiResponse)({
|
|
279
282
|
status: 200,
|
|
280
283
|
type: _userpermissiondto.UserBranchesResponseDto
|
|
281
284
|
}),
|
|
282
|
-
_ts_param(0, (0, _common.
|
|
285
|
+
_ts_param(0, (0, _common.Body)('userId')),
|
|
283
286
|
_ts_metadata("design:type", Function),
|
|
284
287
|
_ts_metadata("design:paramtypes", [
|
|
285
288
|
String
|
|
@@ -290,7 +293,7 @@ UserPermissionController = _ts_decorate([
|
|
|
290
293
|
(0, _swagger.ApiTags)('User Permissions'),
|
|
291
294
|
(0, _swagger.ApiBearerAuth)(),
|
|
292
295
|
(0, _common.Controller)('administration/permissions'),
|
|
293
|
-
(0, _common.UseGuards)(
|
|
296
|
+
(0, _common.UseGuards)(_nestjsshared.JwtAuthGuard),
|
|
294
297
|
_ts_param(0, (0, _common.Inject)(_userpermissionservice.UserPermissionService)),
|
|
295
298
|
_ts_metadata("design:type", Function),
|
|
296
299
|
_ts_metadata("design:paramtypes", [
|
|
@@ -10,11 +10,11 @@ Object.defineProperty(exports, "UserController", {
|
|
|
10
10
|
});
|
|
11
11
|
const _classes = require("@flusys/nestjs-shared/classes");
|
|
12
12
|
const _decorators = require("@flusys/nestjs-shared/decorators");
|
|
13
|
+
const _guards = require("@flusys/nestjs-shared/guards");
|
|
13
14
|
const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
14
15
|
const _common = require("@nestjs/common");
|
|
15
16
|
const _swagger = require("@nestjs/swagger");
|
|
16
17
|
const _userdto = require("../dtos/user.dto");
|
|
17
|
-
const _guards = require("@flusys/nestjs-shared/guards");
|
|
18
18
|
const _userservice = require("../services/user.service");
|
|
19
19
|
function _define_property(obj, key, value) {
|
|
20
20
|
if (key in obj) {
|
|
@@ -43,52 +43,152 @@ function _ts_param(paramIndex, decorator) {
|
|
|
43
43
|
decorator(target, key, paramIndex);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
let UserController = class UserController extends (0, _classes.createApiController)(_userdto.CreateUserDto, _userdto.UpdateUserDto, _userdto.UserResponseDto
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
let UserController = class UserController extends (0, _classes.createApiController)(_userdto.CreateUserDto, _userdto.UpdateUserDto, _userdto.UserResponseDto, {
|
|
47
|
+
security: {
|
|
48
|
+
insert: {
|
|
49
|
+
level: 'permission',
|
|
50
|
+
permissions: [
|
|
51
|
+
_classes.USER_PERMISSIONS.CREATE
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
insertMany: {
|
|
55
|
+
level: 'permission',
|
|
56
|
+
permissions: [
|
|
57
|
+
_classes.USER_PERMISSIONS.CREATE
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
getById: {
|
|
61
|
+
level: 'permission',
|
|
62
|
+
permissions: [
|
|
63
|
+
_classes.USER_PERMISSIONS.READ
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
getAll: {
|
|
67
|
+
level: 'permission',
|
|
68
|
+
permissions: [
|
|
69
|
+
_classes.USER_PERMISSIONS.READ
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
update: {
|
|
73
|
+
level: 'permission',
|
|
74
|
+
permissions: [
|
|
75
|
+
_classes.USER_PERMISSIONS.UPDATE
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
updateMany: {
|
|
79
|
+
level: 'permission',
|
|
80
|
+
permissions: [
|
|
81
|
+
_classes.USER_PERMISSIONS.UPDATE
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
delete: {
|
|
85
|
+
level: 'permission',
|
|
86
|
+
permissions: [
|
|
87
|
+
_classes.USER_PERMISSIONS.DELETE
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}) {
|
|
92
|
+
async getProfileWithExtras(id, user) {
|
|
93
|
+
const data = await this.service.getProfileWithExtras(id, user);
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
data
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async verifyEmail(id) {
|
|
53
100
|
await this.service.verifyEmail(id);
|
|
54
101
|
return {
|
|
102
|
+
success: true,
|
|
55
103
|
message: 'Email verified successfully'
|
|
56
104
|
};
|
|
57
105
|
}
|
|
58
|
-
|
|
59
|
-
* Verify user phone
|
|
60
|
-
*/ async verifyPhone(id) {
|
|
106
|
+
async verifyPhone(id) {
|
|
61
107
|
await this.service.verifyPhone(id);
|
|
62
108
|
return {
|
|
109
|
+
success: true,
|
|
63
110
|
message: 'Phone verified successfully'
|
|
64
111
|
};
|
|
65
112
|
}
|
|
66
|
-
|
|
67
|
-
* Update user active status
|
|
68
|
-
*
|
|
69
|
-
* When company feature is disabled: Updates User.isActive directly
|
|
70
|
-
* When company feature is enabled: Updates UserCompanyPermission.isActive for logged user's company
|
|
71
|
-
*/ async updateStatus(id, isActive, user) {
|
|
113
|
+
async updateStatus(id, isActive, user) {
|
|
72
114
|
await this.service.updateStatus(id, isActive, user);
|
|
73
115
|
return {
|
|
116
|
+
success: true,
|
|
74
117
|
message: 'Status updated successfully'
|
|
75
118
|
};
|
|
76
119
|
}
|
|
77
|
-
|
|
78
|
-
* Update user profile
|
|
79
|
-
*/ async profile(dto, user) {
|
|
120
|
+
async profile(dto, user) {
|
|
80
121
|
const data = await this.service.profile(dto, user);
|
|
81
122
|
return {
|
|
123
|
+
success: true,
|
|
82
124
|
message: 'Profile updated successfully',
|
|
83
125
|
data
|
|
84
126
|
};
|
|
85
127
|
}
|
|
128
|
+
async getProfileSections() {
|
|
129
|
+
const sections = await this.service.getProfileSections();
|
|
130
|
+
return {
|
|
131
|
+
success: true,
|
|
132
|
+
message: 'Profile sections retrieved successfully',
|
|
133
|
+
data: sections
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
async getProfileSectionData(id, sectionId, user) {
|
|
137
|
+
const data = await this.service.getProfileSectionData(id, sectionId, user);
|
|
138
|
+
return {
|
|
139
|
+
success: true,
|
|
140
|
+
message: 'Profile section data retrieved successfully',
|
|
141
|
+
data
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
async updateProfileSection(id, sectionId, data, user) {
|
|
145
|
+
await this.service.updateProfileSection(id, sectionId, data, user);
|
|
146
|
+
return {
|
|
147
|
+
success: true,
|
|
148
|
+
message: 'Section updated successfully'
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async getProfileCompletion(id, user) {
|
|
152
|
+
const percentage = await this.service.getProfileCompletion(id, user);
|
|
153
|
+
return {
|
|
154
|
+
success: true,
|
|
155
|
+
message: 'Profile completion retrieved successfully',
|
|
156
|
+
data: {
|
|
157
|
+
completionPercentage: percentage
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
86
161
|
constructor(service){
|
|
87
162
|
super(service), _define_property(this, "service", void 0), this.service = service;
|
|
88
163
|
}
|
|
89
164
|
};
|
|
165
|
+
_ts_decorate([
|
|
166
|
+
(0, _common.Post)(':id/profile-extras'),
|
|
167
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
168
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
169
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.READ),
|
|
170
|
+
(0, _swagger.ApiOperation)({
|
|
171
|
+
summary: 'Get user profile with extras',
|
|
172
|
+
description: 'Returns user profile along with extra data (roles, permissions, etc.) if UserEnricher is provided.'
|
|
173
|
+
}),
|
|
174
|
+
(0, _swagger.ApiParam)({
|
|
175
|
+
name: 'id',
|
|
176
|
+
description: 'User ID'
|
|
177
|
+
}),
|
|
178
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
179
|
+
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
180
|
+
_ts_metadata("design:type", Function),
|
|
181
|
+
_ts_metadata("design:paramtypes", [
|
|
182
|
+
String,
|
|
183
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
184
|
+
]),
|
|
185
|
+
_ts_metadata("design:returntype", Promise)
|
|
186
|
+
], UserController.prototype, "getProfileWithExtras", null);
|
|
90
187
|
_ts_decorate([
|
|
91
188
|
(0, _common.Post)(':id/verify-email'),
|
|
189
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
190
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
191
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.UPDATE),
|
|
92
192
|
(0, _swagger.ApiOperation)({
|
|
93
193
|
summary: 'Verify user email'
|
|
94
194
|
}),
|
|
@@ -105,6 +205,9 @@ _ts_decorate([
|
|
|
105
205
|
], UserController.prototype, "verifyEmail", null);
|
|
106
206
|
_ts_decorate([
|
|
107
207
|
(0, _common.Post)(':id/verify-phone'),
|
|
208
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
209
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
210
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.UPDATE),
|
|
108
211
|
(0, _swagger.ApiOperation)({
|
|
109
212
|
summary: 'Verify user phone'
|
|
110
213
|
}),
|
|
@@ -120,7 +223,10 @@ _ts_decorate([
|
|
|
120
223
|
_ts_metadata("design:returntype", Promise)
|
|
121
224
|
], UserController.prototype, "verifyPhone", null);
|
|
122
225
|
_ts_decorate([
|
|
123
|
-
(0, _common.
|
|
226
|
+
(0, _common.Post)(':id/status'),
|
|
227
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
228
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
229
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.UPDATE),
|
|
124
230
|
(0, _swagger.ApiOperation)({
|
|
125
231
|
summary: 'Update user active status',
|
|
126
232
|
description: 'Updates user active status. When company feature is enabled, updates the status for the current company context.'
|
|
@@ -149,6 +255,8 @@ _ts_decorate([
|
|
|
149
255
|
], UserController.prototype, "updateStatus", null);
|
|
150
256
|
_ts_decorate([
|
|
151
257
|
(0, _common.Post)('profile'),
|
|
258
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
259
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
152
260
|
(0, _swagger.ApiOperation)({
|
|
153
261
|
summary: 'Update user profile'
|
|
154
262
|
}),
|
|
@@ -164,11 +272,102 @@ _ts_decorate([
|
|
|
164
272
|
]),
|
|
165
273
|
_ts_metadata("design:returntype", Promise)
|
|
166
274
|
], UserController.prototype, "profile", null);
|
|
275
|
+
_ts_decorate([
|
|
276
|
+
(0, _common.Post)('profile-sections'),
|
|
277
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
278
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
279
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.READ),
|
|
280
|
+
(0, _swagger.ApiOperation)({
|
|
281
|
+
summary: 'Get profile section definitions',
|
|
282
|
+
description: 'Returns available profile sections for multi-step profile (if enricher configured).'
|
|
283
|
+
}),
|
|
284
|
+
_ts_metadata("design:type", Function),
|
|
285
|
+
_ts_metadata("design:paramtypes", []),
|
|
286
|
+
_ts_metadata("design:returntype", Promise)
|
|
287
|
+
], UserController.prototype, "getProfileSections", null);
|
|
288
|
+
_ts_decorate([
|
|
289
|
+
(0, _common.Post)(':id/profile-section/:sectionId'),
|
|
290
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
291
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
292
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.READ),
|
|
293
|
+
(0, _swagger.ApiOperation)({
|
|
294
|
+
summary: 'Get profile section data',
|
|
295
|
+
description: 'Returns data for a specific profile section.'
|
|
296
|
+
}),
|
|
297
|
+
(0, _swagger.ApiParam)({
|
|
298
|
+
name: 'id',
|
|
299
|
+
description: 'User ID'
|
|
300
|
+
}),
|
|
301
|
+
(0, _swagger.ApiParam)({
|
|
302
|
+
name: 'sectionId',
|
|
303
|
+
description: 'Section identifier'
|
|
304
|
+
}),
|
|
305
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
306
|
+
_ts_param(1, (0, _common.Param)('sectionId')),
|
|
307
|
+
_ts_param(2, (0, _decorators.CurrentUser)()),
|
|
308
|
+
_ts_metadata("design:type", Function),
|
|
309
|
+
_ts_metadata("design:paramtypes", [
|
|
310
|
+
String,
|
|
311
|
+
String,
|
|
312
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
313
|
+
]),
|
|
314
|
+
_ts_metadata("design:returntype", Promise)
|
|
315
|
+
], UserController.prototype, "getProfileSectionData", null);
|
|
316
|
+
_ts_decorate([
|
|
317
|
+
(0, _common.Post)(':id/profile-section/:sectionId/update'),
|
|
318
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
319
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
320
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.UPDATE),
|
|
321
|
+
(0, _swagger.ApiOperation)({
|
|
322
|
+
summary: 'Update profile section',
|
|
323
|
+
description: 'Updates a specific profile section data.'
|
|
324
|
+
}),
|
|
325
|
+
(0, _swagger.ApiParam)({
|
|
326
|
+
name: 'id',
|
|
327
|
+
description: 'User ID'
|
|
328
|
+
}),
|
|
329
|
+
(0, _swagger.ApiParam)({
|
|
330
|
+
name: 'sectionId',
|
|
331
|
+
description: 'Section identifier'
|
|
332
|
+
}),
|
|
333
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
334
|
+
_ts_param(1, (0, _common.Param)('sectionId')),
|
|
335
|
+
_ts_param(2, (0, _common.Body)()),
|
|
336
|
+
_ts_param(3, (0, _decorators.CurrentUser)()),
|
|
337
|
+
_ts_metadata("design:type", Function),
|
|
338
|
+
_ts_metadata("design:paramtypes", [
|
|
339
|
+
String,
|
|
340
|
+
String,
|
|
341
|
+
typeof Record === "undefined" ? Object : Record,
|
|
342
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
343
|
+
]),
|
|
344
|
+
_ts_metadata("design:returntype", Promise)
|
|
345
|
+
], UserController.prototype, "updateProfileSection", null);
|
|
346
|
+
_ts_decorate([
|
|
347
|
+
(0, _common.Post)(':id/profile-completion'),
|
|
348
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
349
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
350
|
+
(0, _decorators.RequirePermission)(_classes.USER_PERMISSIONS.READ),
|
|
351
|
+
(0, _swagger.ApiOperation)({
|
|
352
|
+
summary: 'Get profile completion percentage',
|
|
353
|
+
description: 'Returns overall profile completion percentage.'
|
|
354
|
+
}),
|
|
355
|
+
(0, _swagger.ApiParam)({
|
|
356
|
+
name: 'id',
|
|
357
|
+
description: 'User ID'
|
|
358
|
+
}),
|
|
359
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
360
|
+
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
361
|
+
_ts_metadata("design:type", Function),
|
|
362
|
+
_ts_metadata("design:paramtypes", [
|
|
363
|
+
String,
|
|
364
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
365
|
+
]),
|
|
366
|
+
_ts_metadata("design:returntype", Promise)
|
|
367
|
+
], UserController.prototype, "getProfileCompletion", null);
|
|
167
368
|
UserController = _ts_decorate([
|
|
168
369
|
(0, _swagger.ApiTags)('Users'),
|
|
169
|
-
(0, _swagger.ApiBearerAuth)(),
|
|
170
370
|
(0, _common.Controller)('administration/users'),
|
|
171
|
-
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
172
371
|
_ts_param(0, (0, _common.Inject)(_userservice.UserService)),
|
|
173
372
|
_ts_metadata("design:type", Function),
|
|
174
373
|
_ts_metadata("design:paramtypes", [
|