@flusys/nestjs-auth 5.0.1 → 5.0.4

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 (32) hide show
  1. package/README.md +13 -14
  2. package/cjs/controllers/user-permission.controller.js +2 -2
  3. package/cjs/controllers/user.controller.js +5 -8
  4. package/cjs/entities/{user.entity.js → app-user.entity.js} +6 -6
  5. package/cjs/entities/index.js +2 -2
  6. package/cjs/entities/user-company-permission.entity.js +3 -3
  7. package/cjs/services/auth-config.service.js +3 -0
  8. package/cjs/services/auth-email.service.js +6 -6
  9. package/cjs/services/authentication.service.js +8 -8
  10. package/cjs/services/user.service.js +117 -54
  11. package/cjs/strategies/jwt.strategy.js +2 -2
  12. package/entities/{user.entity.d.ts → app-user.entity.d.ts} +1 -1
  13. package/entities/index.d.ts +4 -4
  14. package/entities/user-company-permission.entity.d.ts +2 -2
  15. package/fesm/controllers/user-permission.controller.js +3 -3
  16. package/fesm/controllers/user.controller.js +6 -9
  17. package/fesm/entities/{user.entity.js → app-user.entity.js} +4 -4
  18. package/fesm/entities/index.js +3 -3
  19. package/fesm/entities/user-company-permission.entity.js +3 -3
  20. package/fesm/services/auth-config.service.js +3 -0
  21. package/fesm/services/auth-email.service.js +6 -6
  22. package/fesm/services/authentication.service.js +8 -8
  23. package/fesm/services/branch.service.js +1 -1
  24. package/fesm/services/company.service.js +1 -1
  25. package/fesm/services/user.service.js +118 -55
  26. package/fesm/strategies/jwt.strategy.js +2 -2
  27. package/interfaces/user-enricher.interface.d.ts +1 -5
  28. package/package.json +3 -3
  29. package/services/auth-config.service.d.ts +1 -0
  30. package/services/branch.service.d.ts +4 -4
  31. package/services/company.service.d.ts +3 -3
  32. package/services/user.service.d.ts +16 -11
@@ -1,12 +1,12 @@
1
- import { RequestScopedApiService, HybridCache } from '@flusys/nestjs-shared/classes';
1
+ import { HybridCache, RequestScopedApiService } 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 { EntityTarget, Repository, SelectQueryBuilder } from 'typeorm';
4
+ import { EntityTarget, SelectQueryBuilder } from 'typeorm';
5
5
  import { CreateCompanyDto, UpdateCompanyDto } from '../dtos/company.dto';
6
6
  import { Company } from '../entities/company.entity';
7
7
  import { ICompany } from '../interfaces/company.interface';
8
8
  import { AuthDataSourceProvider } from './auth-datasource.provider';
9
- export declare class CompanyService extends RequestScopedApiService<CreateCompanyDto, UpdateCompanyDto, ICompany, Company, Repository<Company>> {
9
+ export declare class CompanyService extends RequestScopedApiService<CreateCompanyDto, UpdateCompanyDto, ICompany, Company> {
10
10
  protected cacheManager: HybridCache;
11
11
  protected utilsService: UtilsService;
12
12
  private readonly dataSourceProvider;
@@ -2,14 +2,14 @@ import { HybridCache, RequestScopedApiService } from '@flusys/nestjs-shared/clas
2
2
  import { FilterAndPaginationDto } from '@flusys/nestjs-shared/dtos';
3
3
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
4
4
  import { UtilsService } from '@flusys/nestjs-shared/modules';
5
- import { EntityTarget, Repository, SelectQueryBuilder } from 'typeorm';
5
+ import { EntityTarget, SelectQueryBuilder } from 'typeorm';
6
6
  import { CreateUserDto, UpdateUserDto } from '../dtos/user.dto';
7
- import { User } from '../entities/user.entity';
7
+ import { AppUser } from '../entities/app-user.entity';
8
8
  import { IEnrichedUser, IProfileExtras, IProfileSection, IProfileSectionData, IUserEnricher } from '../interfaces/user-enricher.interface';
9
9
  import { IUser } from '../interfaces/user.interface';
10
10
  import { AuthConfigService } from './auth-config.service';
11
11
  import { AuthDataSourceProvider } from './auth-datasource.provider';
12
- export declare class UserService extends RequestScopedApiService<CreateUserDto, UpdateUserDto, IUser, User, Repository<User>> {
12
+ export declare class UserService extends RequestScopedApiService<CreateUserDto, UpdateUserDto, IUser, AppUser> {
13
13
  protected cacheManager: HybridCache;
14
14
  protected utilsService: UtilsService;
15
15
  private readonly dataSourceProvider;
@@ -17,25 +17,30 @@ export declare class UserService extends RequestScopedApiService<CreateUserDto,
17
17
  private readonly userEnricher?;
18
18
  private permissionRepository?;
19
19
  private dataSource?;
20
+ private readonly logAdapter;
20
21
  constructor(cacheManager: HybridCache, utilsService: UtilsService, dataSourceProvider: AuthDataSourceProvider, authConfig: AuthConfigService, userEnricher?: IUserEnricher);
21
- protected resolveEntity(): EntityTarget<User>;
22
+ protected resolveEntity(): EntityTarget<AppUser>;
22
23
  protected getDataSourceProvider(): AuthDataSourceProvider;
23
24
  protected ensureRepositoryInitialized(): Promise<void>;
24
25
  private getUserForProfile;
25
26
  verifyEmail(id: string): Promise<void>;
26
27
  verifyPhone(id: string): Promise<void>;
27
28
  updateStatus(id: string, isActive: boolean, user?: ILoggedUserInfo | null): Promise<void>;
28
- protected convertSingleDtoToEntity(dto: CreateUserDto | UpdateUserDto, user: ILoggedUserInfo | null): Promise<User>;
29
- protected convertEntityToResponseDto(entity: User, isRaw: boolean): IUser;
29
+ protected convertSingleDtoToEntity(dto: CreateUserDto | UpdateUserDto, user: ILoggedUserInfo | null): Promise<AppUser>;
30
+ protected convertEntityToResponseDto(entity: AppUser, isRaw: boolean): IUser;
30
31
  private convertRawToResponseDto;
31
32
  private convertEntityToDto;
32
- protected convertEntityListToResponseListDto(entities: User[], isRaw: boolean): IUser[];
33
- protected getGlobalSearchQuery(query: SelectQueryBuilder<User>, search: string, _user: ILoggedUserInfo | null): Promise<{
34
- query: SelectQueryBuilder<User>;
33
+ protected convertEntityListToResponseListDto(entities: AppUser[], isRaw: boolean): IUser[];
34
+ protected getFilterQuery(query: SelectQueryBuilder<AppUser>, filter: Record<string, unknown>, _user: ILoggedUserInfo | null): Promise<{
35
+ query: SelectQueryBuilder<AppUser>;
35
36
  isRaw: boolean;
36
37
  }>;
37
- protected getExtraManipulateQuery(query: SelectQueryBuilder<User>, filterAndPaginationDto: FilterAndPaginationDto, user: ILoggedUserInfo | null): Promise<{
38
- query: SelectQueryBuilder<User>;
38
+ protected getGlobalSearchQuery(query: SelectQueryBuilder<AppUser>, search: string, _user: ILoggedUserInfo | null): Promise<{
39
+ query: SelectQueryBuilder<AppUser>;
40
+ isRaw: boolean;
41
+ }>;
42
+ protected getExtraManipulateQuery(query: SelectQueryBuilder<AppUser>, filterAndPaginationDto: FilterAndPaginationDto, user: ILoggedUserInfo | null): Promise<{
43
+ query: SelectQueryBuilder<AppUser>;
39
44
  isRaw: boolean;
40
45
  }>;
41
46
  insert(dto: CreateUserDto, user: ILoggedUserInfo | null): Promise<IUser>;