@flusys/nestjs-auth 1.0.1 → 1.1.0

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  # Authentication Package Guide
2
2
 
3
3
  > **Package:** `@flusys/nestjs-auth`
4
+ > **Version:** 1.1.0
4
5
  > **Type:** Authentication system with JWT, email verification, multi-tenant, and company/branch support
5
6
 
6
7
  ## Table of Contents
@@ -153,6 +154,7 @@ interface AuthModuleOptions {
153
154
  bootstrapAppConfig?: {
154
155
  databaseMode: 'single' | 'multi-tenant';
155
156
  enableCompanyFeature: boolean;
157
+ enableEmailVerification?: boolean; // Default: true
156
158
  };
157
159
  config?: {
158
160
  defaultDatabaseConfig?: IDatabaseConfig;
@@ -169,6 +171,13 @@ interface AuthModuleOptions {
169
171
  }
170
172
  ```
171
173
 
174
+ **Bootstrap Configuration Flags:**
175
+
176
+ | Flag | Type | Default | Effect |
177
+ |------|------|---------|--------|
178
+ | `enableCompanyFeature` | `boolean` | `false` | Enables company/branch entities and APIs |
179
+ | `enableEmailVerification` | `boolean` | `true` | When `false`: excludes `AuthEmailService`, hides email-related APIs (forgot-password, reset-password, verify-email, resend-verification), and excludes `PendingRegistration` entity from migrations |
180
+
172
181
  ## Constants
173
182
 
174
183
  ```typescript
@@ -192,22 +201,53 @@ export const TOKEN_REVOKED_PREFIX = 'auth:revoked';
192
201
 
193
202
  ### Entity Groups
194
203
 
195
- ```typescript
196
- // Core entities (always loaded)
197
- export const CoreEntities = [User, UserToken, PendingRegistration];
204
+ The auth module organizes entities into groups based on feature flags:
198
205
 
199
- // Company entities (when enableCompanyFeature: true)
200
- export const CompanyEntities = [Company, CompanyBranch, UserCompanyPermission];
206
+ ```typescript
207
+ // Internal entity groups (not exported directly)
208
+ // Base entities: User, UserToken
209
+ // Email entities: PendingRegistration
210
+ // Company entities: Company, CompanyBranch, UserCompanyPermission
211
+
212
+ // Exported interface for configuration
213
+ export interface IAuthEntitiesConfig {
214
+ enableCompanyFeature?: boolean;
215
+ enableEmailVerification?: boolean; // Default: true
216
+ }
201
217
 
202
- // All entities
203
- export const AllEntities = [...CoreEntities, ...CompanyEntities];
218
+ // Get entities based on feature flags (exported)
219
+ export function getEntitiesByConfig(config: IAuthEntitiesConfig): any[] {
220
+ const { enableCompanyFeature = false, enableEmailVerification = true } = config;
204
221
 
205
- // Helper function
206
- export function getEntitiesByConfig(enableCompanyFeature: boolean) {
207
- return enableCompanyFeature ? AllEntities : CoreEntities;
222
+ const entities = [User, UserToken];
223
+ if (enableEmailVerification) entities.push(PendingRegistration);
224
+ if (enableCompanyFeature) entities.push(Company, CompanyBranch, UserCompanyPermission);
225
+ return entities;
208
226
  }
209
227
  ```
210
228
 
229
+ **Usage:**
230
+ ```typescript
231
+ import { getEntitiesByConfig } from '@flusys/nestjs-auth/entities';
232
+
233
+ // Get entities for single database without company feature
234
+ const entities = getEntitiesByConfig({ enableCompanyFeature: false });
235
+ // Returns: [User, UserToken, PendingRegistration]
236
+
237
+ // Get entities with company feature, no email verification
238
+ const entities = getEntitiesByConfig({ enableCompanyFeature: true, enableEmailVerification: false });
239
+ // Returns: [User, UserToken, Company, CompanyBranch, UserCompanyPermission]
240
+ ```
241
+
242
+ **Entity Selection by Feature Flags:**
243
+
244
+ | enableEmailVerification | enableCompanyFeature | Entities |
245
+ |------------------------|---------------------|----------|
246
+ | `true` (default) | `false` | User, UserToken, PendingRegistration |
247
+ | `true` | `true` | All entities |
248
+ | `false` | `false` | User, UserToken only |
249
+ | `false` | `true` | User, UserToken, Company, CompanyBranch, UserCompanyPermission |
250
+
211
251
  ### User Entity
212
252
 
213
253
  Extends `UserRoot` from `@flusys/nestjs-shared`:
@@ -813,7 +853,7 @@ export { PendingRegistration } from './entities/pending-registration.entity';
813
853
  export { Company } from './entities/company.entity';
814
854
  export { CompanyBranch } from './entities/company-branch.entity';
815
855
  export { UserCompanyPermission, PermissionType } from './entities/user-company-permission.entity';
816
- export { CoreEntities, CompanyEntities, AllEntities, getEntitiesByConfig } from './entities';
856
+ export { getEntitiesByConfig, IAuthEntitiesConfig } from './entities';
817
857
 
818
858
  // Enums
819
859
  export { PermissionType } from './enums';
@@ -856,7 +896,15 @@ export { authSwaggerConfig } from './docs/auth-swagger.config';
856
896
 
857
897
  ```typescript
858
898
  // Get entities based on feature flags
859
- AuthModule.getEntities(enableCompanyFeature?: boolean): any[]
899
+ // Supports both boolean (legacy) and config object signatures
900
+ AuthModule.getEntities(config?: boolean | IBootstrapAppConfig): any[]
901
+
902
+ // Examples:
903
+ AuthModule.getEntities() // BaseEntities + EmailEntities
904
+ AuthModule.getEntities(true) // All entities (backward compat)
905
+ AuthModule.getEntities(false) // BaseEntities + EmailEntities
906
+ AuthModule.getEntities(bootstrapAppConfig) // Based on config flags
907
+ AuthModule.getEntities({ enableCompanyFeature: true, enableEmailVerification: false })
860
908
 
861
909
  // Configure module
862
910
  AuthModule.forRoot(options: AuthModuleOptions): DynamicModule
@@ -880,4 +928,4 @@ When `enableCompanyFeature: false`, the following are automatically hidden from
880
928
 
881
929
  ---
882
930
 
883
- **Last Updated:** 2026-02-21
931
+ **Last Updated:** 2026-02-22
@@ -21,7 +21,6 @@ const _authenticationdto = require("../dtos/authentication.dto");
21
21
  const _cleartokeninterceptor = require("../interceptors/clear-token.interceptor");
22
22
  const _settokeninterceptor = require("../interceptors/set-token.interceptor");
23
23
  const _authconfigservice = require("../services/auth-config.service");
24
- const _authemailservice = require("../services/auth-email.service");
25
24
  const _authenticationservice = require("../services/authentication.service");
26
25
  function _define_property(obj, key, value) {
27
26
  if (key in obj) {
@@ -55,15 +54,6 @@ let AuthenticationController = class AuthenticationController {
55
54
  const frontendUrl = this.authConfig?.getFrontendUrl();
56
55
  return frontendUrl ? `${frontendUrl}${path}` : `${req.protocol}://${req.get('host')}${path}`;
57
56
  }
58
- get emailService() {
59
- if (!this.authEmailService) {
60
- throw new Error('Email service is not configured');
61
- }
62
- return this.authEmailService;
63
- }
64
- get isEmailEnabled() {
65
- return !!this.authEmailService;
66
- }
67
57
  async login(loginDto) {
68
58
  const result = await this.authService.login(loginDto.email, loginDto.password);
69
59
  if ('requiresEmailVerification' in result) {
@@ -109,56 +99,11 @@ let AuthenticationController = class AuthenticationController {
109
99
  message: 'Password changed successfully'
110
100
  };
111
101
  }
112
- async forgotPassword(req, dto) {
113
- if (!this.isEmailEnabled) {
114
- return {
115
- success: false,
116
- message: 'Email service is not configured'
117
- };
118
- }
119
- return this.emailService.forgotPassword(dto.email, this.buildAuthUrl(req, '/auth/reset-password'));
120
- }
121
- async resetPassword(dto) {
122
- if (!this.isEmailEnabled) {
123
- return {
124
- success: false,
125
- message: 'Email service is not configured'
126
- };
127
- }
128
- return this.emailService.resetPassword(dto.token, dto.newPassword);
129
- }
130
- async resendVerification(req, dto) {
131
- if (!this.isEmailEnabled) {
132
- return {
133
- success: false,
134
- message: 'Email service is not configured'
135
- };
136
- }
137
- return this.emailService.resendVerificationEmail(dto.email, this.buildAuthUrl(req, '/auth/verify-email'));
138
- }
139
- /** Verify email - Verify email using token. Handles both pending registration and existing user verification. */ async verifyEmail(dto) {
140
- if (!this.isEmailEnabled) {
141
- return {
142
- success: false,
143
- message: 'Email service is not configured'
144
- };
145
- }
146
- const result = await this.emailService.verifyEmail(dto.token);
147
- if (result.type === 'pending') {
148
- return this.authService.createUserFromPendingRegistration(result.pending);
149
- }
150
- return {
151
- success: true,
152
- message: result.message
153
- };
154
- }
155
- constructor(authService, authConfig, authEmailService){
102
+ constructor(authService, authConfig){
156
103
  _define_property(this, "authService", void 0);
157
104
  _define_property(this, "authConfig", void 0);
158
- _define_property(this, "authEmailService", void 0);
159
105
  this.authService = authService;
160
106
  this.authConfig = authConfig;
161
- this.authEmailService = authEmailService;
162
107
  }
163
108
  };
164
109
  _ts_decorate([
@@ -437,131 +382,15 @@ _ts_decorate([
437
382
  ]),
438
383
  _ts_metadata("design:returntype", Promise)
439
384
  ], AuthenticationController.prototype, "changePassword", null);
440
- _ts_decorate([
441
- (0, _common.Post)('forgot-password'),
442
- (0, _common.HttpCode)(_common.HttpStatus.OK),
443
- (0, _throttler.Throttle)({
444
- default: {
445
- limit: 3,
446
- ttl: 300000
447
- }
448
- }),
449
- (0, _swagger.ApiOperation)({
450
- summary: 'Request password reset email'
451
- }),
452
- (0, _swagger.ApiBody)({
453
- type: _authenticationdto.ForgotPasswordDto
454
- }),
455
- (0, _swagger.ApiResponse)({
456
- status: 200,
457
- type: _dtos.MessageResponseDto
458
- }),
459
- _ts_param(0, (0, _common.Req)()),
460
- _ts_param(1, (0, _common.Body)()),
461
- _ts_metadata("design:type", Function),
462
- _ts_metadata("design:paramtypes", [
463
- typeof _express.Request === "undefined" ? Object : _express.Request,
464
- typeof _authenticationdto.ForgotPasswordDto === "undefined" ? Object : _authenticationdto.ForgotPasswordDto
465
- ]),
466
- _ts_metadata("design:returntype", Promise)
467
- ], AuthenticationController.prototype, "forgotPassword", null);
468
- _ts_decorate([
469
- (0, _common.Post)('reset-password'),
470
- (0, _common.HttpCode)(_common.HttpStatus.OK),
471
- (0, _throttler.Throttle)({
472
- default: {
473
- limit: 5,
474
- ttl: 900000
475
- }
476
- }),
477
- (0, _swagger.ApiOperation)({
478
- summary: 'Reset password using token'
479
- }),
480
- (0, _swagger.ApiBody)({
481
- type: _authenticationdto.ResetPasswordDto
482
- }),
483
- (0, _swagger.ApiResponse)({
484
- status: 200,
485
- type: _dtos.MessageResponseDto
486
- }),
487
- _ts_param(0, (0, _common.Body)()),
488
- _ts_metadata("design:type", Function),
489
- _ts_metadata("design:paramtypes", [
490
- typeof _authenticationdto.ResetPasswordDto === "undefined" ? Object : _authenticationdto.ResetPasswordDto
491
- ]),
492
- _ts_metadata("design:returntype", Promise)
493
- ], AuthenticationController.prototype, "resetPassword", null);
494
- _ts_decorate([
495
- (0, _common.Post)('resend-verification'),
496
- (0, _common.HttpCode)(_common.HttpStatus.OK),
497
- (0, _throttler.Throttle)({
498
- default: {
499
- limit: 3,
500
- ttl: 300000
501
- }
502
- }),
503
- (0, _swagger.ApiOperation)({
504
- summary: 'Resend email verification link'
505
- }),
506
- (0, _swagger.ApiBody)({
507
- type: _authenticationdto.ResendVerificationDto
508
- }),
509
- (0, _swagger.ApiResponse)({
510
- status: 200,
511
- type: _dtos.MessageResponseDto
512
- }),
513
- _ts_param(0, (0, _common.Req)()),
514
- _ts_param(1, (0, _common.Body)()),
515
- _ts_metadata("design:type", Function),
516
- _ts_metadata("design:paramtypes", [
517
- typeof _express.Request === "undefined" ? Object : _express.Request,
518
- typeof _authenticationdto.ResendVerificationDto === "undefined" ? Object : _authenticationdto.ResendVerificationDto
519
- ]),
520
- _ts_metadata("design:returntype", Promise)
521
- ], AuthenticationController.prototype, "resendVerification", null);
522
- _ts_decorate([
523
- (0, _common.Post)('verify-email'),
524
- (0, _common.HttpCode)(_common.HttpStatus.OK),
525
- (0, _throttler.Throttle)({
526
- default: {
527
- limit: 10,
528
- ttl: 60000
529
- }
530
- }),
531
- (0, _common.UseInterceptors)(_settokeninterceptor.SetToken),
532
- (0, _swagger.ApiOperation)({
533
- summary: 'Verify email using token'
534
- }),
535
- (0, _swagger.ApiBody)({
536
- type: _authenticationdto.VerifyEmailDto
537
- }),
538
- (0, _swagger.ApiResponse)({
539
- status: 200,
540
- type: _dtos.MessageResponseDto
541
- }),
542
- (0, _swagger.ApiResponse)({
543
- status: 200,
544
- type: _authenticationdto.RegistrationResponseDto
545
- }),
546
- _ts_param(0, (0, _common.Body)()),
547
- _ts_metadata("design:type", Function),
548
- _ts_metadata("design:paramtypes", [
549
- typeof _authenticationdto.VerifyEmailDto === "undefined" ? Object : _authenticationdto.VerifyEmailDto
550
- ]),
551
- _ts_metadata("design:returntype", Promise)
552
- ], AuthenticationController.prototype, "verifyEmail", null);
553
385
  AuthenticationController = _ts_decorate([
554
386
  (0, _swagger.ApiTags)('Authentication'),
555
387
  (0, _common.Controller)('auth'),
556
388
  _ts_param(0, (0, _common.Inject)(_authenticationservice.AuthenticationService)),
557
389
  _ts_param(1, (0, _common.Optional)()),
558
390
  _ts_param(1, (0, _common.Inject)(_authconfigservice.AuthConfigService)),
559
- _ts_param(2, (0, _common.Optional)()),
560
- _ts_param(2, (0, _common.Inject)(_authemailservice.AuthEmailService)),
561
391
  _ts_metadata("design:type", Function),
562
392
  _ts_metadata("design:paramtypes", [
563
393
  typeof _authenticationservice.AuthenticationService === "undefined" ? Object : _authenticationservice.AuthenticationService,
564
- typeof _authconfigservice.AuthConfigService === "undefined" ? Object : _authconfigservice.AuthConfigService,
565
- typeof _authemailservice.AuthEmailService === "undefined" ? Object : _authemailservice.AuthEmailService
394
+ typeof _authconfigservice.AuthConfigService === "undefined" ? Object : _authconfigservice.AuthConfigService
566
395
  ])
567
396
  ], AuthenticationController);
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "EmailVerificationController", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return EmailVerificationController;
9
+ }
10
+ });
11
+ const _dtos = require("@flusys/nestjs-shared/dtos");
12
+ const _common = require("@nestjs/common");
13
+ const _swagger = require("@nestjs/swagger");
14
+ const _throttler = require("@nestjs/throttler");
15
+ const _express = require("express");
16
+ const _authenticationdto = require("../dtos/authentication.dto");
17
+ const _settokeninterceptor = require("../interceptors/set-token.interceptor");
18
+ const _authconfigservice = require("../services/auth-config.service");
19
+ const _authdatasourceprovider = require("../services/auth-datasource.provider");
20
+ const _authemailservice = require("../services/auth-email.service");
21
+ const _authenticationservice = require("../services/authentication.service");
22
+ function _define_property(obj, key, value) {
23
+ if (key in obj) {
24
+ Object.defineProperty(obj, key, {
25
+ value: value,
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true
29
+ });
30
+ } else {
31
+ obj[key] = value;
32
+ }
33
+ return obj;
34
+ }
35
+ function _ts_decorate(decorators, target, key, desc) {
36
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38
+ 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;
39
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
40
+ }
41
+ function _ts_metadata(k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ }
44
+ function _ts_param(paramIndex, decorator) {
45
+ return function(target, key) {
46
+ decorator(target, key, paramIndex);
47
+ };
48
+ }
49
+ let EmailVerificationController = class EmailVerificationController {
50
+ ensureEmailVerificationEnabled() {
51
+ if (!this.dataSourceProvider.isEmailVerificationEnabled()) {
52
+ throw new _common.BadRequestException('Email verification is not enabled for this tenant');
53
+ }
54
+ }
55
+ buildAuthUrl(req, path) {
56
+ const frontendUrl = this.authConfig.getFrontendUrl();
57
+ return frontendUrl ? `${frontendUrl}${path}` : `${req.protocol}://${req.get('host')}${path}`;
58
+ }
59
+ async forgotPassword(req, dto) {
60
+ this.ensureEmailVerificationEnabled();
61
+ return this.authEmailService.forgotPassword(dto.email, this.buildAuthUrl(req, '/auth/reset-password'));
62
+ }
63
+ async resetPassword(dto) {
64
+ this.ensureEmailVerificationEnabled();
65
+ return this.authEmailService.resetPassword(dto.token, dto.newPassword);
66
+ }
67
+ async resendVerification(req, dto) {
68
+ this.ensureEmailVerificationEnabled();
69
+ return this.authEmailService.resendVerificationEmail(dto.email, this.buildAuthUrl(req, '/auth/verify-email'));
70
+ }
71
+ async verifyEmail(dto) {
72
+ this.ensureEmailVerificationEnabled();
73
+ const result = await this.authEmailService.verifyEmail(dto.token);
74
+ if (result.type === 'pending') {
75
+ return this.authService.createUserFromPendingRegistration(result.pending);
76
+ }
77
+ return {
78
+ success: true,
79
+ message: result.message
80
+ };
81
+ }
82
+ constructor(authService, authEmailService, authConfig, dataSourceProvider){
83
+ _define_property(this, "authService", void 0);
84
+ _define_property(this, "authEmailService", void 0);
85
+ _define_property(this, "authConfig", void 0);
86
+ _define_property(this, "dataSourceProvider", void 0);
87
+ this.authService = authService;
88
+ this.authEmailService = authEmailService;
89
+ this.authConfig = authConfig;
90
+ this.dataSourceProvider = dataSourceProvider;
91
+ }
92
+ };
93
+ _ts_decorate([
94
+ (0, _common.Post)('forgot-password'),
95
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
96
+ (0, _throttler.Throttle)({
97
+ default: {
98
+ limit: 3,
99
+ ttl: 300000
100
+ }
101
+ }),
102
+ (0, _swagger.ApiOperation)({
103
+ summary: 'Request password reset email'
104
+ }),
105
+ (0, _swagger.ApiBody)({
106
+ type: _authenticationdto.ForgotPasswordDto
107
+ }),
108
+ (0, _swagger.ApiResponse)({
109
+ status: 200,
110
+ type: _dtos.MessageResponseDto
111
+ }),
112
+ _ts_param(0, (0, _common.Req)()),
113
+ _ts_param(1, (0, _common.Body)()),
114
+ _ts_metadata("design:type", Function),
115
+ _ts_metadata("design:paramtypes", [
116
+ typeof _express.Request === "undefined" ? Object : _express.Request,
117
+ typeof _authenticationdto.ForgotPasswordDto === "undefined" ? Object : _authenticationdto.ForgotPasswordDto
118
+ ]),
119
+ _ts_metadata("design:returntype", Promise)
120
+ ], EmailVerificationController.prototype, "forgotPassword", null);
121
+ _ts_decorate([
122
+ (0, _common.Post)('reset-password'),
123
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
124
+ (0, _throttler.Throttle)({
125
+ default: {
126
+ limit: 5,
127
+ ttl: 900000
128
+ }
129
+ }),
130
+ (0, _swagger.ApiOperation)({
131
+ summary: 'Reset password using token'
132
+ }),
133
+ (0, _swagger.ApiBody)({
134
+ type: _authenticationdto.ResetPasswordDto
135
+ }),
136
+ (0, _swagger.ApiResponse)({
137
+ status: 200,
138
+ type: _dtos.MessageResponseDto
139
+ }),
140
+ _ts_param(0, (0, _common.Body)()),
141
+ _ts_metadata("design:type", Function),
142
+ _ts_metadata("design:paramtypes", [
143
+ typeof _authenticationdto.ResetPasswordDto === "undefined" ? Object : _authenticationdto.ResetPasswordDto
144
+ ]),
145
+ _ts_metadata("design:returntype", Promise)
146
+ ], EmailVerificationController.prototype, "resetPassword", null);
147
+ _ts_decorate([
148
+ (0, _common.Post)('resend-verification'),
149
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
150
+ (0, _throttler.Throttle)({
151
+ default: {
152
+ limit: 3,
153
+ ttl: 300000
154
+ }
155
+ }),
156
+ (0, _swagger.ApiOperation)({
157
+ summary: 'Resend email verification link'
158
+ }),
159
+ (0, _swagger.ApiBody)({
160
+ type: _authenticationdto.ResendVerificationDto
161
+ }),
162
+ (0, _swagger.ApiResponse)({
163
+ status: 200,
164
+ type: _dtos.MessageResponseDto
165
+ }),
166
+ _ts_param(0, (0, _common.Req)()),
167
+ _ts_param(1, (0, _common.Body)()),
168
+ _ts_metadata("design:type", Function),
169
+ _ts_metadata("design:paramtypes", [
170
+ typeof _express.Request === "undefined" ? Object : _express.Request,
171
+ typeof _authenticationdto.ResendVerificationDto === "undefined" ? Object : _authenticationdto.ResendVerificationDto
172
+ ]),
173
+ _ts_metadata("design:returntype", Promise)
174
+ ], EmailVerificationController.prototype, "resendVerification", null);
175
+ _ts_decorate([
176
+ (0, _common.Post)('verify-email'),
177
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
178
+ (0, _throttler.Throttle)({
179
+ default: {
180
+ limit: 10,
181
+ ttl: 60000
182
+ }
183
+ }),
184
+ (0, _common.UseInterceptors)(_settokeninterceptor.SetToken),
185
+ (0, _swagger.ApiOperation)({
186
+ summary: 'Verify email using token'
187
+ }),
188
+ (0, _swagger.ApiBody)({
189
+ type: _authenticationdto.VerifyEmailDto
190
+ }),
191
+ (0, _swagger.ApiResponse)({
192
+ status: 200,
193
+ type: _dtos.MessageResponseDto
194
+ }),
195
+ (0, _swagger.ApiResponse)({
196
+ status: 200,
197
+ type: _authenticationdto.RegistrationResponseDto
198
+ }),
199
+ _ts_param(0, (0, _common.Body)()),
200
+ _ts_metadata("design:type", Function),
201
+ _ts_metadata("design:paramtypes", [
202
+ typeof _authenticationdto.VerifyEmailDto === "undefined" ? Object : _authenticationdto.VerifyEmailDto
203
+ ]),
204
+ _ts_metadata("design:returntype", Promise)
205
+ ], EmailVerificationController.prototype, "verifyEmail", null);
206
+ EmailVerificationController = _ts_decorate([
207
+ (0, _swagger.ApiTags)('Authentication'),
208
+ (0, _common.Controller)('auth'),
209
+ _ts_param(0, (0, _common.Inject)(_authenticationservice.AuthenticationService)),
210
+ _ts_param(1, (0, _common.Inject)(_authemailservice.AuthEmailService)),
211
+ _ts_param(2, (0, _common.Inject)(_authconfigservice.AuthConfigService)),
212
+ _ts_param(3, (0, _common.Inject)(_authdatasourceprovider.AuthDataSourceProvider)),
213
+ _ts_metadata("design:type", Function),
214
+ _ts_metadata("design:paramtypes", [
215
+ typeof _authenticationservice.AuthenticationService === "undefined" ? Object : _authenticationservice.AuthenticationService,
216
+ typeof _authemailservice.AuthEmailService === "undefined" ? Object : _authemailservice.AuthEmailService,
217
+ typeof _authconfigservice.AuthConfigService === "undefined" ? Object : _authconfigservice.AuthConfigService,
218
+ typeof _authdatasourceprovider.AuthDataSourceProvider === "undefined" ? Object : _authdatasourceprovider.AuthDataSourceProvider
219
+ ])
220
+ ], EmailVerificationController);
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  _export_star(require("./authentication.controller"), exports);
6
6
  _export_star(require("./company-selection.controller"), exports);
7
+ _export_star(require("./email-verification.controller"), exports);
7
8
  _export_star(require("./user.controller"), exports);
8
9
  _export_star(require("./company.controller"), exports);
9
10
  _export_star(require("./branch.controller"), exports);
@@ -9,15 +9,6 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- get AllEntities () {
13
- return AllEntities;
14
- },
15
- get CompanyEntities () {
16
- return CompanyEntities;
17
- },
18
- get CoreEntities () {
19
- return CoreEntities;
20
- },
21
12
  get PermissionType () {
22
13
  return _usercompanypermissionentity.PermissionType;
23
14
  },
@@ -47,9 +38,11 @@ function _export_star(from, to) {
47
38
  });
48
39
  return from;
49
40
  }
50
- const CoreEntities = [
41
+ const BaseEntities = [
51
42
  _userentity.User,
52
- _usertokenentity.UserToken,
43
+ _usertokenentity.UserToken
44
+ ];
45
+ const EmailEntities = [
53
46
  _pendingregistrationentity.PendingRegistration
54
47
  ];
55
48
  const CompanyEntities = [
@@ -57,10 +50,16 @@ const CompanyEntities = [
57
50
  _companybranchentity.CompanyBranch,
58
51
  _usercompanypermissionentity.UserCompanyPermission
59
52
  ];
60
- const AllEntities = [
61
- ...CoreEntities,
62
- ...CompanyEntities
63
- ];
64
- function getEntitiesByConfig(enableCompanyFeature) {
65
- return enableCompanyFeature ? AllEntities : CoreEntities;
53
+ function getEntitiesByConfig(config) {
54
+ const { enableCompanyFeature = false, enableEmailVerification = true } = config;
55
+ const entities = [
56
+ ...BaseEntities
57
+ ];
58
+ if (enableEmailVerification) {
59
+ entities.push(...EmailEntities);
60
+ }
61
+ if (enableCompanyFeature) {
62
+ entities.push(...CompanyEntities);
63
+ }
64
+ return entities;
66
65
  }