@flusys/nestjs-auth 4.1.1 → 5.0.1
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 +151 -719
- package/cjs/config/message-keys.js +6 -61
- package/cjs/controllers/authentication.controller.js +113 -87
- package/cjs/controllers/company-selection.controller.js +24 -4
- package/cjs/controllers/email-verification.controller.js +12 -13
- package/cjs/docs/auth-swagger.config.js +143 -106
- package/cjs/dtos/authentication.dto.js +0 -15
- package/cjs/entities/company-branch.entity.js +1 -1
- package/cjs/entities/company.entity.js +2 -2
- package/cjs/entities/pending-registration.entity.js +3 -2
- package/cjs/entities/user-company-permission.entity.js +0 -8
- package/cjs/entities/user-token.entity.js +0 -9
- package/cjs/interceptors/set-token.interceptor.js +15 -7
- package/cjs/services/auth-config.service.js +0 -4
- package/cjs/services/auth-email.service.js +8 -31
- package/cjs/services/authentication.service.js +99 -15
- package/cjs/services/user-permission.service.js +6 -8
- package/cjs/services/user.service.js +16 -13
- package/cjs/strategies/jwt.strategy.js +10 -3
- package/config/message-keys.d.ts +5 -153
- package/controllers/authentication.controller.d.ts +6 -7
- package/controllers/company-selection.controller.d.ts +3 -2
- package/controllers/email-verification.controller.d.ts +6 -2
- package/dtos/authentication.dto.d.ts +0 -2
- package/entities/user-company-permission.entity.d.ts +0 -1
- package/entities/user-token.entity.d.ts +0 -1
- package/fesm/config/message-keys.js +6 -53
- package/fesm/controllers/authentication.controller.js +115 -90
- package/fesm/controllers/company-selection.controller.js +25 -5
- package/fesm/controllers/email-verification.controller.js +13 -14
- package/fesm/docs/auth-swagger.config.js +146 -113
- package/fesm/dtos/authentication.dto.js +0 -15
- package/fesm/entities/company-branch.entity.js +2 -2
- package/fesm/entities/company.entity.js +3 -3
- package/fesm/entities/pending-registration.entity.js +3 -2
- package/fesm/entities/user-company-permission.entity.js +0 -8
- package/fesm/entities/user-token.entity.js +0 -9
- package/fesm/interceptors/set-token.interceptor.js +15 -7
- package/fesm/services/auth-config.service.js +0 -4
- package/fesm/services/auth-email.service.js +8 -32
- package/fesm/services/authentication.service.js +100 -17
- package/fesm/services/user-permission.service.js +6 -8
- package/fesm/services/user.service.js +16 -14
- package/fesm/strategies/jwt.strategy.js +10 -3
- package/interfaces/auth-module-options.interface.d.ts +0 -1
- package/package.json +4 -4
- package/services/auth-config.service.d.ts +0 -1
- package/services/auth-email.service.d.ts +0 -4
- package/services/authentication.service.d.ts +1 -1
- package/services/user-permission.service.d.ts +1 -1
- package/services/user.service.d.ts +5 -5
|
@@ -8,17 +8,16 @@ Object.defineProperty(exports, "AuthenticationService", {
|
|
|
8
8
|
return AuthenticationService;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _nestjsshared = require("@flusys/nestjs-shared");
|
|
11
12
|
const _classes = require("@flusys/nestjs-shared/classes");
|
|
12
13
|
const _constants = require("@flusys/nestjs-shared/constants");
|
|
13
|
-
const _nestjsshared = require("@flusys/nestjs-shared");
|
|
14
|
-
const _config = require("../config");
|
|
15
|
-
const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
16
14
|
const _enums = require("@flusys/nestjs-shared/enums");
|
|
15
|
+
const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
17
16
|
const _utils = require("@flusys/nestjs-shared/utils");
|
|
18
17
|
const _common = require("@nestjs/common");
|
|
19
18
|
const _jwt = require("@nestjs/jwt");
|
|
20
19
|
const _bcrypt = /*#__PURE__*/ _interop_require_wildcard(require("bcrypt"));
|
|
21
|
-
const
|
|
20
|
+
const _config = require("../config");
|
|
22
21
|
const _authenticationdto = require("../dtos/authentication.dto");
|
|
23
22
|
const _companybranchentity = require("../entities/company-branch.entity");
|
|
24
23
|
const _companyentity = require("../entities/company.entity");
|
|
@@ -26,6 +25,7 @@ const _pendingregistrationentity = require("../entities/pending-registration.ent
|
|
|
26
25
|
const _usercompanypermissionentity = require("../entities/user-company-permission.entity");
|
|
27
26
|
const _userentity = require("../entities/user.entity");
|
|
28
27
|
const _enums1 = require("../enums");
|
|
28
|
+
const _userenricherinterface = require("../interfaces/user-enricher.interface");
|
|
29
29
|
const _authconfigservice = require("./auth-config.service");
|
|
30
30
|
const _authdatasourceprovider = require("./auth-datasource.provider");
|
|
31
31
|
const _authemailservice = require("./auth-email.service");
|
|
@@ -111,7 +111,10 @@ let AuthenticationService = class AuthenticationService {
|
|
|
111
111
|
if (!this.dataSourceProvider) {
|
|
112
112
|
throw new _common.InternalServerErrorException({
|
|
113
113
|
message: 'User repository not available',
|
|
114
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE
|
|
114
|
+
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
115
|
+
messageVariables: {
|
|
116
|
+
entity: 'User'
|
|
117
|
+
}
|
|
115
118
|
});
|
|
116
119
|
}
|
|
117
120
|
return this.dataSourceProvider.getRepository(_userentity.User);
|
|
@@ -139,7 +142,7 @@ let AuthenticationService = class AuthenticationService {
|
|
|
139
142
|
}
|
|
140
143
|
const user = await this.validateUser(email, password);
|
|
141
144
|
if (!user.isActive) {
|
|
142
|
-
throw new _common.
|
|
145
|
+
throw new _common.ForbiddenException({
|
|
143
146
|
message: 'User account is deactivated',
|
|
144
147
|
messageKey: _config.AUTH_MESSAGES.LOGIN_ACCOUNT_DEACTIVATED
|
|
145
148
|
});
|
|
@@ -252,7 +255,10 @@ let AuthenticationService = class AuthenticationService {
|
|
|
252
255
|
if (!permissionRepository || !companyRepository) {
|
|
253
256
|
throw new _common.BadRequestException({
|
|
254
257
|
message: 'Company feature repositories not available',
|
|
255
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE
|
|
258
|
+
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
259
|
+
messageVariables: {
|
|
260
|
+
entity: 'Company feature'
|
|
261
|
+
}
|
|
256
262
|
});
|
|
257
263
|
}
|
|
258
264
|
if (dto.companySlug) {
|
|
@@ -385,7 +391,10 @@ let AuthenticationService = class AuthenticationService {
|
|
|
385
391
|
if (!companyRepository || !branchRepository || !permissionRepository) {
|
|
386
392
|
if (throwOnUnavailable) throw new _common.BadRequestException({
|
|
387
393
|
message: 'Company feature repositories not available',
|
|
388
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE
|
|
394
|
+
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
395
|
+
messageVariables: {
|
|
396
|
+
entity: 'Company feature'
|
|
397
|
+
}
|
|
389
398
|
});
|
|
390
399
|
return this.generateRegistrationResponse(user);
|
|
391
400
|
}
|
|
@@ -520,7 +529,10 @@ let AuthenticationService = class AuthenticationService {
|
|
|
520
529
|
if (!permissionRepository || !companyRepository || !branchRepository) {
|
|
521
530
|
throw new _common.BadRequestException({
|
|
522
531
|
message: 'Repositories not available',
|
|
523
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE
|
|
532
|
+
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
533
|
+
messageVariables: {
|
|
534
|
+
entity: 'Some'
|
|
535
|
+
}
|
|
524
536
|
});
|
|
525
537
|
}
|
|
526
538
|
const hasCompanyAccess = await permissionRepository.findOne({
|
|
@@ -531,7 +543,7 @@ let AuthenticationService = class AuthenticationService {
|
|
|
531
543
|
}
|
|
532
544
|
});
|
|
533
545
|
if (!hasCompanyAccess) {
|
|
534
|
-
throw new _common.
|
|
546
|
+
throw new _common.ForbiddenException({
|
|
535
547
|
message: 'No access to this company',
|
|
536
548
|
messageKey: _config.AUTH_MESSAGES.COMPANY_NO_ACCESS
|
|
537
549
|
});
|
|
@@ -543,7 +555,7 @@ let AuthenticationService = class AuthenticationService {
|
|
|
543
555
|
}
|
|
544
556
|
});
|
|
545
557
|
if (!company) {
|
|
546
|
-
throw new _common.
|
|
558
|
+
throw new _common.NotFoundException({
|
|
547
559
|
message: 'Company not found or inactive',
|
|
548
560
|
messageKey: _config.AUTH_MESSAGES.COMPANY_NOT_FOUND
|
|
549
561
|
});
|
|
@@ -556,7 +568,7 @@ let AuthenticationService = class AuthenticationService {
|
|
|
556
568
|
}
|
|
557
569
|
});
|
|
558
570
|
if (!hasBranchAccess) {
|
|
559
|
-
throw new _common.
|
|
571
|
+
throw new _common.ForbiddenException({
|
|
560
572
|
message: 'No access to this branch',
|
|
561
573
|
messageKey: _config.AUTH_MESSAGES.BRANCH_NO_ACCESS
|
|
562
574
|
});
|
|
@@ -569,7 +581,7 @@ let AuthenticationService = class AuthenticationService {
|
|
|
569
581
|
}
|
|
570
582
|
});
|
|
571
583
|
if (!branch) {
|
|
572
|
-
throw new _common.
|
|
584
|
+
throw new _common.NotFoundException({
|
|
573
585
|
message: 'Branch not found or inactive',
|
|
574
586
|
messageKey: _config.AUTH_MESSAGES.BRANCH_NOT_FOUND
|
|
575
587
|
});
|
|
@@ -599,6 +611,72 @@ let AuthenticationService = class AuthenticationService {
|
|
|
599
611
|
messageKey: _config.AUTH_MESSAGES.TOKEN_INVALID
|
|
600
612
|
});
|
|
601
613
|
}
|
|
614
|
+
if (payload.companyId) {
|
|
615
|
+
const companyRepository = await this.getCompanyRepository();
|
|
616
|
+
const permissionRepository = await this.getPermissionRepository();
|
|
617
|
+
if (companyRepository) {
|
|
618
|
+
const company = await companyRepository.findOne({
|
|
619
|
+
where: {
|
|
620
|
+
id: payload.companyId,
|
|
621
|
+
isActive: true
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
if (!company) {
|
|
625
|
+
throw new _common.UnauthorizedException({
|
|
626
|
+
message: 'Company not found or inactive',
|
|
627
|
+
messageKey: _config.AUTH_MESSAGES.COMPANY_NOT_FOUND
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
if (permissionRepository) {
|
|
632
|
+
const hasCompanyAccess = await permissionRepository.findOne({
|
|
633
|
+
where: {
|
|
634
|
+
userId: user.id,
|
|
635
|
+
permissionType: _enums1.PermissionType.COMPANY,
|
|
636
|
+
targetId: payload.companyId
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
if (!hasCompanyAccess) {
|
|
640
|
+
throw new _common.UnauthorizedException({
|
|
641
|
+
message: 'No access to this company',
|
|
642
|
+
messageKey: _config.AUTH_MESSAGES.COMPANY_NO_ACCESS
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (payload.branchId) {
|
|
647
|
+
const branchRepository = await this.getBranchRepository();
|
|
648
|
+
if (branchRepository) {
|
|
649
|
+
const branch = await branchRepository.findOne({
|
|
650
|
+
where: {
|
|
651
|
+
id: payload.branchId,
|
|
652
|
+
companyId: payload.companyId,
|
|
653
|
+
isActive: true
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
if (!branch) {
|
|
657
|
+
throw new _common.UnauthorizedException({
|
|
658
|
+
message: 'Branch not found or inactive',
|
|
659
|
+
messageKey: _config.AUTH_MESSAGES.BRANCH_NOT_FOUND
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (permissionRepository) {
|
|
664
|
+
const hasBranchAccess = await permissionRepository.findOne({
|
|
665
|
+
where: {
|
|
666
|
+
userId: user.id,
|
|
667
|
+
permissionType: _enums1.PermissionType.BRANCH,
|
|
668
|
+
targetId: payload.branchId
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
if (!hasBranchAccess) {
|
|
672
|
+
throw new _common.UnauthorizedException({
|
|
673
|
+
message: 'No access to this branch',
|
|
674
|
+
messageKey: _config.AUTH_MESSAGES.BRANCH_NO_ACCESS
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
602
680
|
return this.generateTokens({
|
|
603
681
|
id: user.id,
|
|
604
682
|
email: user.email,
|
|
@@ -687,7 +765,10 @@ let AuthenticationService = class AuthenticationService {
|
|
|
687
765
|
if (!permissionRepository || !companyRepository) {
|
|
688
766
|
throw new _common.BadRequestException({
|
|
689
767
|
message: 'Repositories not available',
|
|
690
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE
|
|
768
|
+
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
769
|
+
messageVariables: {
|
|
770
|
+
entity: 'Some'
|
|
771
|
+
}
|
|
691
772
|
});
|
|
692
773
|
}
|
|
693
774
|
const permissions = await permissionRepository.find({
|
|
@@ -711,7 +792,10 @@ let AuthenticationService = class AuthenticationService {
|
|
|
711
792
|
if (!permissionRepository || !branchRepository) {
|
|
712
793
|
throw new _common.BadRequestException({
|
|
713
794
|
message: 'Repositories not available',
|
|
714
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE
|
|
795
|
+
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
796
|
+
messageVariables: {
|
|
797
|
+
entity: 'Some'
|
|
798
|
+
}
|
|
715
799
|
});
|
|
716
800
|
}
|
|
717
801
|
const companyPermission = await permissionRepository.findOne({
|
|
@@ -63,7 +63,7 @@ let UserPermissionService = class UserPermissionService {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
/** Assign permission to user */ async assignPermission(userId, targetId, type
|
|
66
|
+
/** Assign permission to user */ async assignPermission(userId, targetId, type) {
|
|
67
67
|
const repository = await this.getRepository();
|
|
68
68
|
const typeName = type === _usercompanypermissionentity.PermissionType.COMPANY ? 'company' : 'branch';
|
|
69
69
|
const existing = await repository.findOne({
|
|
@@ -77,7 +77,7 @@ let UserPermissionService = class UserPermissionService {
|
|
|
77
77
|
throw new _common.ConflictException({
|
|
78
78
|
message: `User already assigned to this ${typeName}`,
|
|
79
79
|
messageKey: _config.USER_PERMISSION_MESSAGES.ALREADY_ASSIGNED,
|
|
80
|
-
|
|
80
|
+
messageVariables: {
|
|
81
81
|
type: typeName
|
|
82
82
|
}
|
|
83
83
|
});
|
|
@@ -86,8 +86,7 @@ let UserPermissionService = class UserPermissionService {
|
|
|
86
86
|
await repository.save(repository.create({
|
|
87
87
|
userId,
|
|
88
88
|
permissionType: type,
|
|
89
|
-
targetId
|
|
90
|
-
metadata
|
|
89
|
+
targetId
|
|
91
90
|
}));
|
|
92
91
|
} catch (error) {
|
|
93
92
|
const err = error;
|
|
@@ -95,7 +94,7 @@ let UserPermissionService = class UserPermissionService {
|
|
|
95
94
|
throw new _common.ConflictException({
|
|
96
95
|
message: `User already assigned to this ${typeName}. Please refresh and try again.`,
|
|
97
96
|
messageKey: _config.USER_PERMISSION_MESSAGES.ALREADY_ASSIGNED,
|
|
98
|
-
|
|
97
|
+
messageVariables: {
|
|
99
98
|
type: typeName
|
|
100
99
|
}
|
|
101
100
|
});
|
|
@@ -117,7 +116,7 @@ let UserPermissionService = class UserPermissionService {
|
|
|
117
116
|
throw new _common.NotFoundException({
|
|
118
117
|
message: `${typeName.charAt(0).toUpperCase() + typeName.slice(1)} permission not found`,
|
|
119
118
|
messageKey: _config.USER_PERMISSION_MESSAGES.PERMISSION_NOT_FOUND,
|
|
120
|
-
|
|
119
|
+
messageVariables: {
|
|
121
120
|
type: typeName.charAt(0).toUpperCase() + typeName.slice(1)
|
|
122
121
|
}
|
|
123
122
|
});
|
|
@@ -157,8 +156,7 @@ _ts_decorate([
|
|
|
157
156
|
_ts_metadata("design:paramtypes", [
|
|
158
157
|
String,
|
|
159
158
|
String,
|
|
160
|
-
typeof _usercompanypermissionentity.PermissionType === "undefined" ? Object : _usercompanypermissionentity.PermissionType
|
|
161
|
-
typeof Record === "undefined" ? Object : Record
|
|
159
|
+
typeof _usercompanypermissionentity.PermissionType === "undefined" ? Object : _usercompanypermissionentity.PermissionType
|
|
162
160
|
]),
|
|
163
161
|
_ts_metadata("design:returntype", Promise)
|
|
164
162
|
], UserPermissionService.prototype, "assignPermission", null);
|
|
@@ -8,21 +8,21 @@ Object.defineProperty(exports, "UserService", {
|
|
|
8
8
|
return UserService;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _classes = require("@flusys/nestjs-shared/classes");
|
|
12
11
|
const _nestjsshared = require("@flusys/nestjs-shared");
|
|
12
|
+
const _classes = require("@flusys/nestjs-shared/classes");
|
|
13
|
+
const _constants = require("@flusys/nestjs-shared/constants");
|
|
13
14
|
const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
14
15
|
const _modules = require("@flusys/nestjs-shared/modules");
|
|
15
16
|
const _common = require("@nestjs/common");
|
|
16
|
-
const _constants = require("@flusys/nestjs-shared/constants");
|
|
17
|
-
const _config = require("../config");
|
|
18
17
|
const _bcrypt = /*#__PURE__*/ _interop_require_wildcard(require("bcrypt"));
|
|
19
|
-
const
|
|
20
|
-
const _authdatasourceprovider = require("./auth-datasource.provider");
|
|
18
|
+
const _config = require("../config");
|
|
21
19
|
const _userdto = require("../dtos/user.dto");
|
|
22
|
-
const _enums = require("../enums");
|
|
23
|
-
const _userenricherinterface = require("../interfaces/user-enricher.interface");
|
|
24
20
|
const _usercompanypermissionentity = require("../entities/user-company-permission.entity");
|
|
25
21
|
const _userentity = require("../entities/user.entity");
|
|
22
|
+
const _enums = require("../enums");
|
|
23
|
+
const _userenricherinterface = require("../interfaces/user-enricher.interface");
|
|
24
|
+
const _authconfigservice = require("./auth-config.service");
|
|
25
|
+
const _authdatasourceprovider = require("./auth-datasource.provider");
|
|
26
26
|
function _define_property(obj, key, value) {
|
|
27
27
|
if (key in obj) {
|
|
28
28
|
Object.defineProperty(obj, key, {
|
|
@@ -113,7 +113,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
113
113
|
async getUserForProfile(userId, user) {
|
|
114
114
|
if (userId !== user.id) {
|
|
115
115
|
throw new _common.ForbiddenException({
|
|
116
|
-
message:
|
|
116
|
+
message: "Cannot access another user's profile",
|
|
117
117
|
messageKey: _config.AUTH_MESSAGES.PROFILE_ACCESS_DENIED
|
|
118
118
|
});
|
|
119
119
|
}
|
|
@@ -167,7 +167,10 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
167
167
|
if (!permission) {
|
|
168
168
|
throw new _common.NotFoundException({
|
|
169
169
|
message: 'User company permission not found',
|
|
170
|
-
messageKey: _config.USER_PERMISSION_MESSAGES.PERMISSION_NOT_FOUND
|
|
170
|
+
messageKey: _config.USER_PERMISSION_MESSAGES.PERMISSION_NOT_FOUND,
|
|
171
|
+
messageVariables: {
|
|
172
|
+
type: 'User company'
|
|
173
|
+
}
|
|
171
174
|
});
|
|
172
175
|
}
|
|
173
176
|
permission.isActive = isActive;
|
|
@@ -241,7 +244,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
241
244
|
return entities.map((entity)=>this.convertEntityToResponseDto(entity, isRaw));
|
|
242
245
|
}
|
|
243
246
|
async getGlobalSearchQuery(query, search, _user) {
|
|
244
|
-
query.andWhere('(user.name LIKE :search OR user.email LIKE :search OR user.phone LIKE :search)', {
|
|
247
|
+
query.andWhere('("user".name LIKE :search OR "user".email LIKE :search OR "user".phone LIKE :search)', {
|
|
245
248
|
search: `%${search}%`
|
|
246
249
|
});
|
|
247
250
|
return {
|
|
@@ -260,7 +263,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
260
263
|
}
|
|
261
264
|
if (user?.companyId && this.permissionRepository) {
|
|
262
265
|
query.addSelect(`(SELECT perm.is_active FROM user_company_permissions perm
|
|
263
|
-
WHERE perm.user_id = user.id
|
|
266
|
+
WHERE perm.user_id = "user".id
|
|
264
267
|
AND perm.permission_type = :permissionType
|
|
265
268
|
AND perm.target_id = :companyId
|
|
266
269
|
LIMIT 1)`, 'user_companyIsActive');
|
|
@@ -269,7 +272,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
269
272
|
if (filterAndPaginationDto.filter?.isActive !== undefined) {
|
|
270
273
|
query.andWhere(`EXISTS (
|
|
271
274
|
SELECT 1 FROM user_company_permissions perm
|
|
272
|
-
WHERE perm.user_id = user.id
|
|
275
|
+
WHERE perm.user_id = "user".id
|
|
273
276
|
AND perm.permission_type = :permissionType
|
|
274
277
|
AND perm.target_id = :companyId
|
|
275
278
|
AND perm.is_active = :isActiveValue
|
|
@@ -281,7 +284,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
281
284
|
}
|
|
282
285
|
query.andWhere(`EXISTS (
|
|
283
286
|
SELECT 1 FROM user_company_permissions perm
|
|
284
|
-
WHERE perm.user_id = user.id
|
|
287
|
+
WHERE perm.user_id = "user".id
|
|
285
288
|
AND perm.permission_type = :permissionType
|
|
286
289
|
AND perm.target_id = :companyId
|
|
287
290
|
)`, {
|
|
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "JwtStrategy", {
|
|
|
10
10
|
});
|
|
11
11
|
const _constants = require("@flusys/nestjs-shared/constants");
|
|
12
12
|
const _common = require("@nestjs/common");
|
|
13
|
-
const _config = require("../config");
|
|
14
13
|
const _core = require("@nestjs/core");
|
|
15
14
|
const _passport = require("@nestjs/passport");
|
|
16
15
|
const _passportjwt = require("passport-jwt");
|
|
16
|
+
const _config = require("../config");
|
|
17
17
|
const _userentity = require("../entities/user.entity");
|
|
18
18
|
const _authconfigservice = require("../services/auth-config.service");
|
|
19
19
|
const _authdatasourceprovider = require("../services/auth-datasource.provider");
|
|
@@ -72,12 +72,19 @@ let JwtStrategy = class JwtStrategy extends (0, _passport.PassportStrategy)(_pas
|
|
|
72
72
|
} catch {
|
|
73
73
|
throw new _common.UnauthorizedException({
|
|
74
74
|
message: 'Unable to access user data',
|
|
75
|
-
messageKey: _constants.SYSTEM_MESSAGES.SERVICE_NOT_AVAILABLE
|
|
75
|
+
messageKey: _constants.SYSTEM_MESSAGES.SERVICE_NOT_AVAILABLE,
|
|
76
|
+
messageVariables: {
|
|
77
|
+
provider: 'DataSourceProvider',
|
|
78
|
+
available: ''
|
|
79
|
+
}
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
82
|
throw new _common.UnauthorizedException({
|
|
79
83
|
message: 'User repository not available',
|
|
80
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE
|
|
84
|
+
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
85
|
+
messageVariables: {
|
|
86
|
+
entity: 'User'
|
|
87
|
+
}
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
async checkTokenRevocation(payload) {
|
package/config/message-keys.d.ts
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
export declare const AUTH_MESSAGES: {
|
|
2
2
|
readonly LOGIN_SUCCESS: "auth.login.success";
|
|
3
|
-
readonly
|
|
3
|
+
readonly LOGIN_REQUIRES_SELECTION: "auth.login.requires.selection";
|
|
4
4
|
readonly LOGIN_INVALID_CREDENTIALS: "auth.login.invalid.credentials";
|
|
5
5
|
readonly LOGIN_EMAIL_NOT_VERIFIED: "auth.login.email.not.verified";
|
|
6
|
-
readonly LOGIN_REQUIRES_SELECTION: "auth.login.requires.selection";
|
|
7
6
|
readonly LOGIN_ACCOUNT_DEACTIVATED: "auth.login.account.deactivated";
|
|
8
7
|
readonly LOGOUT_SUCCESS: "auth.logout.success";
|
|
9
8
|
readonly REGISTER_SUCCESS: "auth.register.success";
|
|
10
9
|
readonly REGISTER_FAILED: "auth.register.failed";
|
|
10
|
+
readonly REFRESH_SUCCESS: "auth.refresh.success";
|
|
11
|
+
readonly ME_SUCCESS: "auth.me.success";
|
|
12
|
+
readonly SELECT_SUCCESS: "auth.select.success";
|
|
13
|
+
readonly SWITCH_COMPANY_SUCCESS: "auth.switch.company.success";
|
|
11
14
|
readonly REGISTER_EMAIL_EXISTS: "auth.register.email.exists";
|
|
12
15
|
readonly REGISTER_COMPANY_ALREADY_ASSIGNED: "auth.register.company.already.assigned";
|
|
13
16
|
readonly PASSWORD_CHANGE_SUCCESS: "auth.password.change.success";
|
|
14
|
-
readonly PASSWORD_CHANGE_FAILED: "auth.password.change.failed";
|
|
15
17
|
readonly PASSWORD_CHANGE_INVALID_CURRENT: "auth.password.change.invalid.current";
|
|
16
18
|
readonly PASSWORD_CHANGE_CURRENT_REQUIRED: "auth.password.change.current.required";
|
|
17
19
|
readonly PASSWORD_RESET_EMAIL_SENT: "auth.password.reset.email.sent";
|
|
18
20
|
readonly PASSWORD_RESET_SUCCESS: "auth.password.reset.success";
|
|
19
|
-
readonly PASSWORD_RESET_FAILED: "auth.password.reset.failed";
|
|
20
|
-
readonly TOKEN_REFRESH_SUCCESS: "auth.token.refresh.success";
|
|
21
21
|
readonly TOKEN_REQUIRED: "auth.token.required";
|
|
22
22
|
readonly TOKEN_INVALID: "auth.token.invalid";
|
|
23
23
|
readonly TOKEN_EXPIRED: "auth.token.expired";
|
|
24
24
|
readonly TOKEN_REVOKED: "auth.token.revoked";
|
|
25
25
|
readonly TOKEN_TOO_LARGE: "auth.token.too.large";
|
|
26
|
-
readonly COMPANY_SELECT_SUCCESS: "auth.company.select.success";
|
|
27
|
-
readonly COMPANY_SWITCH_SUCCESS: "auth.company.switch.success";
|
|
28
26
|
readonly COMPANY_LIST_SUCCESS: "auth.company.list.success";
|
|
29
27
|
readonly COMPANY_NO_ACCESS: "auth.company.no.access";
|
|
30
28
|
readonly COMPANY_NOT_FOUND: "auth.company.not.found";
|
|
@@ -33,7 +31,6 @@ export declare const AUTH_MESSAGES: {
|
|
|
33
31
|
readonly BRANCH_LIST_SUCCESS: "auth.branch.list.success";
|
|
34
32
|
readonly BRANCH_NO_ACCESS: "auth.branch.no.access";
|
|
35
33
|
readonly BRANCH_NOT_FOUND: "auth.branch.not.found";
|
|
36
|
-
readonly ME_SUCCESS: "auth.me.success";
|
|
37
34
|
readonly EMAIL_NOT_CONFIGURED: "auth.email.not.configured";
|
|
38
35
|
readonly EMAIL_SEND_FAILED: "auth.email.send.failed";
|
|
39
36
|
readonly SESSION_INVALID: "auth.session.invalid";
|
|
@@ -47,24 +44,13 @@ export declare const AUTH_MESSAGES: {
|
|
|
47
44
|
export declare const EMAIL_VERIFICATION_MESSAGES: {
|
|
48
45
|
readonly VERIFICATION_SENT: "email.verification.sent";
|
|
49
46
|
readonly VERIFICATION_SUCCESS: "email.verification.success";
|
|
50
|
-
readonly VERIFICATION_FAILED: "email.verification.failed";
|
|
51
47
|
readonly VERIFICATION_TOKEN_INVALID: "email.verification.token.invalid";
|
|
52
48
|
readonly VERIFICATION_TOKEN_EXPIRED: "email.verification.token.expired";
|
|
53
49
|
readonly VERIFICATION_NOT_ENABLED: "email.verification.not.enabled";
|
|
54
50
|
readonly RESEND_SUCCESS: "email.verification.resend.success";
|
|
55
|
-
readonly RESEND_THROTTLED: "email.verification.resend.throttled";
|
|
56
51
|
};
|
|
57
52
|
export declare const USER_MESSAGES: {
|
|
58
|
-
readonly CREATE_SUCCESS: "user.create.success";
|
|
59
|
-
readonly CREATE_MANY_SUCCESS: "user.create.many.success";
|
|
60
|
-
readonly GET_SUCCESS: "user.get.success";
|
|
61
|
-
readonly GET_ALL_SUCCESS: "user.get.all.success";
|
|
62
|
-
readonly UPDATE_SUCCESS: "user.update.success";
|
|
63
|
-
readonly UPDATE_MANY_SUCCESS: "user.update.many.success";
|
|
64
|
-
readonly DELETE_SUCCESS: "user.delete.success";
|
|
65
|
-
readonly RESTORE_SUCCESS: "user.restore.success";
|
|
66
53
|
readonly NOT_FOUND: "user.not.found";
|
|
67
|
-
readonly PROFILE_SUCCESS: "user.profile.success";
|
|
68
54
|
readonly PROFILE_UPDATE_SUCCESS: "user.profile.update.success";
|
|
69
55
|
readonly PROFILE_EXTRAS_SUCCESS: "user.profile.extras.success";
|
|
70
56
|
readonly PROFILE_SECTIONS_SUCCESS: "user.profile.sections.success";
|
|
@@ -75,144 +61,10 @@ export declare const USER_MESSAGES: {
|
|
|
75
61
|
readonly PHONE_VERIFY_SUCCESS: "user.phone.verify.success";
|
|
76
62
|
readonly STATUS_UPDATE_SUCCESS: "user.status.update.success";
|
|
77
63
|
};
|
|
78
|
-
export declare const COMPANY_MESSAGES: {
|
|
79
|
-
readonly CREATE_SUCCESS: "company.create.success";
|
|
80
|
-
readonly CREATE_MANY_SUCCESS: "company.create.many.success";
|
|
81
|
-
readonly GET_SUCCESS: "company.get.success";
|
|
82
|
-
readonly GET_ALL_SUCCESS: "company.get.all.success";
|
|
83
|
-
readonly UPDATE_SUCCESS: "company.update.success";
|
|
84
|
-
readonly UPDATE_MANY_SUCCESS: "company.update.many.success";
|
|
85
|
-
readonly DELETE_SUCCESS: "company.delete.success";
|
|
86
|
-
readonly RESTORE_SUCCESS: "company.restore.success";
|
|
87
|
-
readonly NOT_FOUND: "company.not.found";
|
|
88
|
-
};
|
|
89
|
-
export declare const BRANCH_MESSAGES: {
|
|
90
|
-
readonly CREATE_SUCCESS: "branch.create.success";
|
|
91
|
-
readonly CREATE_MANY_SUCCESS: "branch.create.many.success";
|
|
92
|
-
readonly GET_SUCCESS: "branch.get.success";
|
|
93
|
-
readonly GET_ALL_SUCCESS: "branch.get.all.success";
|
|
94
|
-
readonly UPDATE_SUCCESS: "branch.update.success";
|
|
95
|
-
readonly UPDATE_MANY_SUCCESS: "branch.update.many.success";
|
|
96
|
-
readonly DELETE_SUCCESS: "branch.delete.success";
|
|
97
|
-
readonly RESTORE_SUCCESS: "branch.restore.success";
|
|
98
|
-
readonly NOT_FOUND: "branch.not.found";
|
|
99
|
-
};
|
|
100
64
|
export declare const USER_PERMISSION_MESSAGES: {
|
|
101
|
-
readonly COMPANY_ASSIGN_SUCCESS: "user.permission.company.assign.success";
|
|
102
65
|
readonly COMPANY_LIST_SUCCESS: "user.permission.company.list.success";
|
|
103
|
-
readonly BRANCH_ASSIGN_SUCCESS: "user.permission.branch.assign.success";
|
|
104
66
|
readonly BRANCH_LIST_SUCCESS: "user.permission.branch.list.success";
|
|
105
67
|
readonly BATCH_SUCCESS: "user.permission.batch.success";
|
|
106
68
|
readonly ALREADY_ASSIGNED: "user.permission.already.assigned";
|
|
107
69
|
readonly PERMISSION_NOT_FOUND: "user.permission.not.found";
|
|
108
70
|
};
|
|
109
|
-
export declare const AUTH_MODULE_MESSAGES: {
|
|
110
|
-
readonly AUTH: {
|
|
111
|
-
readonly LOGIN_SUCCESS: "auth.login.success";
|
|
112
|
-
readonly LOGIN_FAILED: "auth.login.failed";
|
|
113
|
-
readonly LOGIN_INVALID_CREDENTIALS: "auth.login.invalid.credentials";
|
|
114
|
-
readonly LOGIN_EMAIL_NOT_VERIFIED: "auth.login.email.not.verified";
|
|
115
|
-
readonly LOGIN_REQUIRES_SELECTION: "auth.login.requires.selection";
|
|
116
|
-
readonly LOGIN_ACCOUNT_DEACTIVATED: "auth.login.account.deactivated";
|
|
117
|
-
readonly LOGOUT_SUCCESS: "auth.logout.success";
|
|
118
|
-
readonly REGISTER_SUCCESS: "auth.register.success";
|
|
119
|
-
readonly REGISTER_FAILED: "auth.register.failed";
|
|
120
|
-
readonly REGISTER_EMAIL_EXISTS: "auth.register.email.exists";
|
|
121
|
-
readonly REGISTER_COMPANY_ALREADY_ASSIGNED: "auth.register.company.already.assigned";
|
|
122
|
-
readonly PASSWORD_CHANGE_SUCCESS: "auth.password.change.success";
|
|
123
|
-
readonly PASSWORD_CHANGE_FAILED: "auth.password.change.failed";
|
|
124
|
-
readonly PASSWORD_CHANGE_INVALID_CURRENT: "auth.password.change.invalid.current";
|
|
125
|
-
readonly PASSWORD_CHANGE_CURRENT_REQUIRED: "auth.password.change.current.required";
|
|
126
|
-
readonly PASSWORD_RESET_EMAIL_SENT: "auth.password.reset.email.sent";
|
|
127
|
-
readonly PASSWORD_RESET_SUCCESS: "auth.password.reset.success";
|
|
128
|
-
readonly PASSWORD_RESET_FAILED: "auth.password.reset.failed";
|
|
129
|
-
readonly TOKEN_REFRESH_SUCCESS: "auth.token.refresh.success";
|
|
130
|
-
readonly TOKEN_REQUIRED: "auth.token.required";
|
|
131
|
-
readonly TOKEN_INVALID: "auth.token.invalid";
|
|
132
|
-
readonly TOKEN_EXPIRED: "auth.token.expired";
|
|
133
|
-
readonly TOKEN_REVOKED: "auth.token.revoked";
|
|
134
|
-
readonly TOKEN_TOO_LARGE: "auth.token.too.large";
|
|
135
|
-
readonly COMPANY_SELECT_SUCCESS: "auth.company.select.success";
|
|
136
|
-
readonly COMPANY_SWITCH_SUCCESS: "auth.company.switch.success";
|
|
137
|
-
readonly COMPANY_LIST_SUCCESS: "auth.company.list.success";
|
|
138
|
-
readonly COMPANY_NO_ACCESS: "auth.company.no.access";
|
|
139
|
-
readonly COMPANY_NOT_FOUND: "auth.company.not.found";
|
|
140
|
-
readonly COMPANY_REQUIRED: "auth.company.required";
|
|
141
|
-
readonly COMPANY_FEATURE_NOT_ENABLED: "auth.company.feature.not.enabled";
|
|
142
|
-
readonly BRANCH_LIST_SUCCESS: "auth.branch.list.success";
|
|
143
|
-
readonly BRANCH_NO_ACCESS: "auth.branch.no.access";
|
|
144
|
-
readonly BRANCH_NOT_FOUND: "auth.branch.not.found";
|
|
145
|
-
readonly ME_SUCCESS: "auth.me.success";
|
|
146
|
-
readonly EMAIL_NOT_CONFIGURED: "auth.email.not.configured";
|
|
147
|
-
readonly EMAIL_SEND_FAILED: "auth.email.send.failed";
|
|
148
|
-
readonly SESSION_INVALID: "auth.session.invalid";
|
|
149
|
-
readonly SESSION_NOT_AVAILABLE: "auth.session.not.available";
|
|
150
|
-
readonly PROFILE_ACCESS_DENIED: "auth.profile.access.denied";
|
|
151
|
-
readonly PROFILE_SECTIONS_NOT_SUPPORTED: "auth.profile.sections.not.supported";
|
|
152
|
-
readonly LOGOUT_SERVICE_UNAVAILABLE: "auth.logout.service.unavailable";
|
|
153
|
-
readonly PASSWORD_RESET_TOKEN_EXPIRED: "auth.password.reset.token.expired";
|
|
154
|
-
readonly PASSWORD_RESET_TOKEN_USED: "auth.password.reset.token.used";
|
|
155
|
-
};
|
|
156
|
-
readonly EMAIL_VERIFICATION: {
|
|
157
|
-
readonly VERIFICATION_SENT: "email.verification.sent";
|
|
158
|
-
readonly VERIFICATION_SUCCESS: "email.verification.success";
|
|
159
|
-
readonly VERIFICATION_FAILED: "email.verification.failed";
|
|
160
|
-
readonly VERIFICATION_TOKEN_INVALID: "email.verification.token.invalid";
|
|
161
|
-
readonly VERIFICATION_TOKEN_EXPIRED: "email.verification.token.expired";
|
|
162
|
-
readonly VERIFICATION_NOT_ENABLED: "email.verification.not.enabled";
|
|
163
|
-
readonly RESEND_SUCCESS: "email.verification.resend.success";
|
|
164
|
-
readonly RESEND_THROTTLED: "email.verification.resend.throttled";
|
|
165
|
-
};
|
|
166
|
-
readonly USER: {
|
|
167
|
-
readonly CREATE_SUCCESS: "user.create.success";
|
|
168
|
-
readonly CREATE_MANY_SUCCESS: "user.create.many.success";
|
|
169
|
-
readonly GET_SUCCESS: "user.get.success";
|
|
170
|
-
readonly GET_ALL_SUCCESS: "user.get.all.success";
|
|
171
|
-
readonly UPDATE_SUCCESS: "user.update.success";
|
|
172
|
-
readonly UPDATE_MANY_SUCCESS: "user.update.many.success";
|
|
173
|
-
readonly DELETE_SUCCESS: "user.delete.success";
|
|
174
|
-
readonly RESTORE_SUCCESS: "user.restore.success";
|
|
175
|
-
readonly NOT_FOUND: "user.not.found";
|
|
176
|
-
readonly PROFILE_SUCCESS: "user.profile.success";
|
|
177
|
-
readonly PROFILE_UPDATE_SUCCESS: "user.profile.update.success";
|
|
178
|
-
readonly PROFILE_EXTRAS_SUCCESS: "user.profile.extras.success";
|
|
179
|
-
readonly PROFILE_SECTIONS_SUCCESS: "user.profile.sections.success";
|
|
180
|
-
readonly PROFILE_SECTION_DATA_SUCCESS: "user.profile.section.data.success";
|
|
181
|
-
readonly PROFILE_SECTION_UPDATE_SUCCESS: "user.profile.section.update.success";
|
|
182
|
-
readonly PROFILE_COMPLETION_SUCCESS: "user.profile.completion.success";
|
|
183
|
-
readonly EMAIL_VERIFY_SUCCESS: "user.email.verify.success";
|
|
184
|
-
readonly PHONE_VERIFY_SUCCESS: "user.phone.verify.success";
|
|
185
|
-
readonly STATUS_UPDATE_SUCCESS: "user.status.update.success";
|
|
186
|
-
};
|
|
187
|
-
readonly COMPANY: {
|
|
188
|
-
readonly CREATE_SUCCESS: "company.create.success";
|
|
189
|
-
readonly CREATE_MANY_SUCCESS: "company.create.many.success";
|
|
190
|
-
readonly GET_SUCCESS: "company.get.success";
|
|
191
|
-
readonly GET_ALL_SUCCESS: "company.get.all.success";
|
|
192
|
-
readonly UPDATE_SUCCESS: "company.update.success";
|
|
193
|
-
readonly UPDATE_MANY_SUCCESS: "company.update.many.success";
|
|
194
|
-
readonly DELETE_SUCCESS: "company.delete.success";
|
|
195
|
-
readonly RESTORE_SUCCESS: "company.restore.success";
|
|
196
|
-
readonly NOT_FOUND: "company.not.found";
|
|
197
|
-
};
|
|
198
|
-
readonly BRANCH: {
|
|
199
|
-
readonly CREATE_SUCCESS: "branch.create.success";
|
|
200
|
-
readonly CREATE_MANY_SUCCESS: "branch.create.many.success";
|
|
201
|
-
readonly GET_SUCCESS: "branch.get.success";
|
|
202
|
-
readonly GET_ALL_SUCCESS: "branch.get.all.success";
|
|
203
|
-
readonly UPDATE_SUCCESS: "branch.update.success";
|
|
204
|
-
readonly UPDATE_MANY_SUCCESS: "branch.update.many.success";
|
|
205
|
-
readonly DELETE_SUCCESS: "branch.delete.success";
|
|
206
|
-
readonly RESTORE_SUCCESS: "branch.restore.success";
|
|
207
|
-
readonly NOT_FOUND: "branch.not.found";
|
|
208
|
-
};
|
|
209
|
-
readonly USER_PERMISSION: {
|
|
210
|
-
readonly COMPANY_ASSIGN_SUCCESS: "user.permission.company.assign.success";
|
|
211
|
-
readonly COMPANY_LIST_SUCCESS: "user.permission.company.list.success";
|
|
212
|
-
readonly BRANCH_ASSIGN_SUCCESS: "user.permission.branch.assign.success";
|
|
213
|
-
readonly BRANCH_LIST_SUCCESS: "user.permission.branch.list.success";
|
|
214
|
-
readonly BATCH_SUCCESS: "user.permission.batch.success";
|
|
215
|
-
readonly ALREADY_ASSIGNED: "user.permission.already.assigned";
|
|
216
|
-
readonly PERMISSION_NOT_FOUND: "user.permission.not.found";
|
|
217
|
-
};
|
|
218
|
-
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MessageResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
1
|
+
import { MessageResponseDto, SingleResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
2
2
|
import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
3
3
|
import { Request } from 'express';
|
|
4
4
|
import { ChangePasswordDto, CompanySelectionResponseDto, LoginDto, LoginResponseDto, LoginResponseRequiresEmailVerificationDto, MeResponseDto, RefreshTokenDto, RegistrationDto, RegistrationResponseDto } from '../dtos/authentication.dto';
|
|
@@ -8,13 +8,12 @@ export declare class AuthenticationController {
|
|
|
8
8
|
private readonly authService;
|
|
9
9
|
private readonly authConfig?;
|
|
10
10
|
constructor(authService: AuthenticationService, authConfig?: AuthConfigService);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
refreshToken(req: Request, refreshTokenDto: RefreshTokenDto): Promise<{
|
|
11
|
+
login(loginDto: LoginDto): Promise<SingleResponseDto<LoginResponseDto | CompanySelectionResponseDto | LoginResponseRequiresEmailVerificationDto>>;
|
|
12
|
+
register(req: Request, registrationDto: RegistrationDto): Promise<SingleResponseDto<RegistrationResponseDto>>;
|
|
13
|
+
refreshToken(req: Request, refreshTokenDto: RefreshTokenDto): Promise<SingleResponseDto<{
|
|
15
14
|
accessToken: string;
|
|
16
|
-
}
|
|
17
|
-
getCurrentUser(user: ILoggedUserInfo): Promise<MeResponseDto
|
|
15
|
+
}>>;
|
|
16
|
+
getCurrentUser(user: ILoggedUserInfo): Promise<SingleResponseDto<MeResponseDto>>;
|
|
18
17
|
logout(userId: string): Promise<MessageResponseDto>;
|
|
19
18
|
changePassword(userId: string, dto: ChangePasswordDto): Promise<MessageResponseDto>;
|
|
20
19
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { SingleResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
1
2
|
import { LoginResponseDto, SelectDto, SwitchCompanyDto } from '../dtos/authentication.dto';
|
|
2
3
|
import { AuthenticationService } from '../services/authentication.service';
|
|
3
4
|
export declare class CompanySelectionController {
|
|
4
5
|
private readonly authService;
|
|
5
6
|
constructor(authService: AuthenticationService);
|
|
6
|
-
select(dto: SelectDto): Promise<LoginResponseDto
|
|
7
|
-
switchCompany(userId: string, dto: SwitchCompanyDto): Promise<LoginResponseDto
|
|
7
|
+
select(dto: SelectDto): Promise<SingleResponseDto<LoginResponseDto>>;
|
|
8
|
+
switchCompany(userId: string, dto: SwitchCompanyDto): Promise<SingleResponseDto<LoginResponseDto>>;
|
|
8
9
|
getUserCompanies(userId: string): Promise<{
|
|
9
10
|
success: boolean;
|
|
10
11
|
message: string;
|