@flusys/nestjs-auth 0.1.0-beta.3 → 1.1.0-beta
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 +1 -11
- package/cjs/config/auth.constants.js +14 -4
- package/cjs/controllers/authentication.controller.js +173 -36
- package/cjs/controllers/branch.controller.js +3 -4
- package/cjs/controllers/company.controller.js +3 -4
- package/cjs/controllers/user-permission.controller.js +6 -18
- package/cjs/controllers/user.controller.js +168 -22
- package/cjs/dtos/authentication.dto.js +106 -3
- package/cjs/entities/index.js +5 -1
- package/cjs/entities/pending-registration.entity.js +125 -0
- package/cjs/entities/user-token.entity.js +129 -0
- 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 -2
- package/cjs/services/auth-config.service.js +22 -44
- package/cjs/services/auth-datasource.provider.js +17 -33
- package/cjs/services/auth-email.service.js +452 -0
- package/cjs/services/authentication.service.js +229 -115
- package/cjs/services/branch.service.js +10 -44
- package/cjs/services/company.service.js +7 -36
- package/cjs/services/index.js +1 -0
- package/cjs/services/user-permission.service.js +9 -27
- package/cjs/services/user.service.js +177 -99
- package/cjs/strategies/jwt.strategy.js +14 -1
- package/config/auth.constants.d.ts +3 -0
- package/controllers/authentication.controller.d.ts +13 -9
- package/controllers/user.controller.d.ts +27 -0
- package/dtos/authentication.dto.d.ts +21 -3
- package/dtos/user.dto.d.ts +1 -0
- package/entities/index.d.ts +7 -3
- package/entities/pending-registration.entity.d.ts +17 -0
- package/entities/user-token.entity.d.ts +15 -0
- package/fesm/config/auth.constants.js +18 -8
- package/fesm/controllers/authentication.controller.js +174 -37
- package/fesm/controllers/branch.controller.js +5 -6
- package/fesm/controllers/company.controller.js +5 -6
- package/fesm/controllers/user-permission.controller.js +6 -18
- package/fesm/controllers/user.controller.js +168 -22
- package/fesm/dtos/authentication.dto.js +109 -100
- package/fesm/entities/index.js +7 -1
- package/fesm/entities/pending-registration.entity.js +115 -0
- package/fesm/entities/user-token.entity.js +113 -0
- 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 +9 -3
- package/fesm/services/auth-config.service.js +22 -44
- package/fesm/services/auth-datasource.provider.js +17 -33
- package/fesm/services/auth-email.service.js +401 -0
- package/fesm/services/authentication.service.js +227 -113
- package/fesm/services/branch.service.js +11 -45
- package/fesm/services/company.service.js +8 -37
- package/fesm/services/index.js +1 -0
- package/fesm/services/user-permission.service.js +9 -27
- package/fesm/services/user.service.js +178 -100
- package/fesm/strategies/jwt.strategy.js +14 -1
- 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 +67 -0
- package/interfaces/user.interface.d.ts +1 -0
- package/package.json +3 -3
- package/services/auth-config.service.d.ts +1 -0
- package/services/auth-email.service.d.ts +50 -0
- package/services/authentication.service.d.ts +21 -5
- package/services/branch.service.d.ts +2 -5
- package/services/company.service.d.ts +1 -4
- package/services/index.d.ts +1 -0
- package/services/user.service.d.ts +17 -6
|
@@ -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,105 @@ 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: 'jwt'
|
|
48
|
+
}) {
|
|
49
|
+
// Custom Endpoints
|
|
50
|
+
/** Get user profile with extras (roles, permissions, etc.) from enricher */ async getProfileWithExtras(id, user) {
|
|
51
|
+
const data = await this.service.getProfileWithExtras(id, user);
|
|
52
|
+
return {
|
|
53
|
+
success: true,
|
|
54
|
+
data
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Verify user email */ async verifyEmail(id) {
|
|
53
58
|
await this.service.verifyEmail(id);
|
|
54
59
|
return {
|
|
55
60
|
message: 'Email verified successfully'
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Verify user phone
|
|
60
|
-
*/ async verifyPhone(id) {
|
|
63
|
+
/** Verify user phone */ async verifyPhone(id) {
|
|
61
64
|
await this.service.verifyPhone(id);
|
|
62
65
|
return {
|
|
63
66
|
message: 'Phone verified successfully'
|
|
64
67
|
};
|
|
65
68
|
}
|
|
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) {
|
|
69
|
+
/** Update user active status. When company feature enabled, updates permission isActive for logged user's company. */ async updateStatus(id, isActive, user) {
|
|
72
70
|
await this.service.updateStatus(id, isActive, user);
|
|
73
71
|
return {
|
|
74
72
|
message: 'Status updated successfully'
|
|
75
73
|
};
|
|
76
74
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Update user profile
|
|
79
|
-
*/ async profile(dto, user) {
|
|
75
|
+
/** Update user profile */ async profile(dto, user) {
|
|
80
76
|
const data = await this.service.profile(dto, user);
|
|
81
77
|
return {
|
|
78
|
+
success: true,
|
|
82
79
|
message: 'Profile updated successfully',
|
|
83
80
|
data
|
|
84
81
|
};
|
|
85
82
|
}
|
|
83
|
+
// ============================================
|
|
84
|
+
// Multi-Step Profile Endpoints (via Enricher)
|
|
85
|
+
// ============================================
|
|
86
|
+
/** Get profile section definitions */ async getProfileSections() {
|
|
87
|
+
const sections = await this.service.getProfileSections();
|
|
88
|
+
return {
|
|
89
|
+
success: true,
|
|
90
|
+
data: sections
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Get specific profile section data */ async getProfileSectionData(id, sectionId, user) {
|
|
94
|
+
const data = await this.service.getProfileSectionData(id, sectionId, user);
|
|
95
|
+
return {
|
|
96
|
+
success: true,
|
|
97
|
+
data
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Update specific profile section */ async updateProfileSection(id, sectionId, data, user) {
|
|
101
|
+
await this.service.updateProfileSection(id, sectionId, data, user);
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
message: 'Section updated successfully'
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Get profile completion percentage */ async getProfileCompletion(id, user) {
|
|
108
|
+
const percentage = await this.service.getProfileCompletion(id, user);
|
|
109
|
+
return {
|
|
110
|
+
success: true,
|
|
111
|
+
data: {
|
|
112
|
+
completionPercentage: percentage
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
86
116
|
constructor(service){
|
|
87
117
|
super(service), _define_property(this, "service", void 0), this.service = service;
|
|
88
118
|
}
|
|
89
119
|
};
|
|
120
|
+
_ts_decorate([
|
|
121
|
+
(0, _common.Post)(':id/profile-extras'),
|
|
122
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
123
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
124
|
+
(0, _swagger.ApiOperation)({
|
|
125
|
+
summary: 'Get user profile with extras',
|
|
126
|
+
description: 'Returns user profile along with extra data (roles, permissions, etc.) if UserEnricher is provided.'
|
|
127
|
+
}),
|
|
128
|
+
(0, _swagger.ApiParam)({
|
|
129
|
+
name: 'id',
|
|
130
|
+
description: 'User ID'
|
|
131
|
+
}),
|
|
132
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
133
|
+
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
134
|
+
_ts_metadata("design:type", Function),
|
|
135
|
+
_ts_metadata("design:paramtypes", [
|
|
136
|
+
String,
|
|
137
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
138
|
+
]),
|
|
139
|
+
_ts_metadata("design:returntype", Promise)
|
|
140
|
+
], UserController.prototype, "getProfileWithExtras", null);
|
|
90
141
|
_ts_decorate([
|
|
91
142
|
(0, _common.Post)(':id/verify-email'),
|
|
143
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
144
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
92
145
|
(0, _swagger.ApiOperation)({
|
|
93
146
|
summary: 'Verify user email'
|
|
94
147
|
}),
|
|
@@ -105,6 +158,8 @@ _ts_decorate([
|
|
|
105
158
|
], UserController.prototype, "verifyEmail", null);
|
|
106
159
|
_ts_decorate([
|
|
107
160
|
(0, _common.Post)(':id/verify-phone'),
|
|
161
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
162
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
108
163
|
(0, _swagger.ApiOperation)({
|
|
109
164
|
summary: 'Verify user phone'
|
|
110
165
|
}),
|
|
@@ -121,6 +176,8 @@ _ts_decorate([
|
|
|
121
176
|
], UserController.prototype, "verifyPhone", null);
|
|
122
177
|
_ts_decorate([
|
|
123
178
|
(0, _common.Put)(':id/status'),
|
|
179
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
180
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
124
181
|
(0, _swagger.ApiOperation)({
|
|
125
182
|
summary: 'Update user active status',
|
|
126
183
|
description: 'Updates user active status. When company feature is enabled, updates the status for the current company context.'
|
|
@@ -149,6 +206,8 @@ _ts_decorate([
|
|
|
149
206
|
], UserController.prototype, "updateStatus", null);
|
|
150
207
|
_ts_decorate([
|
|
151
208
|
(0, _common.Post)('profile'),
|
|
209
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
210
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
152
211
|
(0, _swagger.ApiOperation)({
|
|
153
212
|
summary: 'Update user profile'
|
|
154
213
|
}),
|
|
@@ -164,11 +223,98 @@ _ts_decorate([
|
|
|
164
223
|
]),
|
|
165
224
|
_ts_metadata("design:returntype", Promise)
|
|
166
225
|
], UserController.prototype, "profile", null);
|
|
226
|
+
_ts_decorate([
|
|
227
|
+
(0, _common.Post)('profile-sections'),
|
|
228
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
229
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
230
|
+
(0, _swagger.ApiOperation)({
|
|
231
|
+
summary: 'Get profile section definitions',
|
|
232
|
+
description: 'Returns available profile sections for multi-step profile (if enricher configured).'
|
|
233
|
+
}),
|
|
234
|
+
_ts_metadata("design:type", Function),
|
|
235
|
+
_ts_metadata("design:paramtypes", []),
|
|
236
|
+
_ts_metadata("design:returntype", Promise)
|
|
237
|
+
], UserController.prototype, "getProfileSections", null);
|
|
238
|
+
_ts_decorate([
|
|
239
|
+
(0, _common.Post)(':id/profile-section/:sectionId'),
|
|
240
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
241
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
242
|
+
(0, _swagger.ApiOperation)({
|
|
243
|
+
summary: 'Get profile section data',
|
|
244
|
+
description: 'Returns data for a specific profile section.'
|
|
245
|
+
}),
|
|
246
|
+
(0, _swagger.ApiParam)({
|
|
247
|
+
name: 'id',
|
|
248
|
+
description: 'User ID'
|
|
249
|
+
}),
|
|
250
|
+
(0, _swagger.ApiParam)({
|
|
251
|
+
name: 'sectionId',
|
|
252
|
+
description: 'Section identifier'
|
|
253
|
+
}),
|
|
254
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
255
|
+
_ts_param(1, (0, _common.Param)('sectionId')),
|
|
256
|
+
_ts_param(2, (0, _decorators.CurrentUser)()),
|
|
257
|
+
_ts_metadata("design:type", Function),
|
|
258
|
+
_ts_metadata("design:paramtypes", [
|
|
259
|
+
String,
|
|
260
|
+
String,
|
|
261
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
262
|
+
]),
|
|
263
|
+
_ts_metadata("design:returntype", Promise)
|
|
264
|
+
], UserController.prototype, "getProfileSectionData", null);
|
|
265
|
+
_ts_decorate([
|
|
266
|
+
(0, _common.Post)(':id/profile-section/:sectionId/update'),
|
|
267
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
268
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
269
|
+
(0, _swagger.ApiOperation)({
|
|
270
|
+
summary: 'Update profile section',
|
|
271
|
+
description: 'Updates a specific profile section data.'
|
|
272
|
+
}),
|
|
273
|
+
(0, _swagger.ApiParam)({
|
|
274
|
+
name: 'id',
|
|
275
|
+
description: 'User ID'
|
|
276
|
+
}),
|
|
277
|
+
(0, _swagger.ApiParam)({
|
|
278
|
+
name: 'sectionId',
|
|
279
|
+
description: 'Section identifier'
|
|
280
|
+
}),
|
|
281
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
282
|
+
_ts_param(1, (0, _common.Param)('sectionId')),
|
|
283
|
+
_ts_param(2, (0, _common.Body)()),
|
|
284
|
+
_ts_param(3, (0, _decorators.CurrentUser)()),
|
|
285
|
+
_ts_metadata("design:type", Function),
|
|
286
|
+
_ts_metadata("design:paramtypes", [
|
|
287
|
+
String,
|
|
288
|
+
String,
|
|
289
|
+
typeof Record === "undefined" ? Object : Record,
|
|
290
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
291
|
+
]),
|
|
292
|
+
_ts_metadata("design:returntype", Promise)
|
|
293
|
+
], UserController.prototype, "updateProfileSection", null);
|
|
294
|
+
_ts_decorate([
|
|
295
|
+
(0, _common.Post)(':id/profile-completion'),
|
|
296
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
297
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
298
|
+
(0, _swagger.ApiOperation)({
|
|
299
|
+
summary: 'Get profile completion percentage',
|
|
300
|
+
description: 'Returns overall profile completion percentage.'
|
|
301
|
+
}),
|
|
302
|
+
(0, _swagger.ApiParam)({
|
|
303
|
+
name: 'id',
|
|
304
|
+
description: 'User ID'
|
|
305
|
+
}),
|
|
306
|
+
_ts_param(0, (0, _common.Param)('id')),
|
|
307
|
+
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
308
|
+
_ts_metadata("design:type", Function),
|
|
309
|
+
_ts_metadata("design:paramtypes", [
|
|
310
|
+
String,
|
|
311
|
+
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
312
|
+
]),
|
|
313
|
+
_ts_metadata("design:returntype", Promise)
|
|
314
|
+
], UserController.prototype, "getProfileCompletion", null);
|
|
167
315
|
UserController = _ts_decorate([
|
|
168
316
|
(0, _swagger.ApiTags)('Users'),
|
|
169
|
-
(0, _swagger.ApiBearerAuth)(),
|
|
170
317
|
(0, _common.Controller)('administration/users'),
|
|
171
|
-
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
172
318
|
_ts_param(0, (0, _common.Inject)(_userservice.UserService)),
|
|
173
319
|
_ts_metadata("design:type", Function),
|
|
174
320
|
_ts_metadata("design:paramtypes", [
|
|
@@ -27,12 +27,18 @@ _export(exports, {
|
|
|
27
27
|
get CompanyWithBranchesDto () {
|
|
28
28
|
return CompanyWithBranchesDto;
|
|
29
29
|
},
|
|
30
|
+
get ForgotPasswordDto () {
|
|
31
|
+
return ForgotPasswordDto;
|
|
32
|
+
},
|
|
30
33
|
get LoginDto () {
|
|
31
34
|
return LoginDto;
|
|
32
35
|
},
|
|
33
36
|
get LoginResponseDto () {
|
|
34
37
|
return LoginResponseDto;
|
|
35
38
|
},
|
|
39
|
+
get LoginResponseRequiresEmailVerificationDto () {
|
|
40
|
+
return LoginResponseRequiresEmailVerificationDto;
|
|
41
|
+
},
|
|
36
42
|
get MeResponseDto () {
|
|
37
43
|
return MeResponseDto;
|
|
38
44
|
},
|
|
@@ -45,6 +51,12 @@ _export(exports, {
|
|
|
45
51
|
get RegistrationResponseDto () {
|
|
46
52
|
return RegistrationResponseDto;
|
|
47
53
|
},
|
|
54
|
+
get ResendVerificationDto () {
|
|
55
|
+
return ResendVerificationDto;
|
|
56
|
+
},
|
|
57
|
+
get ResetPasswordDto () {
|
|
58
|
+
return ResetPasswordDto;
|
|
59
|
+
},
|
|
48
60
|
get SelectDto () {
|
|
49
61
|
return SelectDto;
|
|
50
62
|
},
|
|
@@ -53,6 +65,9 @@ _export(exports, {
|
|
|
53
65
|
},
|
|
54
66
|
get UserInfoDto () {
|
|
55
67
|
return UserInfoDto;
|
|
68
|
+
},
|
|
69
|
+
get VerifyEmailDto () {
|
|
70
|
+
return VerifyEmailDto;
|
|
56
71
|
}
|
|
57
72
|
});
|
|
58
73
|
const _swagger = require("@nestjs/swagger");
|
|
@@ -558,16 +573,17 @@ let RegistrationResponseDto = class RegistrationResponseDto {
|
|
|
558
573
|
_define_property(this, "company", void 0);
|
|
559
574
|
_define_property(this, "branch", void 0);
|
|
560
575
|
_define_property(this, "companyFeatureEnabled", void 0);
|
|
576
|
+
_define_property(this, "requiresEmailVerification", void 0);
|
|
561
577
|
}
|
|
562
578
|
};
|
|
563
579
|
_ts_decorate([
|
|
564
|
-
(0, _swagger.
|
|
580
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
565
581
|
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
566
582
|
}),
|
|
567
583
|
_ts_metadata("design:type", String)
|
|
568
584
|
], RegistrationResponseDto.prototype, "accessToken", void 0);
|
|
569
585
|
_ts_decorate([
|
|
570
|
-
(0, _swagger.
|
|
586
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
571
587
|
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
572
588
|
}),
|
|
573
589
|
_ts_metadata("design:type", String)
|
|
@@ -594,12 +610,19 @@ _ts_decorate([
|
|
|
594
610
|
_ts_metadata("design:type", typeof BranchInfoDto === "undefined" ? Object : BranchInfoDto)
|
|
595
611
|
], RegistrationResponseDto.prototype, "branch", void 0);
|
|
596
612
|
_ts_decorate([
|
|
597
|
-
(0, _swagger.
|
|
613
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
598
614
|
example: true,
|
|
599
615
|
description: 'Whether company feature is enabled'
|
|
600
616
|
}),
|
|
601
617
|
_ts_metadata("design:type", Boolean)
|
|
602
618
|
], RegistrationResponseDto.prototype, "companyFeatureEnabled", void 0);
|
|
619
|
+
_ts_decorate([
|
|
620
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
621
|
+
example: true,
|
|
622
|
+
description: 'Whether email verification is required'
|
|
623
|
+
}),
|
|
624
|
+
_ts_metadata("design:type", Boolean)
|
|
625
|
+
], RegistrationResponseDto.prototype, "requiresEmailVerification", void 0);
|
|
603
626
|
let MeResponseDto = class MeResponseDto {
|
|
604
627
|
constructor(){
|
|
605
628
|
_define_property(this, "user", void 0);
|
|
@@ -674,3 +697,83 @@ _ts_decorate([
|
|
|
674
697
|
}),
|
|
675
698
|
_ts_metadata("design:type", Array)
|
|
676
699
|
], CompanySelectionResponseDto.prototype, "companies", void 0);
|
|
700
|
+
let LoginResponseRequiresEmailVerificationDto = class LoginResponseRequiresEmailVerificationDto {
|
|
701
|
+
constructor(){
|
|
702
|
+
_define_property(this, "requiresEmailVerification", void 0);
|
|
703
|
+
_define_property(this, "email", void 0);
|
|
704
|
+
_define_property(this, "message", void 0);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
_ts_decorate([
|
|
708
|
+
(0, _swagger.ApiProperty)({
|
|
709
|
+
example: true
|
|
710
|
+
}),
|
|
711
|
+
_ts_metadata("design:type", Boolean)
|
|
712
|
+
], LoginResponseRequiresEmailVerificationDto.prototype, "requiresEmailVerification", void 0);
|
|
713
|
+
_ts_decorate([
|
|
714
|
+
(0, _swagger.ApiProperty)({
|
|
715
|
+
example: 'john@example.com'
|
|
716
|
+
}),
|
|
717
|
+
_ts_metadata("design:type", String)
|
|
718
|
+
], LoginResponseRequiresEmailVerificationDto.prototype, "email", void 0);
|
|
719
|
+
_ts_decorate([
|
|
720
|
+
(0, _swagger.ApiProperty)({
|
|
721
|
+
example: 'Please verify your email address before logging in.'
|
|
722
|
+
}),
|
|
723
|
+
_ts_metadata("design:type", String)
|
|
724
|
+
], LoginResponseRequiresEmailVerificationDto.prototype, "message", void 0);
|
|
725
|
+
let ForgotPasswordDto = class ForgotPasswordDto {
|
|
726
|
+
constructor(){
|
|
727
|
+
_define_property(this, "email", void 0);
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
_ts_decorate([
|
|
731
|
+
(0, _swagger.ApiProperty)({
|
|
732
|
+
example: 'john@example.com',
|
|
733
|
+
description: 'Email address to send reset link to'
|
|
734
|
+
}),
|
|
735
|
+
(0, _classvalidator.IsEmail)(),
|
|
736
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
737
|
+
_ts_metadata("design:type", String)
|
|
738
|
+
], ForgotPasswordDto.prototype, "email", void 0);
|
|
739
|
+
let ResetPasswordDto = class ResetPasswordDto {
|
|
740
|
+
constructor(){
|
|
741
|
+
_define_property(this, "token", void 0);
|
|
742
|
+
_define_property(this, "newPassword", void 0);
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
_ts_decorate([
|
|
746
|
+
(0, _swagger.ApiProperty)({
|
|
747
|
+
example: 'a1b2c3d4e5f6...',
|
|
748
|
+
description: 'Password reset token from email'
|
|
749
|
+
}),
|
|
750
|
+
(0, _classvalidator.IsString)(),
|
|
751
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
752
|
+
_ts_metadata("design:type", String)
|
|
753
|
+
], ResetPasswordDto.prototype, "token", void 0);
|
|
754
|
+
_ts_decorate([
|
|
755
|
+
(0, _swagger.ApiProperty)({
|
|
756
|
+
example: 'newSecurePassword123',
|
|
757
|
+
description: 'New password (min 6 chars)'
|
|
758
|
+
}),
|
|
759
|
+
(0, _classvalidator.IsString)(),
|
|
760
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
761
|
+
(0, _classvalidator.MinLength)(6),
|
|
762
|
+
_ts_metadata("design:type", String)
|
|
763
|
+
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
764
|
+
let VerifyEmailDto = class VerifyEmailDto {
|
|
765
|
+
constructor(){
|
|
766
|
+
_define_property(this, "token", void 0);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
_ts_decorate([
|
|
770
|
+
(0, _swagger.ApiProperty)({
|
|
771
|
+
example: 'a1b2c3d4e5f6...',
|
|
772
|
+
description: 'Email verification token from email'
|
|
773
|
+
}),
|
|
774
|
+
(0, _classvalidator.IsString)(),
|
|
775
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
776
|
+
_ts_metadata("design:type", String)
|
|
777
|
+
], VerifyEmailDto.prototype, "token", void 0);
|
|
778
|
+
let ResendVerificationDto = class ResendVerificationDto extends ForgotPasswordDto {
|
|
779
|
+
};
|
package/cjs/entities/index.js
CHANGED
|
@@ -30,8 +30,10 @@ _export(exports, {
|
|
|
30
30
|
});
|
|
31
31
|
const _companybranchentity = _export_star(require("./company-branch.entity"), exports);
|
|
32
32
|
const _companyentity = _export_star(require("./company.entity"), exports);
|
|
33
|
+
const _pendingregistrationentity = _export_star(require("./pending-registration.entity"), exports);
|
|
33
34
|
const _usercompanypermissionentity = require("./user-company-permission.entity");
|
|
34
35
|
const _userentity = _export_star(require("./user.entity"), exports);
|
|
36
|
+
const _usertokenentity = _export_star(require("./user-token.entity"), exports);
|
|
35
37
|
function _export_star(from, to) {
|
|
36
38
|
Object.keys(from).forEach(function(k) {
|
|
37
39
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -46,7 +48,9 @@ function _export_star(from, to) {
|
|
|
46
48
|
return from;
|
|
47
49
|
}
|
|
48
50
|
const CoreEntities = [
|
|
49
|
-
_userentity.User
|
|
51
|
+
_userentity.User,
|
|
52
|
+
_usertokenentity.UserToken,
|
|
53
|
+
_pendingregistrationentity.PendingRegistration
|
|
50
54
|
];
|
|
51
55
|
const CompanyEntities = [
|
|
52
56
|
_companyentity.Company,
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "PendingRegistration", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return PendingRegistration;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _typeorm = require("typeorm");
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
26
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
27
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
28
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
29
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30
|
+
}
|
|
31
|
+
function _ts_metadata(k, v) {
|
|
32
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
|
+
}
|
|
34
|
+
let PendingRegistration = class PendingRegistration {
|
|
35
|
+
constructor(){
|
|
36
|
+
_define_property(this, "id", void 0);
|
|
37
|
+
_define_property(this, "email", void 0);
|
|
38
|
+
_define_property(this, "name", void 0);
|
|
39
|
+
_define_property(this, "phone", void 0);
|
|
40
|
+
_define_property(this, "passwordHash", void 0);
|
|
41
|
+
_define_property(this, "token", void 0);
|
|
42
|
+
_define_property(this, "expiresAt", void 0);
|
|
43
|
+
_define_property(this, "companyData", void 0);
|
|
44
|
+
_define_property(this, "createdAt", void 0);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
_ts_decorate([
|
|
48
|
+
(0, _typeorm.PrimaryGeneratedColumn)('uuid'),
|
|
49
|
+
_ts_metadata("design:type", String)
|
|
50
|
+
], PendingRegistration.prototype, "id", void 0);
|
|
51
|
+
_ts_decorate([
|
|
52
|
+
(0, _typeorm.Column)({
|
|
53
|
+
type: 'varchar',
|
|
54
|
+
length: 255
|
|
55
|
+
}),
|
|
56
|
+
_ts_metadata("design:type", String)
|
|
57
|
+
], PendingRegistration.prototype, "email", void 0);
|
|
58
|
+
_ts_decorate([
|
|
59
|
+
(0, _typeorm.Column)({
|
|
60
|
+
type: 'varchar',
|
|
61
|
+
length: 255,
|
|
62
|
+
nullable: true
|
|
63
|
+
}),
|
|
64
|
+
_ts_metadata("design:type", Object)
|
|
65
|
+
], PendingRegistration.prototype, "name", void 0);
|
|
66
|
+
_ts_decorate([
|
|
67
|
+
(0, _typeorm.Column)({
|
|
68
|
+
type: 'varchar',
|
|
69
|
+
length: 255,
|
|
70
|
+
nullable: true
|
|
71
|
+
}),
|
|
72
|
+
_ts_metadata("design:type", Object)
|
|
73
|
+
], PendingRegistration.prototype, "phone", void 0);
|
|
74
|
+
_ts_decorate([
|
|
75
|
+
(0, _typeorm.Column)({
|
|
76
|
+
type: 'text',
|
|
77
|
+
name: 'passwordHash'
|
|
78
|
+
}),
|
|
79
|
+
_ts_metadata("design:type", String)
|
|
80
|
+
], PendingRegistration.prototype, "passwordHash", void 0);
|
|
81
|
+
_ts_decorate([
|
|
82
|
+
(0, _typeorm.Column)({
|
|
83
|
+
type: 'varchar',
|
|
84
|
+
length: 64
|
|
85
|
+
}),
|
|
86
|
+
_ts_metadata("design:type", String)
|
|
87
|
+
], PendingRegistration.prototype, "token", void 0);
|
|
88
|
+
_ts_decorate([
|
|
89
|
+
(0, _typeorm.Column)({
|
|
90
|
+
type: 'timestamp',
|
|
91
|
+
name: 'expires_at'
|
|
92
|
+
}),
|
|
93
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
94
|
+
], PendingRegistration.prototype, "expiresAt", void 0);
|
|
95
|
+
_ts_decorate([
|
|
96
|
+
(0, _typeorm.Column)({
|
|
97
|
+
type: 'json',
|
|
98
|
+
nullable: true,
|
|
99
|
+
name: 'company_data'
|
|
100
|
+
}),
|
|
101
|
+
_ts_metadata("design:type", Object)
|
|
102
|
+
], PendingRegistration.prototype, "companyData", void 0);
|
|
103
|
+
_ts_decorate([
|
|
104
|
+
(0, _typeorm.CreateDateColumn)({
|
|
105
|
+
type: 'timestamp',
|
|
106
|
+
name: 'created_at'
|
|
107
|
+
}),
|
|
108
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
109
|
+
], PendingRegistration.prototype, "createdAt", void 0);
|
|
110
|
+
PendingRegistration = _ts_decorate([
|
|
111
|
+
(0, _typeorm.Entity)('pending_registrations'),
|
|
112
|
+
(0, _typeorm.Index)('IDX_pending_reg_email', [
|
|
113
|
+
'email'
|
|
114
|
+
], {
|
|
115
|
+
unique: true
|
|
116
|
+
}),
|
|
117
|
+
(0, _typeorm.Index)('IDX_pending_reg_token', [
|
|
118
|
+
'token'
|
|
119
|
+
], {
|
|
120
|
+
unique: true
|
|
121
|
+
}),
|
|
122
|
+
(0, _typeorm.Index)('IDX_pending_reg_expires', [
|
|
123
|
+
'expiresAt'
|
|
124
|
+
])
|
|
125
|
+
], PendingRegistration);
|