rez_core 1.0.62 → 1.0.64

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 (80) hide show
  1. package/.idea/250218_nodejs_core.iml +12 -0
  2. package/.idea/codeStyles/Project.xml +59 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/dataSources.xml +12 -0
  5. package/.idea/modules.xml +8 -0
  6. package/.idea/prettier.xml +6 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/dist/constant/global.constant.d.ts +3 -0
  9. package/dist/constant/global.constant.js +4 -1
  10. package/dist/constant/global.constant.js.map +1 -1
  11. package/dist/module/auth/guards/role.guard.js +3 -3
  12. package/dist/module/listmaster/controller/list-master.controller.d.ts +1 -1
  13. package/dist/module/listmaster/controller/list-master.controller.js +3 -4
  14. package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
  15. package/dist/module/listmaster/service/list-master.service.d.ts +4 -2
  16. package/dist/module/listmaster/service/list-master.service.js +16 -14
  17. package/dist/module/listmaster/service/list-master.service.js.map +1 -1
  18. package/dist/module/meta/controller/meta.controller.d.ts +7 -0
  19. package/dist/module/meta/controller/meta.controller.js +47 -0
  20. package/dist/module/meta/controller/meta.controller.js.map +1 -0
  21. package/dist/module/meta/dto/entity-table.dto.d.ts +5 -0
  22. package/dist/module/meta/dto/entity-table.dto.js +8 -0
  23. package/dist/module/meta/dto/entity-table.dto.js.map +1 -0
  24. package/dist/module/meta/entity.module.js +2 -1
  25. package/dist/module/meta/entity.module.js.map +1 -1
  26. package/dist/module/meta/repository/entity-table-column.repository.js +1 -0
  27. package/dist/module/meta/repository/entity-table-column.repository.js.map +1 -1
  28. package/dist/module/meta/service/entity-table.service.d.ts +6 -1
  29. package/dist/module/meta/service/entity-table.service.js +18 -2
  30. package/dist/module/meta/service/entity-table.service.js.map +1 -1
  31. package/dist/module/user/entity/role.entity.d.ts +1 -0
  32. package/dist/module/user/entity/role.entity.js +5 -0
  33. package/dist/module/user/entity/role.entity.js.map +1 -1
  34. package/dist/module/user/repository/role.repository.d.ts +2 -35
  35. package/dist/module/user/repository/role.repository.js +2 -95
  36. package/dist/module/user/repository/role.repository.js.map +1 -1
  37. package/dist/module/user/service/role.service.d.ts +5 -32
  38. package/dist/module/user/service/role.service.js +71 -24
  39. package/dist/module/user/service/role.service.js.map +1 -1
  40. package/dist/module/user/user.module.js +8 -3
  41. package/dist/module/user/user.module.js.map +1 -1
  42. package/dist/tsconfig.build.tsbuildinfo +1 -1
  43. package/package.json +1 -1
  44. package/src/app.controller.ts +12 -12
  45. package/src/app.service.ts +8 -8
  46. package/src/constant/global.constant.ts +5 -0
  47. package/src/module/auth/guards/jwt.guard.ts +22 -22
  48. package/src/module/auth/guards/role.guard.ts +68 -68
  49. package/src/module/auth/services/jwt.service.ts +11 -11
  50. package/src/module/auth/strategies/local.strategy.ts +13 -13
  51. package/src/module/dev/dev.module.ts +12 -12
  52. package/src/module/dev/service/dev.service.ts +7 -7
  53. package/src/module/enterprise/entity/organization.entity.ts +80 -80
  54. package/src/module/listmaster/controller/list-master.controller.ts +2 -2
  55. package/src/module/listmaster/service/list-master.service.ts +18 -15
  56. package/src/module/meta/controller/meta.controller.ts +22 -0
  57. package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
  58. package/src/module/meta/dto/entity-table.dto.ts +6 -0
  59. package/src/module/meta/entity/preference.entity.ts +65 -65
  60. package/src/module/meta/entity.module.ts +2 -1
  61. package/src/module/meta/repository/entity-table-column.repository.ts +1 -0
  62. package/src/module/meta/repository/preference.repository.ts +20 -20
  63. package/src/module/meta/service/entity-table.service.ts +43 -3
  64. package/src/module/module/controller/menu.controller.ts +15 -15
  65. package/src/module/module/entity/module-access.entity.ts +22 -22
  66. package/src/module/user/controller/user.controller.ts +28 -28
  67. package/src/module/user/dto/update-user.dto.ts +4 -4
  68. package/src/module/user/entity/role.entity.ts +4 -0
  69. package/src/module/user/entity/user-session.entity.ts +61 -61
  70. package/src/module/user/repository/role.repository.ts +2 -142
  71. package/src/module/user/repository/userSession.repository.ts +33 -33
  72. package/src/module/user/service/role.service.ts +92 -42
  73. package/src/module/user/user.module.ts +8 -3
  74. package/src/utils/service/encryptUtil.service.ts +97 -97
  75. package/src/utils/service/excelUtil.service.ts +15 -15
  76. package/src/utils/service/reflection-helper.service.ts +53 -53
  77. package/dist/module/user/controller/role.controller.d.ts +0 -41
  78. package/dist/module/user/controller/role.controller.js +0 -63
  79. package/dist/module/user/controller/role.controller.js.map +0 -1
  80. package/src/module/user/controller/role.controller.ts +0 -55
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "1.0.62",
3
+ "version": "1.0.64",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,12 +1,12 @@
1
- import { Controller, Get } from '@nestjs/common';
2
- import { AppService } from './app.service';
3
-
4
- @Controller()
5
- export class AppController {
6
- constructor(private readonly appService: AppService) {}
7
-
8
- @Get()
9
- getHello(): string {
10
- return this.appService.getHello();
11
- }
12
- }
1
+ import { Controller, Get } from '@nestjs/common';
2
+ import { AppService } from './app.service';
3
+
4
+ @Controller()
5
+ export class AppController {
6
+ constructor(private readonly appService: AppService) {}
7
+
8
+ @Get()
9
+ getHello(): string {
10
+ return this.appService.getHello();
11
+ }
12
+ }
@@ -1,8 +1,8 @@
1
- import { Injectable } from '@nestjs/common';
2
-
3
- @Injectable()
4
- export class AppService {
5
- getHello(): string {
6
- return 'Hello World!';
7
- }
8
- }
1
+ import { Injectable } from '@nestjs/common';
2
+
3
+ @Injectable()
4
+ export class AppService {
5
+ getHello(): string {
6
+ return 'Hello World!';
7
+ }
8
+ }
@@ -28,3 +28,8 @@ export const STATUS_PENDING = 'PENDING';
28
28
  // Entity Status
29
29
  export const ENTITYSTATUS_TO_BE_PUBLISHED = 'to_be_published';
30
30
  export const ENTITYSTATUS_PUBLISHED = 'published';
31
+
32
+ // Display Type
33
+ export const DISPLAY_LIST = 'LIST';
34
+ export const DISPLAY_EXPORT = 'EXPORT';
35
+ export const DISPLAY_REPORT = 'REPORT';
@@ -1,22 +1,22 @@
1
- import { ExecutionContext, Injectable } from '@nestjs/common';
2
- import { AuthGuard } from '@nestjs/passport';
3
- import { Reflector } from '@nestjs/core';
4
- import { Observable } from 'rxjs';
5
-
6
- @Injectable()
7
- export class JwtAuthGuard extends AuthGuard('jwt') {
8
- constructor(private reflector: Reflector) {
9
- super();
10
- }
11
-
12
- canActivate(
13
- context: ExecutionContext,
14
- ): Promise<boolean> | boolean | Observable<boolean> {
15
- const isPublic = this.reflector.getAllAndOverride('isPublic', [
16
- context.getHandler(),
17
- context.getClass(),
18
- ]);
19
- if (isPublic) return true;
20
- return super.canActivate(context);
21
- }
22
- }
1
+ import { ExecutionContext, Injectable } from '@nestjs/common';
2
+ import { AuthGuard } from '@nestjs/passport';
3
+ import { Reflector } from '@nestjs/core';
4
+ import { Observable } from 'rxjs';
5
+
6
+ @Injectable()
7
+ export class JwtAuthGuard extends AuthGuard('jwt') {
8
+ constructor(private reflector: Reflector) {
9
+ super();
10
+ }
11
+
12
+ canActivate(
13
+ context: ExecutionContext,
14
+ ): Promise<boolean> | boolean | Observable<boolean> {
15
+ const isPublic = this.reflector.getAllAndOverride('isPublic', [
16
+ context.getHandler(),
17
+ context.getClass(),
18
+ ]);
19
+ if (isPublic) return true;
20
+ return super.canActivate(context);
21
+ }
22
+ }
@@ -1,68 +1,68 @@
1
- import {
2
- CanActivate,
3
- ExecutionContext,
4
- ForbiddenException,
5
- Injectable,
6
- UnauthorizedException,
7
- } from '@nestjs/common';
8
- import { Reflector } from '@nestjs/core';
9
- import { UserData } from '../../user/entity/user.entity';
10
- import { InjectEntityManager } from '@nestjs/typeorm';
11
- import { EntityManager } from 'typeorm';
12
-
13
- @Injectable()
14
- export class RolesGuard implements CanActivate {
15
- constructor(
16
- private reflector: Reflector,
17
- @InjectEntityManager() private entityManager: EntityManager,
18
- ) {}
19
-
20
- async canActivate(context: ExecutionContext) {
21
- const request = context
22
- .switchToHttp()
23
- .getRequest<Request & { user: any }>();
24
- const object = request.user;
25
-
26
- const users: UserData = await this.entityManager.query(
27
- `SELECT * FROM cr_user WHERE id = ${object.userId} LIMIT 1`,
28
- );
29
-
30
- const user = users[0];
31
- if (!user || !user['role_id']) {
32
- throw new UnauthorizedException('User not authorized');
33
- }
34
-
35
- const requiredModule = this.reflector.get<string>(
36
- 'moduleCode',
37
- context.getHandler(),
38
- );
39
- const requiredActions = this.reflector.get<string>(
40
- 'actions',
41
- context.getHandler(),
42
- );
43
-
44
- const roleAccess = await this.entityManager.query(
45
- `SELECT *
46
- FROM cr_module_access
47
- WHERE role_id = ${user['role_id']}
48
- AND module_code = '${requiredModule}'`,
49
- );
50
-
51
- if (!roleAccess || roleAccess.length === 0) {
52
- throw new ForbiddenException(
53
- 'Access denied: No permissions found for this module',
54
- );
55
- }
56
-
57
- const hasAccess = roleAccess.some(
58
- (access) =>
59
- requiredActions.includes(access.action_type) &&
60
- access.access_flag === 1,
61
- );
62
-
63
- if (!hasAccess) {
64
- throw new ForbiddenException('Access denied: Insufficient permissions.');
65
- }
66
- return true;
67
- }
68
- }
1
+ import {
2
+ CanActivate,
3
+ ExecutionContext,
4
+ ForbiddenException,
5
+ Injectable,
6
+ UnauthorizedException,
7
+ } from '@nestjs/common';
8
+ import { Reflector } from '@nestjs/core';
9
+ import { UserData } from '../../user/entity/user.entity';
10
+ import { InjectEntityManager } from '@nestjs/typeorm';
11
+ import { EntityManager } from 'typeorm';
12
+
13
+ @Injectable()
14
+ export class RolesGuard implements CanActivate {
15
+ constructor(
16
+ private reflector: Reflector,
17
+ @InjectEntityManager() private entityManager: EntityManager,
18
+ ) {}
19
+
20
+ async canActivate(context: ExecutionContext) {
21
+ const request = context
22
+ .switchToHttp()
23
+ .getRequest<Request & { user: any }>();
24
+ const object = request.user;
25
+
26
+ const users: UserData = await this.entityManager.query(
27
+ `SELECT * FROM cr_user WHERE id = ${object.userId} LIMIT 1`,
28
+ );
29
+
30
+ const user = users[0];
31
+ if (!user || !user['role_id']) {
32
+ throw new UnauthorizedException('User not authorized');
33
+ }
34
+
35
+ const requiredModule = this.reflector.get<string>(
36
+ 'moduleCode',
37
+ context.getHandler(),
38
+ );
39
+ const requiredActions = this.reflector.get<string>(
40
+ 'actions',
41
+ context.getHandler(),
42
+ );
43
+
44
+ const roleAccess = await this.entityManager.query(
45
+ `SELECT *
46
+ FROM cr_module_access
47
+ WHERE role_id = ${user['role_id']}
48
+ AND module_code = '${requiredModule}'`,
49
+ );
50
+
51
+ if (!roleAccess || roleAccess.length === 0) {
52
+ throw new ForbiddenException(
53
+ 'Access denied: No permissions found for this module',
54
+ );
55
+ }
56
+
57
+ const hasAccess = roleAccess.some(
58
+ (access) =>
59
+ requiredActions.includes(access.action_type) &&
60
+ access.access_flag === 1,
61
+ );
62
+
63
+ if (!hasAccess) {
64
+ throw new ForbiddenException('Access denied: Insufficient permissions.');
65
+ }
66
+ return true;
67
+ }
68
+ }
@@ -1,11 +1,11 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { JwtService } from '@nestjs/jwt';
3
-
4
- @Injectable()
5
- export class JwtAuthService {
6
- constructor(private readonly jwtService: JwtService) {}
7
-
8
- generateJwt(payload: any): string {
9
- return this.jwtService.sign(payload);
10
- }
11
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { JwtService } from '@nestjs/jwt';
3
+
4
+ @Injectable()
5
+ export class JwtAuthService {
6
+ constructor(private readonly jwtService: JwtService) {}
7
+
8
+ generateJwt(payload: any): string {
9
+ return this.jwtService.sign(payload);
10
+ }
11
+ }
@@ -1,13 +1,13 @@
1
- import { PassportStrategy } from '@nestjs/passport';
2
- import { AuthService } from '../services/auth.service';
3
- import { Injectable } from '@nestjs/common';
4
- import { Strategy } from 'passport-jwt';
5
-
6
- @Injectable()
7
- export class LocalStrategy extends PassportStrategy(Strategy) {
8
- constructor(private authService: AuthService) {
9
- super({
10
- usernameField: 'email',
11
- });
12
- }
13
- }
1
+ import { PassportStrategy } from '@nestjs/passport';
2
+ import { AuthService } from '../services/auth.service';
3
+ import { Injectable } from '@nestjs/common';
4
+ import { Strategy } from 'passport-jwt';
5
+
6
+ @Injectable()
7
+ export class LocalStrategy extends PassportStrategy(Strategy) {
8
+ constructor(private authService: AuthService) {
9
+ super({
10
+ usernameField: 'email',
11
+ });
12
+ }
13
+ }
@@ -1,12 +1,12 @@
1
- import { Module } from '@nestjs/common';
2
- import { EntityModule } from '../meta/entity.module';
3
- import { UserModule } from '../user/user.module';
4
- import { ModuleModule } from '../module/module.module';
5
- import { DevService } from './service/dev.service';
6
-
7
- @Module({
8
- imports: [EntityModule, UserModule, ModuleModule],
9
- controllers: [],
10
- providers: [DevService],
11
- })
12
- export class DevModule {}
1
+ import { Module } from '@nestjs/common';
2
+ import { EntityModule } from '../meta/entity.module';
3
+ import { UserModule } from '../user/user.module';
4
+ import { ModuleModule } from '../module/module.module';
5
+ import { DevService } from './service/dev.service';
6
+
7
+ @Module({
8
+ imports: [EntityModule, UserModule, ModuleModule],
9
+ controllers: [],
10
+ providers: [DevService],
11
+ })
12
+ export class DevModule {}
@@ -1,7 +1,7 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { UserService } from '../../user/service/user.service';
3
-
4
- @Injectable()
5
- export class DevService {
6
- constructor(private readonly userService: UserService) {}
7
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { UserService } from '../../user/service/user.service';
3
+
4
+ @Injectable()
5
+ export class DevService {
6
+ constructor(private readonly userService: UserService) {}
7
+ }
@@ -1,80 +1,80 @@
1
- import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
2
-
3
- @Entity({ name: 'cr_organization' })
4
- export class OrganizationData {
5
- @PrimaryGeneratedColumn({ name: 'id', type: 'int' })
6
- id: number;
7
-
8
- @Column({ name: 'enterprise_id', type: 'int' })
9
- enterprise_id: number;
10
-
11
- @Column({ name: 'code', nullable: true })
12
- code: string;
13
-
14
- @Column({ name: 'app_code', nullable: true })
15
- appCode: string;
16
-
17
- @Column({ name: 'name', nullable: true })
18
- name: string;
19
-
20
- @Column({ name: 'status', type: 'varchar', nullable: true })
21
- status: string;
22
-
23
- @Column({ name: 'seq_no', nullable: true })
24
- seq_no: number;
25
-
26
- @Column({ name: 'created_by', nullable: true })
27
- created_by: number;
28
-
29
- @Column({ name: 'modified_by', nullable: true })
30
- modified_by: number;
31
-
32
- @Column({ name: 'created_date', nullable: true })
33
- created_date: Date;
34
-
35
- @Column({ name: 'parent_id', nullable: true })
36
- parent_id: number;
37
-
38
- @Column({ name: 'modified_date', nullable: true })
39
- modified_date: Date;
40
-
41
- @Column({ name: 'contact_number', nullable: true })
42
- contact_number: string;
43
-
44
- @Column({ name: 'email', nullable: true })
45
- emailId: string;
46
-
47
- @Column({ name: 'entity_type', nullable: true })
48
- entity_type: string;
49
-
50
- @Column({ name: 'primary_contact_name', nullable: true })
51
- primary_contact_name: string;
52
-
53
- @Column({ name: 'address', nullable: true })
54
- address: string;
55
-
56
- @Column({ name: 'gstin', nullable: true })
57
- gstin: string;
58
-
59
- @Column({ name: 'company_pan_number', nullable: true })
60
- company_pan_number: string;
61
-
62
- @Column({ name: 'bankacc_benef_name', nullable: true })
63
- bankacc_benef_name: string;
64
-
65
- @Column({ name: 'bankacc_bank_name', nullable: true })
66
- bankacc_bank_name: string;
67
-
68
- @Column({ name: 'bankacc_account_number', nullable: true })
69
- bankaccAccountNumber: string;
70
-
71
- @Column({ name: 'bankacc_branch_IFSC', nullable: true })
72
- bankacc_account_number: string;
73
-
74
- @Column({
75
- name: 'organization_type',
76
- type: 'varchar',
77
- nullable: true,
78
- })
79
- organization_type: string;
80
- }
1
+ import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
2
+
3
+ @Entity({ name: 'cr_organization' })
4
+ export class OrganizationData {
5
+ @PrimaryGeneratedColumn({ name: 'id', type: 'int' })
6
+ id: number;
7
+
8
+ @Column({ name: 'enterprise_id', type: 'int' })
9
+ enterprise_id: number;
10
+
11
+ @Column({ name: 'code', nullable: true })
12
+ code: string;
13
+
14
+ @Column({ name: 'app_code', nullable: true })
15
+ appCode: string;
16
+
17
+ @Column({ name: 'name', nullable: true })
18
+ name: string;
19
+
20
+ @Column({ name: 'status', type: 'varchar', nullable: true })
21
+ status: string;
22
+
23
+ @Column({ name: 'seq_no', nullable: true })
24
+ seq_no: number;
25
+
26
+ @Column({ name: 'created_by', nullable: true })
27
+ created_by: number;
28
+
29
+ @Column({ name: 'modified_by', nullable: true })
30
+ modified_by: number;
31
+
32
+ @Column({ name: 'created_date', nullable: true })
33
+ created_date: Date;
34
+
35
+ @Column({ name: 'parent_id', nullable: true })
36
+ parent_id: number;
37
+
38
+ @Column({ name: 'modified_date', nullable: true })
39
+ modified_date: Date;
40
+
41
+ @Column({ name: 'contact_number', nullable: true })
42
+ contact_number: string;
43
+
44
+ @Column({ name: 'email', nullable: true })
45
+ emailId: string;
46
+
47
+ @Column({ name: 'entity_type', nullable: true })
48
+ entity_type: string;
49
+
50
+ @Column({ name: 'primary_contact_name', nullable: true })
51
+ primary_contact_name: string;
52
+
53
+ @Column({ name: 'address', nullable: true })
54
+ address: string;
55
+
56
+ @Column({ name: 'gstin', nullable: true })
57
+ gstin: string;
58
+
59
+ @Column({ name: 'company_pan_number', nullable: true })
60
+ company_pan_number: string;
61
+
62
+ @Column({ name: 'bankacc_benef_name', nullable: true })
63
+ bankacc_benef_name: string;
64
+
65
+ @Column({ name: 'bankacc_bank_name', nullable: true })
66
+ bankacc_bank_name: string;
67
+
68
+ @Column({ name: 'bankacc_account_number', nullable: true })
69
+ bankaccAccountNumber: string;
70
+
71
+ @Column({ name: 'bankacc_branch_IFSC', nullable: true })
72
+ bankacc_account_number: string;
73
+
74
+ @Column({
75
+ name: 'organization_type',
76
+ type: 'varchar',
77
+ nullable: true,
78
+ })
79
+ organization_type: string;
80
+ }
@@ -7,7 +7,7 @@ export class ListMasterController {
7
7
 
8
8
  @Post('/getDropdownData/:type')
9
9
  @HttpCode(HttpStatus.OK)
10
- async getDropdownData(@Param('type') type: string, @Body() params,@Query() query: Record<string, string>,) {
11
- return await this.service.getDropdownOptions(type, params,query);
10
+ async getDropdownData(@Param('type') type: string, @Body() params: Record<string, string>,) {
11
+ return await this.service.getDropdownOptions(type, params);
12
12
  }
13
13
  }
@@ -9,10 +9,12 @@ import { ListMasterRepository } from '../repository/list-master.repository';
9
9
  import { ApiRegistryService } from '../../third-party-module/service/api-registry.service';
10
10
  import { firstValueFrom } from 'rxjs';
11
11
  import { HttpService } from '@nestjs/axios';
12
+ import { EntityManager } from 'typeorm';
12
13
 
13
14
  @Injectable()
14
15
  export class ListMasterService extends EntityServiceImpl {
15
16
  constructor(
17
+ private readonly entityManager: EntityManager,
16
18
  private readonly listMasterRepo: ListMasterRepository,
17
19
  private readonly listItemsRepo: ListMasterItemsRepository,
18
20
  private readonly apiRegistryService: ApiRegistryService,
@@ -21,14 +23,14 @@ export class ListMasterService extends EntityServiceImpl {
21
23
  super();
22
24
  }
23
25
 
24
- async getDropdownOptions(type: string, params: Record<string, string>,option) {
26
+ async getDropdownOptions(type: string, params: Record<string, string>) {
25
27
  const config = await this.listMasterRepo.findByType(type);
26
28
 
27
29
  if (!config) throw new NotFoundException(`Type ${type} not found`);
28
30
 
29
31
  switch (config.source) {
30
32
  case 'entity':
31
- return this.fetchFromEntity(type,option);
33
+ return this.fetchFromEntity(type,params);
32
34
 
33
35
  case 'master':
34
36
  return this.listItemsRepo.findItemsByType(type);
@@ -41,24 +43,25 @@ export class ListMasterService extends EntityServiceImpl {
41
43
  }
42
44
  }
43
45
 
44
- private async fetchFromEntity(sourceList: string,option) {
46
+ private async fetchFromEntity(sourceList: string,params: Record<string, any>) {
45
47
  let result: { label: string; value: number }[] = [];
48
+ const argsObjectList: any[] = [];
46
49
  if (sourceList) {
47
50
  const entityMaster =
48
51
  await this.entityMasterService.getEntityData(sourceList);
49
52
 
50
- const filters: any = {};
51
- if (option?.onlyActive === 'true') {
52
- filters.status = 'ACTIVE';
53
- }
54
-
55
- const baseEntities = await super.getEntityList(entityMaster.mapped_entity_type,filters);
56
- baseEntities.forEach((entity) => {
57
- result.push({
58
- label: entity.name,
59
- value: parseInt(String(entity.id)),
60
- });
61
- });
53
+ let query = `SELECT * FROM ${entityMaster.db_table_name} WHERE 1=1 `;
54
+
55
+ for (let paramsKey in params) {
56
+ query += `AND ${paramsKey} = ? `;
57
+ argsObjectList.push(params[paramsKey]);
58
+ }
59
+
60
+
61
+ let results = await this.entityManager.query(query, argsObjectList);
62
+ results.forEach(r => {
63
+ result.push({ label: r['name'], value: r['id']});
64
+ })
62
65
  }
63
66
  return result;
64
67
  }
@@ -0,0 +1,22 @@
1
+ import { Controller, HttpStatus, Post, Query, Res, UseGuards } from '@nestjs/common';
2
+ import { EntityTableService } from '../service/entity-table.service';
3
+ import { Response } from 'express';
4
+ import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
5
+
6
+ @Controller('meta')
7
+ @UseGuards(JwtAuthGuard)
8
+ export class MetaController {
9
+ constructor(private readonly entityTableService: EntityTableService) {}
10
+
11
+ @Post('get-table-data')
12
+ async getTableMetaData(@Query('entity_type') entityType: string,
13
+ @Query('list_type') listType: string,
14
+ @Res() response: Response) {
15
+ let entityTableDto = await this.entityTableService.getTableMetaDataForListing(entityType, listType);
16
+ return response.status(HttpStatus.OK).json({
17
+ success: true,
18
+ data: entityTableDto,
19
+ message: 'Data fetch successfully!'
20
+ })
21
+ }
22
+ }
@@ -1,6 +1,6 @@
1
- import { EntityTab } from './entity-tab.dto';
2
-
3
- export class EntityListData {
4
- entity_list: any;
5
- entity_tabs: EntityTab[];
6
- }
1
+ import { EntityTab } from './entity-tab.dto';
2
+
3
+ export class EntityListData {
4
+ entity_list: any;
5
+ entity_tabs: EntityTab[];
6
+ }
@@ -0,0 +1,6 @@
1
+ import { EntityTable } from '../entity/entity-table.entity';
2
+ import { EntityTableColumn } from '../entity/entity-table-column.entity';
3
+
4
+ export class EntityTableDto extends EntityTable{
5
+ column_list: EntityTableColumn[];
6
+ }