@flusys/nestjs-auth 1.0.0-rc → 1.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.
Files changed (61) hide show
  1. package/README.md +530 -396
  2. package/cjs/controllers/authentication.controller.js +160 -28
  3. package/cjs/controllers/user-permission.controller.js +49 -136
  4. package/cjs/docs/auth-swagger.config.js +14 -7
  5. package/cjs/dtos/authentication.dto.js +0 -30
  6. package/cjs/dtos/index.js +0 -1
  7. package/cjs/entities/user-company-permission.entity.js +3 -3
  8. package/cjs/interceptors/clear-token.interceptor.js +8 -18
  9. package/cjs/interceptors/set-token.interceptor.js +8 -55
  10. package/cjs/interfaces/auth-email-provider.interface.js +1 -1
  11. package/cjs/modules/auth.module.js +63 -129
  12. package/cjs/services/auth-config.service.js +6 -29
  13. package/cjs/services/auth-datasource.provider.js +8 -20
  14. package/cjs/services/auth-email.service.js +72 -87
  15. package/cjs/services/authentication.service.js +211 -355
  16. package/cjs/services/branch.service.js +9 -5
  17. package/cjs/services/user-permission.service.js +43 -71
  18. package/cjs/services/user.service.js +18 -47
  19. package/cjs/strategies/jwt.strategy.js +44 -44
  20. package/controllers/authentication.controller.d.ts +5 -3
  21. package/controllers/user-permission.controller.d.ts +5 -4
  22. package/dtos/authentication.dto.d.ts +0 -4
  23. package/dtos/index.d.ts +0 -1
  24. package/entities/index.d.ts +3 -3
  25. package/entities/user-company-permission.entity.d.ts +1 -1
  26. package/fesm/controllers/authentication.controller.js +162 -30
  27. package/fesm/controllers/user-permission.controller.js +50 -137
  28. package/fesm/docs/auth-swagger.config.js +14 -7
  29. package/fesm/dtos/authentication.dto.js +0 -30
  30. package/fesm/dtos/index.js +0 -1
  31. package/fesm/entities/user-company-permission.entity.js +3 -3
  32. package/fesm/interceptors/clear-token.interceptor.js +8 -18
  33. package/fesm/interceptors/set-token.interceptor.js +8 -55
  34. package/fesm/interfaces/auth-email-provider.interface.js +1 -1
  35. package/fesm/modules/auth.module.js +63 -129
  36. package/fesm/services/auth-config.service.js +6 -29
  37. package/fesm/services/auth-datasource.provider.js +8 -20
  38. package/fesm/services/auth-email.service.js +72 -87
  39. package/fesm/services/authentication.service.js +211 -355
  40. package/fesm/services/branch.service.js +9 -5
  41. package/fesm/services/user-permission.service.js +44 -72
  42. package/fesm/services/user.service.js +18 -47
  43. package/fesm/strategies/jwt.strategy.js +44 -44
  44. package/interceptors/clear-token.interceptor.d.ts +0 -1
  45. package/interceptors/set-token.interceptor.d.ts +1 -2
  46. package/interfaces/authentication.interface.d.ts +0 -4
  47. package/modules/auth.module.d.ts +6 -2
  48. package/package.json +3 -3
  49. package/services/auth-config.service.d.ts +2 -7
  50. package/services/auth-datasource.provider.d.ts +2 -4
  51. package/services/auth-email.service.d.ts +7 -4
  52. package/services/authentication.service.d.ts +14 -8
  53. package/services/user-permission.service.d.ts +6 -8
  54. package/services/user.service.d.ts +1 -1
  55. package/strategies/jwt.strategy.d.ts +4 -1
  56. package/cjs/dtos/user-company-permission.dto.js +0 -110
  57. package/cjs/guards/auth-throttler.guard.js +0 -53
  58. package/dtos/user-company-permission.dto.d.ts +0 -10
  59. package/fesm/dtos/user-company-permission.dto.js +0 -98
  60. package/fesm/guards/auth-throttler.guard.js +0 -43
  61. package/guards/auth-throttler.guard.d.ts +0 -7
@@ -77,11 +77,15 @@ let BranchService = class BranchService extends _classes.RequestScopedApiService
77
77
  }
78
78
  async getExtraManipulateQuery(query, filterDto, user) {
79
79
  const result = await super.getExtraManipulateQuery(query, filterDto, user);
80
- (0, _utils.applyCompanyFilter)(query, {
81
- isCompanyFeatureEnabled: this.authConfig.isCompanyFeatureEnabled(),
82
- entityAlias: 'company_branch',
83
- columnName: 'company_id'
84
- }, user);
80
+ // Only apply company filter if companyId is NOT explicitly provided in filter
81
+ // This prevents dual filtering when user selects a specific company
82
+ if (!filterDto?.filter?.companyId) {
83
+ (0, _utils.applyCompanyFilter)(query, {
84
+ isCompanyFeatureEnabled: this.authConfig.isCompanyFeatureEnabled(),
85
+ entityAlias: 'company_branch',
86
+ columnName: 'company_id'
87
+ }, user);
88
+ }
85
89
  return result;
86
90
  }
87
91
  constructor(cacheManager, utilsService, dataSourceProvider, authConfig){
@@ -39,120 +39,92 @@ function _ts_param(paramIndex, decorator) {
39
39
  };
40
40
  }
41
41
  let UserPermissionService = class UserPermissionService {
42
- /** Get repository lazily - initialized on first access */ async getRepository() {
42
+ async getRepository() {
43
43
  if (!this._repository) {
44
44
  this._repository = await this.dataSourceProvider.getRepository(_usercompanypermissionentity.UserCompanyPermission);
45
45
  }
46
46
  return this._repository;
47
47
  }
48
- // Company Permissions
49
- /** Find all companies a user has access to */ async findUserCompanies(userId) {
48
+ // Generic Permission Operations
49
+ /** Find all permissions of a specific type for a user */ async findUserPermissions(userId, type) {
50
50
  const repository = await this.getRepository();
51
51
  return repository.find({
52
52
  where: {
53
53
  userId,
54
- permissionType: _usercompanypermissionentity.PermissionType.COMPANY
54
+ permissionType: type
55
55
  },
56
56
  relations: [
57
- 'company'
57
+ type === _usercompanypermissionentity.PermissionType.COMPANY ? 'company' : 'branch'
58
58
  ],
59
59
  order: {
60
60
  createdAt: 'DESC'
61
61
  }
62
62
  });
63
63
  }
64
- /** Assign user to a company */ async assignUserToCompany(dto) {
64
+ /** Assign permission to user */ async assignPermission(userId, targetId, type, metadata) {
65
65
  const repository = await this.getRepository();
66
- // Check if already exists
66
+ const typeName = type === _usercompanypermissionentity.PermissionType.COMPANY ? 'company' : 'branch';
67
67
  const existing = await repository.findOne({
68
68
  where: {
69
- userId: dto.userId,
70
- targetId: dto.companyId,
71
- permissionType: _usercompanypermissionentity.PermissionType.COMPANY
69
+ userId,
70
+ targetId,
71
+ permissionType: type
72
72
  }
73
73
  });
74
74
  if (existing) {
75
- throw new _common.BadRequestException('User already assigned to this company');
75
+ throw new _common.ConflictException(`User already assigned to this ${typeName}`);
76
76
  }
77
- const permission = repository.create({
78
- userId: dto.userId,
79
- permissionType: _usercompanypermissionentity.PermissionType.COMPANY,
80
- targetId: dto.companyId,
81
- metadata: dto.metadata
82
- });
83
- await repository.save(permission);
84
- }
85
- /** Revoke user access to a company */ async revokeCompanyAccess(userId, companyId) {
86
- const repository = await this.getRepository();
87
- const permission = await repository.findOne({
88
- where: {
77
+ try {
78
+ await repository.save(repository.create({
89
79
  userId,
90
- targetId: companyId,
91
- permissionType: _usercompanypermissionentity.PermissionType.COMPANY
80
+ permissionType: type,
81
+ targetId,
82
+ metadata
83
+ }));
84
+ } catch (error) {
85
+ if (error?.code === 'ER_DUP_ENTRY' || error?.message?.includes('Duplicate entry')) {
86
+ throw new _common.ConflictException(`User already assigned to this ${typeName}. Please refresh and try again.`);
92
87
  }
93
- });
94
- if (!permission) {
95
- throw new _common.NotFoundException('Company permission not found');
88
+ throw error;
96
89
  }
97
- await repository.remove(permission);
98
90
  }
99
- // Branch Permissions
100
- /** Find all branches a user has access to */ async findUserBranches(userId) {
101
- const repository = await this.getRepository();
102
- return repository.find({
103
- where: {
104
- userId,
105
- permissionType: _usercompanypermissionentity.PermissionType.BRANCH
106
- },
107
- relations: [
108
- 'branch'
109
- ],
110
- order: {
111
- createdAt: 'DESC'
112
- }
113
- });
114
- }
115
- /** Assign user to a branch */ async assignUserToBranch(dto) {
116
- const repository = await this.getRepository();
117
- // Check if already exists
118
- const existing = await repository.findOne({
119
- where: {
120
- userId: dto.userId,
121
- targetId: dto.branchId,
122
- permissionType: _usercompanypermissionentity.PermissionType.BRANCH
123
- }
124
- });
125
- if (existing) {
126
- throw new _common.BadRequestException('User already assigned to this branch');
127
- }
128
- const permission = repository.create({
129
- userId: dto.userId,
130
- permissionType: _usercompanypermissionentity.PermissionType.BRANCH,
131
- targetId: dto.branchId,
132
- metadata: dto.metadata
133
- });
134
- await repository.save(permission);
135
- }
136
- /** Revoke user access to a branch */ async revokeBranchAccess(userId, branchId) {
91
+ /** Revoke permission from user */ async revokePermission(userId, targetId, type) {
137
92
  const repository = await this.getRepository();
93
+ const typeName = type === _usercompanypermissionentity.PermissionType.COMPANY ? 'company' : 'branch';
138
94
  const permission = await repository.findOne({
139
95
  where: {
140
96
  userId,
141
- targetId: branchId,
142
- permissionType: _usercompanypermissionentity.PermissionType.BRANCH
97
+ targetId,
98
+ permissionType: type
143
99
  }
144
100
  });
145
101
  if (!permission) {
146
- throw new _common.NotFoundException('Branch permission not found');
102
+ throw new _common.NotFoundException(`${typeName.charAt(0).toUpperCase() + typeName.slice(1)} permission not found`);
147
103
  }
148
104
  await repository.remove(permission);
149
105
  }
150
- // NOTE: @Inject() required for bundled code - type metadata may be lost during esbuild
106
+ /** Find user branch permissions with optional company filter */ async findUserBranches(userId, companyId) {
107
+ const repository = await this.getRepository();
108
+ const queryBuilder = repository.createQueryBuilder('permission').leftJoinAndSelect('permission.branch', 'branch').where('permission.userId = :userId', {
109
+ userId
110
+ }).andWhere('permission.permissionType = :type', {
111
+ type: _usercompanypermissionentity.PermissionType.BRANCH
112
+ }).orderBy('permission.createdAt', 'DESC');
113
+ if (companyId) {
114
+ queryBuilder.andWhere('branch.companyId = :companyId', {
115
+ companyId
116
+ });
117
+ }
118
+ return queryBuilder.getMany();
119
+ }
151
120
  constructor(dataSourceProvider){
152
121
  _define_property(this, "dataSourceProvider", void 0);
153
122
  _define_property(this, "_repository", void 0);
123
+ // Convenience Methods
124
+ _define_property(this, "findUserCompanies", void 0);
154
125
  this.dataSourceProvider = dataSourceProvider;
155
126
  this._repository = null;
127
+ this.findUserCompanies = (userId)=>this.findUserPermissions(userId, _usercompanypermissionentity.PermissionType.COMPANY);
156
128
  }
157
129
  };
158
130
  UserPermissionService = _ts_decorate([
@@ -111,12 +111,22 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
111
111
  }
112
112
  // Custom Methods
113
113
  /**
114
- * Validate that the requesting user owns the target profile.
115
- * Users can only access/modify their own profile data.
116
- */ validateProfileOwnership(targetUserId, requestingUser) {
117
- if (targetUserId !== requestingUser.id) {
114
+ * Validate profile ownership, ensure repository initialized, and fetch user.
115
+ * Throws ForbiddenException if not owner, NotFoundException if user not found.
116
+ */ async getUserForProfile(userId, user) {
117
+ if (userId !== user.id) {
118
118
  throw new _common.ForbiddenException('Cannot access another user\'s profile');
119
119
  }
120
+ await this.ensureRepositoryInitialized();
121
+ const userEntity = await this.repository.findOne({
122
+ where: {
123
+ id: userId
124
+ }
125
+ });
126
+ if (!userEntity) {
127
+ throw new _common.NotFoundException('User not found');
128
+ }
129
+ return userEntity;
120
130
  }
121
131
  /** Verify email */ async verifyEmail(id) {
122
132
  // Ensure repository is initialized for custom method
@@ -375,16 +385,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
375
385
  * Get user profile with extras from enricher
376
386
  * Returns base user data plus any extra data provided by enricher (roles, permissions, etc.)
377
387
  */ async getProfileWithExtras(userId, user) {
378
- this.validateProfileOwnership(userId, user);
379
- await this.ensureRepositoryInitialized();
380
- const userEntity = await this.repository.findOne({
381
- where: {
382
- id: userId
383
- }
384
- });
385
- if (!userEntity) {
386
- throw new _common.NotFoundException('User not found');
387
- }
388
+ const userEntity = await this.getUserForProfile(userId, user);
388
389
  const userData = this.convertEntityToResponseDto(userEntity, false);
389
390
  // Get extras from enricher if available
390
391
  let extras;
@@ -419,17 +420,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
419
420
  /**
420
421
  * Get specific profile section data
421
422
  */ async getProfileSectionData(userId, sectionId, user) {
422
- this.validateProfileOwnership(userId, user);
423
- await this.ensureRepositoryInitialized();
424
- // Verify user exists
425
- const userEntity = await this.repository.findOne({
426
- where: {
427
- id: userId
428
- }
429
- });
430
- if (!userEntity) {
431
- throw new _common.NotFoundException('User not found');
432
- }
423
+ await this.getUserForProfile(userId, user);
433
424
  if (this.userEnricher?.getProfileSectionData) {
434
425
  return this.userEnricher.getProfileSectionData(userId, sectionId, user);
435
426
  }
@@ -438,20 +429,10 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
438
429
  /**
439
430
  * Update specific profile section
440
431
  */ async updateProfileSection(userId, sectionId, data, user) {
441
- this.validateProfileOwnership(userId, user);
442
- await this.ensureRepositoryInitialized();
432
+ const userEntity = await this.getUserForProfile(userId, user);
443
433
  if (!this.dataSource) {
444
434
  throw new _common.BadRequestException('DataSource not available');
445
435
  }
446
- // Verify user exists
447
- const userEntity = await this.repository.findOne({
448
- where: {
449
- id: userId
450
- }
451
- });
452
- if (!userEntity) {
453
- throw new _common.NotFoundException('User not found');
454
- }
455
436
  if (!this.userEnricher?.updateProfileSection) {
456
437
  throw new _common.BadRequestException('Profile sections not supported');
457
438
  }
@@ -478,17 +459,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
478
459
  /**
479
460
  * Get profile completion percentage
480
461
  */ async getProfileCompletion(userId, user) {
481
- this.validateProfileOwnership(userId, user);
482
- await this.ensureRepositoryInitialized();
483
- // Verify user exists
484
- const userEntity = await this.repository.findOne({
485
- where: {
486
- id: userId
487
- }
488
- });
489
- if (!userEntity) {
490
- throw new _common.NotFoundException('User not found');
491
- }
462
+ await this.getUserForProfile(userId, user);
492
463
  if (this.userEnricher?.calculateProfileCompletion) {
493
464
  return this.userEnricher.calculateProfileCompletion(userId, user);
494
465
  }
@@ -12,10 +12,10 @@ const _common = require("@nestjs/common");
12
12
  const _core = require("@nestjs/core");
13
13
  const _passport = require("@nestjs/passport");
14
14
  const _passportjwt = require("passport-jwt");
15
+ const _userentity = require("../entities/user.entity");
15
16
  const _authconfigservice = require("../services/auth-config.service");
16
17
  const _authdatasourceprovider = require("../services/auth-datasource.provider");
17
18
  const _authenticationservice = require("../services/authentication.service");
18
- const _userentity = require("../entities/user.entity");
19
19
  function _define_property(obj, key, value) {
20
20
  if (key in obj) {
21
21
  Object.defineProperty(obj, key, {
@@ -38,71 +38,71 @@ function _ts_decorate(decorators, target, key, desc) {
38
38
  function _ts_metadata(k, v) {
39
39
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
40
40
  }
41
- /**
42
- * Type guard to check if payload includes company context
43
- */ function isTokenPayloadWithCompany(payload) {
41
+ function hasCompanyContext(payload) {
44
42
  return 'companyId' in payload && 'branchId' in payload;
45
43
  }
46
44
  let JwtStrategy = class JwtStrategy extends (0, _passport.PassportStrategy)(_passportjwt.Strategy, 'jwt') {
47
45
  async validate(_req, payload) {
48
- // Resolve request-scoped services for this request
49
- let userRepository = null;
50
- let authService = null;
46
+ const userRepo = await this.resolveUserRepository();
47
+ await this.checkTokenRevocation(payload);
48
+ const user = await userRepo.findOne({
49
+ where: {
50
+ id: payload.id,
51
+ isActive: true
52
+ }
53
+ });
54
+ if (!user) {
55
+ throw new _common.UnauthorizedException('User not found or inactive');
56
+ }
57
+ return this.buildUserInfo(payload);
58
+ }
59
+ async resolveUserRepository() {
51
60
  try {
52
- const dataSourceProvider = await this.moduleRef.resolve(_authdatasourceprovider.AuthDataSourceProvider, undefined, {
61
+ const provider = await this.moduleRef.resolve(_authdatasourceprovider.AuthDataSourceProvider, undefined, {
53
62
  strict: false
54
63
  });
55
- if (dataSourceProvider) {
56
- userRepository = await dataSourceProvider.getRepository(_userentity.User);
64
+ if (provider) {
65
+ return provider.getRepository(_userentity.User);
57
66
  }
58
- // Resolve AuthenticationService for token revocation check
59
- authService = await this.moduleRef.resolve(_authenticationservice.AuthenticationService, undefined, {
60
- strict: false
61
- });
62
- } catch (error) {
67
+ } catch {
63
68
  throw new _common.UnauthorizedException('Unable to access user data');
64
69
  }
65
- if (!userRepository) {
66
- throw new _common.UnauthorizedException('User repository not available');
67
- }
68
- // Check if token is revoked (logged out)
69
- if (authService && payload.iat) {
70
- const isRevoked = await authService.isTokenRevoked(payload.id, payload.iat);
71
- if (isRevoked) {
70
+ throw new _common.UnauthorizedException('User repository not available');
71
+ }
72
+ async checkTokenRevocation(payload) {
73
+ if (!payload.iat) return;
74
+ try {
75
+ const authService = await this.moduleRef.resolve(_authenticationservice.AuthenticationService, undefined, {
76
+ strict: false
77
+ });
78
+ if (authService && await authService.isTokenRevoked(payload.id, payload.iat)) {
72
79
  throw new _common.UnauthorizedException('Token has been revoked');
73
80
  }
81
+ } catch (err) {
82
+ if (err instanceof _common.UnauthorizedException) throw err;
74
83
  }
75
- // Find user and check if active
76
- const user = await userRepository.findOne({
77
- where: {
78
- id: payload.id,
79
- isActive: true
80
- }
81
- });
82
- if (!user) {
83
- throw new _common.UnauthorizedException('User not found or inactive');
84
- }
85
- const result = {
84
+ }
85
+ buildUserInfo(payload) {
86
+ const base = {
86
87
  id: payload.id,
87
88
  email: payload.email
88
89
  };
89
- // Company context - use type guard for type safety
90
- if (isTokenPayloadWithCompany(payload)) {
91
- result.companyId = payload.companyId;
92
- // Only set branchId if it's not empty string
93
- if (payload.branchId) {
94
- result.branchId = payload.branchId;
95
- }
90
+ if (!hasCompanyContext(payload)) {
91
+ return base;
96
92
  }
97
- return result;
93
+ return {
94
+ ...base,
95
+ companyId: payload.companyId,
96
+ ...payload.branchId && {
97
+ branchId: payload.branchId
98
+ }
99
+ };
98
100
  }
99
101
  constructor(authConfig, moduleRef){
100
102
  super({
101
103
  jwtFromRequest: _passportjwt.ExtractJwt.fromAuthHeaderAsBearerToken(),
102
104
  ignoreExpiration: false,
103
- // Use secretOrKeyProvider instead of secretOrKey to defer secret lookup
104
- // This ensures AuthConfigService is fully initialized when using forRootAsync
105
- secretOrKeyProvider: (_request, _rawJwtToken, done)=>{
105
+ secretOrKeyProvider: (_req, _token, done)=>{
106
106
  done(null, this.authConfig.getJwtSecret());
107
107
  },
108
108
  passReqToCallback: true
@@ -1,7 +1,7 @@
1
+ import { MessageResponseDto } from '@flusys/nestjs-shared/dtos';
1
2
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
2
3
  import { Request } from 'express';
3
- import { ChangePasswordDto, CompanySelectionResponseDto, ForgotPasswordDto, LoginDto, LoginResponseDto, MeResponseDto, RefreshTokenDto, RegistrationDto, RegistrationResponseDto, ResendVerificationDto, ResetPasswordDto, VerifyEmailDto } from '../dtos/authentication.dto';
4
- import { MessageResponseDto } from '@flusys/nestjs-shared/dtos';
4
+ import { ChangePasswordDto, CompanySelectionResponseDto, ForgotPasswordDto, LoginDto, LoginResponseDto, LoginResponseRequiresEmailVerificationDto, MeResponseDto, RefreshTokenDto, RegistrationDto, RegistrationResponseDto, ResendVerificationDto, ResetPasswordDto, VerifyEmailDto } from '../dtos/authentication.dto';
5
5
  import { AuthConfigService } from '../services/auth-config.service';
6
6
  import { AuthEmailService } from '../services/auth-email.service';
7
7
  import { AuthenticationService } from '../services/authentication.service';
@@ -11,7 +11,9 @@ export declare class AuthenticationController {
11
11
  private readonly authEmailService?;
12
12
  constructor(authService: AuthenticationService, authConfig?: AuthConfigService, authEmailService?: AuthEmailService);
13
13
  private buildAuthUrl;
14
- login(loginDto: LoginDto): Promise<LoginResponseDto | CompanySelectionResponseDto>;
14
+ private get emailService();
15
+ private get isEmailEnabled();
16
+ login(loginDto: LoginDto): Promise<LoginResponseDto | CompanySelectionResponseDto | LoginResponseRequiresEmailVerificationDto>;
15
17
  register(req: Request, registrationDto: RegistrationDto): Promise<RegistrationResponseDto>;
16
18
  refreshToken(req: Request, refreshTokenDto: RefreshTokenDto): Promise<{
17
19
  accessToken: string;
@@ -1,8 +1,8 @@
1
- import { AssignUserCompanyDto, AssignUserBranchDto, UserCompaniesResponseDto, UserBranchesResponseDto } from '../dtos/user-permission.dto';
1
+ import { AssignUserBranchDto, AssignUserCompanyDto, UserBranchesResponseDto, UserCompaniesResponseDto } from '../dtos/user-permission.dto';
2
2
  import { UserPermissionService } from '../services/user-permission.service';
3
3
  export declare class UserPermissionController {
4
- private readonly userPermissionService;
5
- constructor(userPermissionService: UserPermissionService);
4
+ private readonly permissionService;
5
+ constructor(permissionService: UserPermissionService);
6
6
  assignUserCompany(dto: AssignUserCompanyDto): Promise<{
7
7
  success: boolean;
8
8
  message: string;
@@ -12,5 +12,6 @@ export declare class UserPermissionController {
12
12
  success: boolean;
13
13
  message: string;
14
14
  }>;
15
- getUserBranches(userId: string): Promise<UserBranchesResponseDto>;
15
+ getUserBranches(userId: string, companyId?: string): Promise<UserBranchesResponseDto>;
16
+ private processBatchPermissions;
16
17
  }
@@ -51,14 +51,12 @@ export declare class BranchSelectionInfoDto {
51
51
  id: string;
52
52
  name: string;
53
53
  slug: string;
54
- isActive: boolean;
55
54
  logoId?: string | null;
56
55
  }
57
56
  export declare class CompanyWithBranchesDto {
58
57
  id: string;
59
58
  name: string;
60
59
  slug: string;
61
- isActive: boolean;
62
60
  logoId?: string | null;
63
61
  branches: BranchSelectionInfoDto[];
64
62
  }
@@ -68,7 +66,6 @@ export declare class LoginResponseDto {
68
66
  user: UserInfoDto;
69
67
  company?: CompanyInfoDto;
70
68
  branch?: BranchInfoDto;
71
- companyFeatureEnabled?: boolean;
72
69
  }
73
70
  export declare class RegistrationResponseDto {
74
71
  accessToken?: string;
@@ -76,7 +73,6 @@ export declare class RegistrationResponseDto {
76
73
  user: UserInfoDto;
77
74
  company?: CompanyInfoDto;
78
75
  branch?: BranchInfoDto;
79
- companyFeatureEnabled?: boolean;
80
76
  requiresEmailVerification?: boolean;
81
77
  }
82
78
  export declare class MeResponseDto {
package/dtos/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './authentication.dto';
2
2
  export * from './company-branch.dto';
3
3
  export * from './company.dto';
4
- export * from './user-company-permission.dto';
5
4
  export * from './user.dto';
6
5
  export * from './user-permission.dto';
@@ -10,7 +10,7 @@ import { PendingRegistration } from './pending-registration.entity';
10
10
  import { UserCompanyPermission } from './user-company-permission.entity';
11
11
  import { User } from './user.entity';
12
12
  import { UserToken } from './user-token.entity';
13
- export declare const CoreEntities: (typeof PendingRegistration | typeof User | typeof UserToken)[];
13
+ export declare const CoreEntities: (typeof PendingRegistration | typeof UserToken | typeof User)[];
14
14
  export declare const CompanyEntities: (typeof Company | typeof CompanyBranch | typeof UserCompanyPermission)[];
15
- export declare const AllEntities: (typeof Company | typeof CompanyBranch | typeof PendingRegistration | typeof User | typeof UserCompanyPermission | typeof UserToken)[];
16
- export declare function getEntitiesByConfig(enableCompanyFeature: boolean): (typeof Company | typeof CompanyBranch | typeof PendingRegistration | typeof User | typeof UserCompanyPermission | typeof UserToken)[];
15
+ export declare const AllEntities: (typeof PendingRegistration | typeof UserToken | typeof User | typeof Company | typeof CompanyBranch | typeof UserCompanyPermission)[];
16
+ export declare function getEntitiesByConfig(enableCompanyFeature: boolean): (typeof PendingRegistration | typeof UserToken | typeof User | typeof Company | typeof CompanyBranch | typeof UserCompanyPermission)[];
@@ -7,7 +7,7 @@ export declare class UserCompanyPermission {
7
7
  id: string;
8
8
  userId: string;
9
9
  user?: User;
10
- permissionType: PermissionType;
10
+ permissionType: string;
11
11
  targetId: string;
12
12
  metadata?: Record<string, any>;
13
13
  isActive: boolean;