@flusys/nestjs-auth 0.1.0-beta.2 → 1.0.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.
Files changed (38) hide show
  1. package/README.md +1 -11
  2. package/cjs/config/auth.constants.js +10 -4
  3. package/cjs/controllers/authentication.controller.js +7 -32
  4. package/cjs/controllers/branch.controller.js +3 -4
  5. package/cjs/controllers/company.controller.js +3 -4
  6. package/cjs/controllers/user-permission.controller.js +6 -18
  7. package/cjs/controllers/user.controller.js +17 -22
  8. package/cjs/interfaces/authentication.interface.js +0 -3
  9. package/cjs/services/auth-config.service.js +18 -44
  10. package/cjs/services/auth-datasource.provider.js +13 -31
  11. package/cjs/services/authentication.service.js +80 -85
  12. package/cjs/services/branch.service.js +10 -44
  13. package/cjs/services/company.service.js +7 -36
  14. package/cjs/services/user-permission.service.js +9 -27
  15. package/cjs/services/user.service.js +33 -91
  16. package/cjs/strategies/jwt.strategy.js +14 -1
  17. package/config/auth.constants.d.ts +2 -0
  18. package/fesm/config/auth.constants.js +7 -8
  19. package/fesm/controllers/authentication.controller.js +7 -32
  20. package/fesm/controllers/branch.controller.js +5 -6
  21. package/fesm/controllers/company.controller.js +5 -6
  22. package/fesm/controllers/user-permission.controller.js +6 -18
  23. package/fesm/controllers/user.controller.js +17 -22
  24. package/fesm/dtos/authentication.dto.js +17 -97
  25. package/fesm/interfaces/authentication.interface.js +1 -7
  26. package/fesm/services/auth-config.service.js +18 -44
  27. package/fesm/services/auth-datasource.provider.js +13 -31
  28. package/fesm/services/authentication.service.js +78 -83
  29. package/fesm/services/branch.service.js +11 -45
  30. package/fesm/services/company.service.js +8 -37
  31. package/fesm/services/user-permission.service.js +9 -27
  32. package/fesm/services/user.service.js +34 -92
  33. package/fesm/strategies/jwt.strategy.js +14 -1
  34. package/package.json +4 -4
  35. package/services/authentication.service.d.ts +6 -2
  36. package/services/branch.service.d.ts +2 -5
  37. package/services/company.service.d.ts +1 -4
  38. package/services/user.service.d.ts +1 -3
@@ -28,30 +28,22 @@ function _ts_param(paramIndex, decorator) {
28
28
  import { RequestScopedApiService, HybridCache } from '@flusys/nestjs-shared/classes';
29
29
  import { UtilsService } from '@flusys/nestjs-shared/modules';
30
30
  import { ErrorHandler } from '@flusys/nestjs-shared/utils';
31
- import { BadRequestException, Inject, Injectable, Logger, NotFoundException, Scope } from '@nestjs/common';
31
+ import { BadRequestException, Inject, Injectable, NotFoundException, Scope } from '@nestjs/common';
32
32
  import * as bcrypt from 'bcrypt';
33
33
  import { AuthConfigService } from './auth-config.service';
34
34
  import { AuthDataSourceProvider } from './auth-datasource.provider';
35
+ import { BCRYPT_SALT_ROUNDS } from '../config';
35
36
  import { PermissionType } from '../enums';
36
37
  import { UserCompanyPermission } from '../entities/user-company-permission.entity';
37
38
  import { User } from '../entities/user.entity';
38
39
  export class UserService extends RequestScopedApiService {
39
- /**
40
- * Resolve entity class for this service
41
- * @returns User entity class
42
- */ resolveEntity() {
40
+ resolveEntity() {
43
41
  return User;
44
42
  }
45
- /**
46
- * Get DataSource provider for this service
47
- * @returns AuthDataSourceProvider instance
48
- */ getDataSourceProvider() {
43
+ getDataSourceProvider() {
49
44
  return this.dataSourceProvider;
50
45
  }
51
- /**
52
- * Override ensureRepositoryInitialized to also initialize permission repository and dataSource
53
- * CRITICAL: Also initializes permissionRepository and dataSource for company feature support
54
- */ async ensureRepositoryInitialized() {
46
+ async ensureRepositoryInitialized() {
55
47
  await super.ensureRepositoryInitialized();
56
48
  // Initialize permission repository if company feature is enabled
57
49
  const isCompanyFeatureEnabled = this.authConfig.isCompanyFeatureEnabled();
@@ -65,26 +57,8 @@ export class UserService extends RequestScopedApiService {
65
57
  this.dataSource = await this.getDataSourceForService();
66
58
  }
67
59
  }
68
- // ==========================================================================
69
- // CUSTOM METHODS (Beyond RequestScopedApiService)
70
- // ==========================================================================
71
- /**
72
- * Update last login timestamp
73
- */ async updateLastLogin(id) {
74
- // Ensure repository is initialized for custom method
75
- await this.ensureRepositoryInitialized();
76
- await this.repository.update(id, {
77
- lastLoginAt: new Date()
78
- });
79
- await this.clearCacheForId([
80
- {
81
- id
82
- }
83
- ]);
84
- }
85
- /**
86
- * Verify email
87
- */ async verifyEmail(id) {
60
+ // Custom Methods
61
+ /** Verify email */ async verifyEmail(id) {
88
62
  // Ensure repository is initialized for custom method
89
63
  await this.ensureRepositoryInitialized();
90
64
  await this.repository.update(id, {
@@ -97,9 +71,7 @@ export class UserService extends RequestScopedApiService {
97
71
  }
98
72
  ]);
99
73
  }
100
- /**
101
- * Verify phone
102
- */ async verifyPhone(id) {
74
+ /** Verify phone */ async verifyPhone(id) {
103
75
  // Ensure repository is initialized for custom method
104
76
  await this.ensureRepositoryInitialized();
105
77
  await this.repository.update(id, {
@@ -112,12 +84,7 @@ export class UserService extends RequestScopedApiService {
112
84
  }
113
85
  ]);
114
86
  }
115
- /**
116
- * Update user status
117
- *
118
- * When company feature is disabled: Updates User.isActive directly
119
- * When company feature is enabled: Updates UserCompanyPermission.isActive for the logged user's company
120
- */ async updateStatus(id, isActive, user) {
87
+ /** Update user status. When company feature enabled, updates permission isActive for logged user's company. */ async updateStatus(id, isActive, user) {
121
88
  // Ensure repository is initialized for custom method
122
89
  await this.ensureRepositoryInitialized();
123
90
  const isCompanyFeatureEnabled = this.authConfig.isCompanyFeatureEnabled();
@@ -148,50 +115,43 @@ export class UserService extends RequestScopedApiService {
148
115
  }
149
116
  ]);
150
117
  }
151
- // ==========================================================================
152
- // APISERVICE OVERRIDES (Customize behavior)
153
- // ==========================================================================
154
- /**
155
- * Override: Convert DTO to entity (hash password before saving)
156
- */ async convertSingleDtoToEntity(dto, user) {
118
+ // ApiService Overrides
119
+ /** Convert DTO to entity (hash password before saving) */ async convertSingleDtoToEntity(dto, user) {
157
120
  // Repository initialization is handled automatically by RequestScopedApiService
158
121
  const entity = await super.convertSingleDtoToEntity(dto, user);
159
122
  // Hash password if provided
160
123
  if (dto.password) {
161
- entity.password = await bcrypt.hash(dto.password, 10);
124
+ entity.password = await bcrypt.hash(dto.password, BCRYPT_SALT_ROUNDS);
162
125
  }
163
126
  return entity;
164
127
  }
165
- /**
166
- * Override: Convert entity to response DTO (remove password!)
167
- *
168
- * When company feature is enabled and raw mode is used, isActive comes from
169
- * the permission table (user_companyIsActive). Otherwise, it comes from User entity.
170
- */ convertEntityToResponseDto(entity, isRaw) {
128
+ /** Convert entity to response DTO (removes password). In raw mode with company feature, isActive comes from permission table. */ convertEntityToResponseDto(entity, isRaw) {
171
129
  // When raw mode is used with company feature, isActive comes from computed field
172
- const isActive = isRaw && entity.user_companyIsActive !== undefined ? Boolean(entity.user_companyIsActive) : entity.isActive;
130
+ // Raw mode uses snake_case column names (due to SnakeNamingStrategy)
131
+ const isActive = isRaw && entity.user_companyIsActive !== undefined ? Boolean(entity.user_companyIsActive) : isRaw ? entity.user_is_active : entity.isActive;
173
132
  return {
174
133
  id: isRaw ? entity.user_id : entity.id,
175
134
  name: isRaw ? entity.user_name : entity.name,
176
135
  phone: isRaw ? entity.user_phone : entity.phone,
177
136
  email: isRaw ? entity.user_email : entity.email,
178
- profilePictureId: isRaw ? entity.user_profilePictureId : entity.profilePictureId,
137
+ profilePictureId: isRaw ? entity.user_profile_picture_id : entity.profilePictureId,
179
138
  isActive,
180
- emailVerified: isRaw ? entity.user_emailVerified : entity.emailVerified,
181
- phoneVerified: isRaw ? entity.user_phoneVerified : entity.phoneVerified,
182
- lastLoginAt: isRaw ? entity.user_lastLoginAt : entity.lastLoginAt,
183
- additionalFields: isRaw ? entity.user_additionalFields : entity.additionalFields,
184
- createdAt: isRaw ? entity.user_createdAt : entity.createdAt,
185
- updatedAt: isRaw ? entity.user_updatedAt : entity.updatedAt,
186
- deletedAt: isRaw ? entity.user_deletedAt : entity.deletedAt,
187
- createdById: isRaw ? entity.user_createdById : entity.createdById,
188
- updatedById: isRaw ? entity.user_updatedById : entity.updatedById,
189
- deletedById: isRaw ? entity.user_deletedById : entity.deletedById
139
+ emailVerified: isRaw ? entity.user_email_verified : entity.emailVerified,
140
+ phoneVerified: isRaw ? entity.user_phone_verified : entity.phoneVerified,
141
+ lastLoginAt: isRaw ? entity.user_last_login_at : entity.lastLoginAt,
142
+ additionalFields: isRaw ? entity.user_additional_fields : entity.additionalFields,
143
+ createdAt: isRaw ? entity.user_created_at : entity.createdAt,
144
+ updatedAt: isRaw ? entity.user_updated_at : entity.updatedAt,
145
+ deletedAt: isRaw ? entity.user_deleted_at : entity.deletedAt,
146
+ createdById: isRaw ? entity.user_created_by_id : entity.createdById,
147
+ updatedById: isRaw ? entity.user_updated_by_id : entity.updatedById,
148
+ deletedById: isRaw ? entity.user_deleted_by_id : entity.deletedById
190
149
  };
191
150
  }
192
- /**
193
- * Override: Global search - search by name, email, or phone
194
- */ async getGlobalSearchQuery(query, search, _user) {
151
+ /** Convert entity list to response DTO list */ convertEntityListToResponseListDto(entities, isRaw) {
152
+ return entities.map((entity)=>this.convertEntityToResponseDto(entity, isRaw));
153
+ }
154
+ /** Global search - search by name, email, or phone */ async getGlobalSearchQuery(query, search, _user) {
195
155
  query.andWhere('(user.name LIKE :search OR user.email LIKE :search OR user.phone LIKE :search)', {
196
156
  search: `%${search}%`
197
157
  });
@@ -200,16 +160,7 @@ export class UserService extends RequestScopedApiService {
200
160
  isRaw: false
201
161
  };
202
162
  }
203
- /**
204
- * Override: getExtraManipulateQuery - Add company permission-based isActive check when company feature enabled
205
- *
206
- * Note: When company feature is disabled at bootstrap, this method returns without modifications.
207
- * All company-related filtering is skipped, and users are returned normally with isActive from User entity.
208
- *
209
- * When company feature is enabled:
210
- * - isActive is computed from UserCompanyPermission table
211
- * - Returns isRaw: true to use raw query results
212
- */ async getExtraManipulateQuery(query, filterAndPaginationDto, user) {
163
+ /** Add company permission-based isActive check when company feature enabled. Returns isRaw: true for computed fields. */ async getExtraManipulateQuery(query, filterAndPaginationDto, user) {
213
164
  // Repository initialization is handled automatically by RequestScopedApiService
214
165
  const result = await super.getExtraManipulateQuery(query, filterAndPaginationDto, user);
215
166
  // Only apply company filtering if:
@@ -264,12 +215,7 @@ export class UserService extends RequestScopedApiService {
264
215
  }
265
216
  return result;
266
217
  }
267
- /**
268
- * Override: insert - Create company permission when company feature is enabled
269
- *
270
- * Note: When company feature is disabled at bootstrap, this method falls back to parent implementation.
271
- * No company permissions are created, and user is inserted normally.
272
- */ async insert(dto, user) {
218
+ /** Insert user. Creates company permission when company feature is enabled. */ async insert(dto, user) {
273
219
  // Repository initialization is handled automatically by RequestScopedApiService
274
220
  // Check if company feature is enabled
275
221
  const isCompanyFeatureEnabled = this.authConfig.isCompanyFeatureEnabled();
@@ -336,9 +282,7 @@ export class UserService extends RequestScopedApiService {
336
282
  await queryRunner.release();
337
283
  }
338
284
  }
339
- /**
340
- * Update user profile with password handling
341
- */ async profile(dto, user) {
285
+ /** Update user profile with password handling */ async profile(dto, user) {
342
286
  // Repository initialization is handled automatically by RequestScopedApiService
343
287
  if (!this.dataSource) {
344
288
  throw new BadRequestException('DataSource not available');
@@ -385,10 +329,8 @@ export class UserService extends RequestScopedApiService {
385
329
  await queryRunner.release();
386
330
  }
387
331
  }
388
- // NOTE: @Inject() required for bundled code - type metadata may be lost during esbuild
389
332
  constructor(cacheManager, utilsService, dataSourceProvider, authConfig){
390
- // Repository will be set asynchronously by RequestScopedApiService
391
- super('user', null, cacheManager, utilsService, UserService.name, true), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "dataSourceProvider", void 0), _define_property(this, "authConfig", void 0), _define_property(this, "logger", void 0), _define_property(this, "permissionRepository", void 0), _define_property(this, "dataSource", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.dataSourceProvider = dataSourceProvider, this.authConfig = authConfig, this.logger = new Logger(UserService.name);
333
+ super('user', null, cacheManager, utilsService, UserService.name, true), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "dataSourceProvider", void 0), _define_property(this, "authConfig", void 0), _define_property(this, "permissionRepository", void 0), _define_property(this, "dataSource", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.dataSourceProvider = dataSourceProvider, this.authConfig = authConfig;
392
334
  }
393
335
  }
394
336
  UserService = _ts_decorate([
@@ -26,6 +26,7 @@ import { PassportStrategy } from '@nestjs/passport';
26
26
  import { ExtractJwt, Strategy } from 'passport-jwt';
27
27
  import { AuthConfigService } from '../services/auth-config.service';
28
28
  import { AuthDataSourceProvider } from '../services/auth-datasource.provider';
29
+ import { AuthenticationService } from '../services/authentication.service';
29
30
  import { User } from '../entities/user.entity';
30
31
  /**
31
32
  * Type guard to check if payload includes company context
@@ -34,8 +35,9 @@ import { User } from '../entities/user.entity';
34
35
  }
35
36
  export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
36
37
  async validate(_req, payload) {
37
- // Resolve request-scoped AuthDataSourceProvider for this request
38
+ // Resolve request-scoped services for this request
38
39
  let userRepository = null;
40
+ let authService = null;
39
41
  try {
40
42
  const dataSourceProvider = await this.moduleRef.resolve(AuthDataSourceProvider, undefined, {
41
43
  strict: false
@@ -43,12 +45,23 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
43
45
  if (dataSourceProvider) {
44
46
  userRepository = await dataSourceProvider.getRepository(User);
45
47
  }
48
+ // Resolve AuthenticationService for token revocation check
49
+ authService = await this.moduleRef.resolve(AuthenticationService, undefined, {
50
+ strict: false
51
+ });
46
52
  } catch (error) {
47
53
  throw new UnauthorizedException('Unable to access user data');
48
54
  }
49
55
  if (!userRepository) {
50
56
  throw new UnauthorizedException('User repository not available');
51
57
  }
58
+ // Check if token is revoked (logged out)
59
+ if (authService && payload.iat) {
60
+ const isRevoked = await authService.isTokenRevoked(payload.id, payload.iat);
61
+ if (isRevoked) {
62
+ throw new UnauthorizedException('Token has been revoked');
63
+ }
64
+ }
52
65
  // Find user and check if active
53
66
  const user = await userRepository.findOne({
54
67
  where: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-auth",
3
- "version": "0.1.0-beta.2",
3
+ "version": "1.0.0-beta",
4
4
  "description": "Authentication and authorization infrastructure for NestJS applications",
5
5
  "main": "cjs/index.js",
6
6
  "module": "fesm/index.js",
@@ -81,7 +81,7 @@
81
81
  "@nestjs/passport": "^10.0.0 || ^11.0.0",
82
82
  "@nestjs/swagger": "^7.0.0 || ^11.0.0",
83
83
  "@nestjs/typeorm": "^10.0.0 || ^11.0.0",
84
- "bcrypt": "^5.0.0",
84
+ "bcrypt": "^5.0.0 || ^6.0.0",
85
85
  "class-transformer": "^0.5.0",
86
86
  "class-validator": "^0.14.0",
87
87
  "nodemailer": "^6.0.0",
@@ -91,7 +91,7 @@
91
91
  "typeorm": "^0.3.0"
92
92
  },
93
93
  "dependencies": {
94
- "@flusys/nestjs-core": "0.1.0-beta.2",
95
- "@flusys/nestjs-shared": "0.1.0-beta.2"
94
+ "@flusys/nestjs-core": "1.0.0-beta",
95
+ "@flusys/nestjs-shared": "1.0.0-beta"
96
96
  }
97
97
  }
@@ -3,6 +3,7 @@ import { Repository } from 'typeorm';
3
3
  import { AuthConfigService } from './auth-config.service';
4
4
  import { AuthDataSourceProvider } from './auth-datasource.provider';
5
5
  import { RegistrationDto } from '../dtos/authentication.dto';
6
+ import { HybridCache } from '@flusys/nestjs-shared/classes';
6
7
  import { LoginResponse, LoginResponseRequiresSelection, MeResponse } from '../interfaces/authentication.interface';
7
8
  import { CompanyBranch } from '../entities/company-branch.entity';
8
9
  import { Company } from '../entities/company.entity';
@@ -12,6 +13,7 @@ import { CompanySelectionSessionService } from './company-selection-session.serv
12
13
  export declare class AuthenticationService {
13
14
  private readonly jwtService;
14
15
  private readonly authConfig;
16
+ private readonly cacheManager?;
15
17
  private readonly dataSourceProvider?;
16
18
  private readonly sessionService?;
17
19
  private readonly injectedUserRepository?;
@@ -19,7 +21,7 @@ export declare class AuthenticationService {
19
21
  private readonly injectedCompanyRepository?;
20
22
  private readonly injectedBranchRepository?;
21
23
  private readonly logger;
22
- constructor(jwtService: JwtService, authConfig: AuthConfigService, dataSourceProvider?: AuthDataSourceProvider, sessionService?: CompanySelectionSessionService, injectedUserRepository?: Repository<User>, injectedPermissionRepository?: Repository<UserCompanyPermission>, injectedCompanyRepository?: Repository<Company>, injectedBranchRepository?: Repository<CompanyBranch>);
24
+ constructor(jwtService: JwtService, authConfig: AuthConfigService, cacheManager?: HybridCache, dataSourceProvider?: AuthDataSourceProvider, sessionService?: CompanySelectionSessionService, injectedUserRepository?: Repository<User>, injectedPermissionRepository?: Repository<UserCompanyPermission>, injectedCompanyRepository?: Repository<Company>, injectedBranchRepository?: Repository<CompanyBranch>);
23
25
  private getUserRepository;
24
26
  private getPermissionRepository;
25
27
  private getCompanyRepository;
@@ -36,7 +38,9 @@ export declare class AuthenticationService {
36
38
  refreshToken: string;
37
39
  }>;
38
40
  changePassword(userId: string, currentPassword: string, newPassword: string): Promise<void>;
39
- logout(_userId: string): Promise<void>;
41
+ logout(userId: string): Promise<void>;
42
+ isTokenRevoked(userId: string, tokenIssuedAt?: number): Promise<boolean>;
43
+ private parseExpiryToMs;
40
44
  getUserCompanies(userId: string): Promise<Company[]>;
41
45
  getUserBranches(userId: string, companyId: string): Promise<CompanyBranch[]>;
42
46
  getCompanyById(companyId: string): Promise<Company | null>;
@@ -1,7 +1,6 @@
1
1
  import { RequestScopedApiService, HybridCache } from '@flusys/nestjs-shared/classes';
2
2
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
3
3
  import { UtilsService } from '@flusys/nestjs-shared/modules';
4
- import { Logger } from '@nestjs/common';
5
4
  import { EntityTarget, Repository, SelectQueryBuilder } from 'typeorm';
6
5
  import { CreateCompanyBranchDto, UpdateCompanyBranchDto } from '../dtos/company-branch.dto';
7
6
  import { ICompanyBranch } from '../interfaces/company-branch.interface';
@@ -13,20 +12,18 @@ export declare class BranchService extends RequestScopedApiService<CreateCompany
13
12
  protected utilsService: UtilsService;
14
13
  private readonly dataSourceProvider;
15
14
  private readonly authConfig;
16
- protected logger: Logger;
17
15
  constructor(cacheManager: HybridCache, utilsService: UtilsService, dataSourceProvider: AuthDataSourceProvider, authConfig: AuthConfigService);
18
16
  protected resolveEntity(): EntityTarget<CompanyBranch>;
19
17
  protected getDataSourceProvider(): AuthDataSourceProvider;
20
- convertSingleDtoToEntity(dto: CreateCompanyBranchDto | UpdateCompanyBranchDto, _user: ILoggedUserInfo): Promise<CompanyBranch>;
21
18
  getSelectQuery(query: SelectQueryBuilder<CompanyBranch>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
22
19
  query: SelectQueryBuilder<CompanyBranch>;
23
20
  isRaw: boolean;
24
21
  }>;
25
- protected getGlobalSearchQuery(query: SelectQueryBuilder<CompanyBranch>, search: string, _user: ILoggedUserInfo | null): Promise<{
22
+ protected getGlobalSearchQuery(query: SelectQueryBuilder<CompanyBranch>, search: string): Promise<{
26
23
  query: SelectQueryBuilder<CompanyBranch>;
27
24
  isRaw: boolean;
28
25
  }>;
29
- protected getExtraManipulateQuery(query: SelectQueryBuilder<CompanyBranch>, _filterAndPaginationDto: any, user: ILoggedUserInfo | null): Promise<{
26
+ protected getExtraManipulateQuery(query: SelectQueryBuilder<CompanyBranch>, filterDto: any, user: ILoggedUserInfo | null): Promise<{
30
27
  query: SelectQueryBuilder<CompanyBranch>;
31
28
  isRaw: boolean;
32
29
  }>;
@@ -1,7 +1,6 @@
1
1
  import { RequestScopedApiService, HybridCache } from '@flusys/nestjs-shared/classes';
2
2
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
3
3
  import { UtilsService } from '@flusys/nestjs-shared/modules';
4
- import { Logger } from '@nestjs/common';
5
4
  import { EntityTarget, Repository, SelectQueryBuilder } from 'typeorm';
6
5
  import { CreateCompanyDto, UpdateCompanyDto } from '../dtos/company.dto';
7
6
  import { Company } from '../entities/company.entity';
@@ -11,16 +10,14 @@ export declare class CompanyService extends RequestScopedApiService<CreateCompan
11
10
  protected cacheManager: HybridCache;
12
11
  protected utilsService: UtilsService;
13
12
  private readonly dataSourceProvider;
14
- protected logger: Logger;
15
13
  constructor(cacheManager: HybridCache, utilsService: UtilsService, dataSourceProvider: AuthDataSourceProvider);
16
14
  protected resolveEntity(): EntityTarget<Company>;
17
15
  protected getDataSourceProvider(): AuthDataSourceProvider;
18
- convertSingleDtoToEntity(dto: CreateCompanyDto | UpdateCompanyDto, _user: ILoggedUserInfo): Promise<Company>;
19
16
  getSelectQuery(query: SelectQueryBuilder<Company>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
20
17
  query: SelectQueryBuilder<Company>;
21
18
  isRaw: boolean;
22
19
  }>;
23
- protected getGlobalSearchQuery(query: SelectQueryBuilder<Company>, search: string, _user: ILoggedUserInfo | null): Promise<{
20
+ protected getGlobalSearchQuery(query: SelectQueryBuilder<Company>, search: string): Promise<{
24
21
  query: SelectQueryBuilder<Company>;
25
22
  isRaw: boolean;
26
23
  }>;
@@ -1,7 +1,6 @@
1
1
  import { RequestScopedApiService, HybridCache } from '@flusys/nestjs-shared/classes';
2
2
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
3
3
  import { UtilsService } from '@flusys/nestjs-shared/modules';
4
- import { Logger } from '@nestjs/common';
5
4
  import { EntityTarget, Repository } from 'typeorm';
6
5
  import { AuthConfigService } from './auth-config.service';
7
6
  import { AuthDataSourceProvider } from './auth-datasource.provider';
@@ -13,19 +12,18 @@ export declare class UserService extends RequestScopedApiService<CreateUserDto,
13
12
  protected utilsService: UtilsService;
14
13
  private readonly dataSourceProvider;
15
14
  private readonly authConfig;
16
- protected logger: Logger;
17
15
  private permissionRepository?;
18
16
  private dataSource?;
19
17
  constructor(cacheManager: HybridCache, utilsService: UtilsService, dataSourceProvider: AuthDataSourceProvider, authConfig: AuthConfigService);
20
18
  protected resolveEntity(): EntityTarget<User>;
21
19
  protected getDataSourceProvider(): AuthDataSourceProvider;
22
20
  protected ensureRepositoryInitialized(): Promise<void>;
23
- updateLastLogin(id: string): Promise<void>;
24
21
  verifyEmail(id: string): Promise<void>;
25
22
  verifyPhone(id: string): Promise<void>;
26
23
  updateStatus(id: string, isActive: boolean, user?: ILoggedUserInfo | null): Promise<void>;
27
24
  protected convertSingleDtoToEntity(dto: CreateUserDto | UpdateUserDto, user: any): Promise<User>;
28
25
  protected convertEntityToResponseDto(entity: User, isRaw: boolean): IUser;
26
+ protected convertEntityListToResponseListDto(entities: User[], isRaw: boolean): IUser[];
29
27
  protected getGlobalSearchQuery(query: any, search: string, _user: any): Promise<{
30
28
  query: any;
31
29
  isRaw: boolean;