rez_core 1.0.88 → 1.0.89

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/dist/module/filter/controller/filter.controller.d.ts +13 -6
  2. package/dist/module/filter/controller/filter.controller.js +6 -2
  3. package/dist/module/filter/controller/filter.controller.js.map +1 -1
  4. package/dist/module/filter/dto/filter-request.dto.d.ts +2 -0
  5. package/dist/module/filter/entity/saved-filter-master.entity.d.ts +3 -0
  6. package/dist/module/filter/entity/saved-filter-master.entity.js +12 -0
  7. package/dist/module/filter/entity/saved-filter-master.entity.js.map +1 -1
  8. package/dist/module/filter/filter.module.js +1 -1
  9. package/dist/module/filter/filter.module.js.map +1 -1
  10. package/dist/module/filter/repository/saved-filter.repository.d.ts +8 -0
  11. package/dist/module/filter/repository/saved-filter.repository.js +24 -0
  12. package/dist/module/filter/repository/saved-filter.repository.js.map +1 -1
  13. package/dist/module/filter/service/filter.service.d.ts +20 -7
  14. package/dist/module/filter/service/filter.service.js +57 -16
  15. package/dist/module/filter/service/filter.service.js.map +1 -1
  16. package/dist/module/filter/service/saved-filter.service.js.map +1 -1
  17. package/dist/module/listmaster/listmaster.module.js +3 -2
  18. package/dist/module/listmaster/listmaster.module.js.map +1 -1
  19. package/dist/module/listmaster/service/list-master.service.d.ts +4 -3
  20. package/dist/module/listmaster/service/list-master.service.js +5 -4
  21. package/dist/module/listmaster/service/list-master.service.js.map +1 -1
  22. package/dist/module/meta/controller/meta.controller.d.ts +3 -1
  23. package/dist/module/meta/controller/meta.controller.js +6 -3
  24. package/dist/module/meta/controller/meta.controller.js.map +1 -1
  25. package/dist/module/meta/dto/entity-table.dto.d.ts +6 -0
  26. package/dist/module/meta/dto/entity-table.dto.js.map +1 -1
  27. package/dist/module/meta/entity.module.js +14 -4
  28. package/dist/module/meta/entity.module.js.map +1 -1
  29. package/dist/module/meta/repository/entity-table-column.repository.d.ts +1 -1
  30. package/dist/module/meta/repository/entity-table-column.repository.js +5 -5
  31. package/dist/module/meta/repository/entity-table-column.repository.js.map +1 -1
  32. package/dist/module/meta/service/attribute-master.service.d.ts +1 -1
  33. package/dist/module/meta/service/attribute-master.service.js.map +1 -1
  34. package/dist/module/meta/service/entity-table-column.service.d.ts +1 -1
  35. package/dist/module/meta/service/entity-table-column.service.js +2 -2
  36. package/dist/module/meta/service/entity-table-column.service.js.map +1 -1
  37. package/dist/module/meta/service/entity-table.service.d.ts +7 -3
  38. package/dist/module/meta/service/entity-table.service.js +22 -5
  39. package/dist/module/meta/service/entity-table.service.js.map +1 -1
  40. package/dist/module/module/entity/module.entity.d.ts +1 -0
  41. package/dist/module/module/entity/module.entity.js +4 -0
  42. package/dist/module/module/entity/module.entity.js.map +1 -1
  43. package/dist/tsconfig.build.tsbuildinfo +1 -1
  44. package/package.json +1 -1
  45. package/src/module/filter/controller/filter.controller.ts +8 -2
  46. package/src/module/filter/dto/filter-request.dto.ts +2 -0
  47. package/src/module/filter/entity/saved-filter-master.entity.ts +9 -0
  48. package/src/module/filter/filter.module.ts +2 -2
  49. package/src/module/filter/repository/saved-filter.repository.ts +33 -0
  50. package/src/module/filter/service/filter.service.ts +81 -15
  51. package/src/module/filter/service/saved-filter.service.ts +2 -0
  52. package/src/module/listmaster/listmaster.module.ts +4 -3
  53. package/src/module/listmaster/service/list-master.service.ts +3 -2
  54. package/src/module/meta/controller/meta.controller.ts +6 -3
  55. package/src/module/meta/dto/entity-table.dto.ts +4 -0
  56. package/src/module/meta/entity.module.ts +15 -6
  57. package/src/module/meta/repository/entity-table-column.repository.ts +9 -5
  58. package/src/module/meta/service/attribute-master.service.ts +9 -9
  59. package/src/module/meta/service/entity-table-column.service.ts +6 -1
  60. package/src/module/meta/service/entity-table.service.ts +24 -4
  61. package/src/module/module/entity/module.entity.ts +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "1.0.88",
3
+ "version": "1.0.89",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,4 +1,4 @@
1
- import { Controller, Post, Body } from '@nestjs/common';
1
+ import { Controller, Post, Body, Query, ParseIntPipe } from '@nestjs/common';
2
2
  import { FilterService } from '../service/filter.service';
3
3
 
4
4
  @Controller('filter')
@@ -6,7 +6,11 @@ export class FilterController {
6
6
  constructor(private readonly filterService: FilterService) {}
7
7
 
8
8
  @Post()
9
- async applyFilter(@Body() body: any) {
9
+ async applyFilter(
10
+ @Body() body: any,
11
+ @Query('page', ParseIntPipe) page: number = 1,
12
+ @Query('size', ParseIntPipe) size: number = 10,
13
+ ) {
10
14
  const {
11
15
  entity_type,
12
16
  quickFilter,
@@ -23,6 +27,8 @@ export class FilterController {
23
27
  attributeFilter,
24
28
  tabs,
25
29
  sortby,
30
+ page,
31
+ size,
26
32
  });
27
33
  }
28
34
  }
@@ -21,4 +21,6 @@ export interface FilterRequestDto {
21
21
  attributeFilter?: FilterCondition[];
22
22
  sortby?: SortConfig[];
23
23
  tabs?: TabsConfig;
24
+ page?: number;
25
+ size?: number;
24
26
  }
@@ -11,4 +11,13 @@ export class SavedFilterMaster extends BaseEntity {
11
11
 
12
12
  @Column({ length: 50, type: 'varchar', nullable: true })
13
13
  app_code: string;
14
+
15
+ @Column({ length: 50, type: 'varchar', nullable: true })
16
+ mapped_entity_type: string;
17
+
18
+ @Column({ type: 'int', nullable: true })
19
+ user_id: number;
20
+
21
+ @Column({ type: 'boolean', default: false })
22
+ is_default: boolean;
14
23
  }
@@ -1,4 +1,4 @@
1
- import { Module } from '@nestjs/common';
1
+ import { forwardRef, Module } from '@nestjs/common';
2
2
  import { TypeOrmModule } from '@nestjs/typeorm';
3
3
  import { SavedFilterService } from './service/saved-filter.service';
4
4
  import { SavedFilterDetail } from './entity/saved-filter-detail.entity';
@@ -9,7 +9,7 @@ import { FilterService } from './service/filter.service';
9
9
  import { FilterController } from './controller/filter.controller';
10
10
 
11
11
  @Module({
12
- imports: [TypeOrmModule.forFeature([SavedFilterDetail,SavedFilterMaster]),EntityModule],
12
+ imports: [TypeOrmModule.forFeature([SavedFilterDetail,SavedFilterMaster]),forwardRef(() => EntityModule)],
13
13
  controllers: [FilterController],
14
14
  providers: [
15
15
  { provide: 'SavedFilterService', useClass: SavedFilterService },
@@ -51,4 +51,37 @@ export class SavedFilterRepositoryService {
51
51
  await this.savedFilterMasterRepo.update(id, { code });
52
52
  }
53
53
 
54
+ async getDefaultFilterByEntityType(entityType: string): Promise<{ label: string; value: number } | null> {
55
+ const filter = await this.savedFilterMasterRepo.findOne({
56
+ where: {
57
+ mapped_entity_type: entityType,
58
+ is_default: true,
59
+ },
60
+ });
61
+
62
+ return filter ? { label: filter.name, value: filter.id } : null;
63
+ }
64
+
65
+ async getSavedFiltersByUserIdAndEntityType(
66
+ userId: number,
67
+ entityType: string
68
+ ){
69
+ const filters = await this.savedFilterMasterRepo.find({
70
+ where: {
71
+ user_id: userId,
72
+ mapped_entity_type: entityType,
73
+ },
74
+ order: {
75
+ modified_date: 'DESC',
76
+ },
77
+ });
78
+
79
+ return filters.map(filter => ({
80
+ label: filter.name,
81
+ value: filter.id,
82
+ }));
83
+ }
84
+
85
+
86
+
54
87
  }
@@ -4,6 +4,9 @@ import { EntityMasterService } from 'src/module/meta/service/entity-master.servi
4
4
  import { DataSource } from 'typeorm';
5
5
  import { SavedFilterService } from './saved-filter.service';
6
6
  import { FilterRequestDto } from '../dto/filter-request.dto';
7
+ import { EntityTableService } from 'src/module/meta/service/entity-table.service';
8
+ import { EntityTableColumnService } from 'src/module/meta/service/entity-table-column.service';
9
+ import { get } from 'http';
7
10
 
8
11
  @Injectable()
9
12
  export class FilterService {
@@ -11,11 +14,13 @@ export class FilterService {
11
14
  private dataSource: DataSource,
12
15
  private readonly entityMasterService: EntityMasterService,
13
16
  private readonly attributeMasterService: AttributeMasterService,
17
+ private readonly entityTableService: EntityTableService,
18
+ private readonly entityTableColumnService: EntityTableColumnService,
14
19
  @Inject('SavedFilterService')
15
20
  private readonly savedFilterService: SavedFilterService,
16
21
  ) {}
17
22
 
18
- private async getTabCounts(
23
+ private async gettab_value_counts(
19
24
  tableName: string,
20
25
  column: string | undefined,
21
26
  whereClauses: any[],
@@ -25,21 +30,21 @@ export class FilterService {
25
30
  const qb = this.dataSource
26
31
  .getRepository(tableName)
27
32
  .createQueryBuilder('e')
28
- .select(`e.${column}`, 'tabName')
29
- .addSelect('COUNT(*)', 'tabCount')
33
+ .select(`e.${column}`, 'tab_value')
34
+ .addSelect('COUNT(*)', 'tab_value_count')
30
35
  .groupBy(`e.${column}`);
31
36
 
32
37
  whereClauses.forEach((clause) => qb.andWhere(clause.query, clause.params));
33
38
 
34
39
  const rows = await qb.getRawMany();
35
40
 
36
- const total = rows.reduce((sum, r) => sum + parseInt(r.tabCount), 0);
41
+ const total = rows.reduce((sum, r) => sum + parseInt(r.tab_value_count), 0);
37
42
 
38
43
  return [
39
- { tabName: 'All', tabCount: total },
44
+ { tab_value: 'All', tab_value_count: total },
40
45
  ...rows.map((r) => ({
41
- tabName: r.tabName || 'UNKNOWN',
42
- tabCount: parseInt(r.tabCount),
46
+ tab_value: r.tab_value || 'UNKNOWN',
47
+ tab_value_count: parseInt(r.tab_value_count),
43
48
  })),
44
49
  ];
45
50
  }
@@ -61,11 +66,30 @@ export class FilterService {
61
66
  if (!tableName)
62
67
  throw new BadRequestException(`Invalid entity_type: ${entity_type}`);
63
68
 
64
- const attributeMeta =
65
- await this.attributeMasterService.findAttributesByMappedEntityType(
69
+ const getTableMeta =
70
+ await this.entityTableService.findByEntityTypeAndListTypeAndDisplayType(
66
71
  entity_type,
72
+ entity_type,
73
+ 'LIST',
74
+ );
75
+
76
+ if (!getTableMeta) {
77
+ throw new BadRequestException(
78
+ `Table meta not found for entity_type: ${entity_type}`,
67
79
  );
68
- const attributeMetaMap = attributeMeta.reduce(
80
+ }
81
+ const getTableColumnMeta =
82
+ await this.entityTableColumnService.findByParentIdAndParentType(
83
+ getTableMeta.id,
84
+ getTableMeta.entity_type,
85
+ true,
86
+ );
87
+
88
+ // const attributeMeta =
89
+ // await this.attributeMasterService.findAttributesByMappedEntityType(
90
+ // entity_type,
91
+ // );
92
+ const attributeMetaMap = getTableColumnMeta.reduce(
69
93
  (acc, attr) => {
70
94
  acc[attr.attribute_key] = attr;
71
95
  return acc;
@@ -83,7 +107,7 @@ export class FilterService {
83
107
  const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
84
108
 
85
109
  // Build query for tab counts (no tab.value filter here)
86
- const allTabs = await this.getTabCounts(
110
+ const allTabs = await this.gettab_value_counts(
87
111
  tableName,
88
112
  tabs?.columnName,
89
113
  baseWhere,
@@ -106,6 +130,7 @@ export class FilterService {
106
130
  }
107
131
  }
108
132
 
133
+ // Final query for filtered data
109
134
  // Final query for filtered data
110
135
  const qb = this.dataSource.getRepository(tableName).createQueryBuilder('e');
111
136
  dataWhere.forEach((clause) => qb.andWhere(clause.query, clause.params));
@@ -120,14 +145,26 @@ export class FilterService {
120
145
  });
121
146
  }
122
147
 
123
- const entity_list = await qb.getMany();
148
+ // Pagination
149
+ const page = dto.page && dto.page > 0 ? dto.page : 1;
150
+ const size = dto.size && dto.size > 0 ? dto.size : 10;
151
+ qb.skip((page - 1) * size).take(size);
152
+
153
+ const [entity_list, total] = await qb.getManyAndCount();
124
154
 
125
155
  return {
126
156
  success: true,
127
157
  data: {
128
158
  entity_tabs: allTabs,
129
159
  entity_list,
130
- pagination: [], // add pagination later if needed
160
+ pagination: {
161
+ total,
162
+ page,
163
+ size,
164
+ totalPages: Math.ceil(total / size),
165
+ hasNextPage: page * size < total,
166
+ hasPreviousPage: page > 1,
167
+ },
131
168
  },
132
169
  };
133
170
  }
@@ -181,13 +218,17 @@ export class FilterService {
181
218
  const op = filter.filter_operator;
182
219
  const key = `param_${attr}_${Math.random().toString(36).substring(2, 8)}`;
183
220
 
184
- switch (meta.db_datatype) {
185
- case 'varchar':
221
+ switch (meta.data_type) {
222
+ case 'text':
186
223
  return this.buildTextCondition(attr, op, val, key);
187
224
  case 'number':
188
225
  return this.buildNumberCondition(attr, op, val, key);
189
226
  case 'date':
190
227
  return this.buildDateCondition(attr, op, val, key);
228
+ case 'select':
229
+ return this.buildSelectCondition(attr, op, val, key);
230
+ case 'multiselect':
231
+ return this.buildMultiSelectCondition(attr, val, key);
191
232
  default:
192
233
  return null;
193
234
  }
@@ -257,4 +298,29 @@ export class FilterService {
257
298
  throw new BadRequestException(`Unsupported operator for date: ${op}`);
258
299
  }
259
300
  }
301
+
302
+ private buildSelectCondition(
303
+ attr: string,
304
+ op: string,
305
+ val: any,
306
+ key: string,
307
+ ) {
308
+ switch (op) {
309
+ case 'equal':
310
+ return { query: `e.${attr} = :${key}`, params: { [key]: val } };
311
+
312
+ default:
313
+ throw new BadRequestException(`Unsupported operator for select: ${op}`);
314
+ }
315
+ }
316
+
317
+ private buildMultiSelectCondition(attr: string, val: any[], key: string) {
318
+ if (!Array.isArray(val)) {
319
+ throw new BadRequestException(`Expected array for multiselect: ${attr}`);
320
+ }
321
+ return {
322
+ query: `e.${attr} IN (:...${key})`,
323
+ params: { [key]: val },
324
+ };
325
+ }
260
326
  }
@@ -98,4 +98,6 @@ export class SavedFilterService extends EntityServiceImpl {
98
98
  async getDetailsByCode(code: string): Promise<SavedFilterDetail[]> {
99
99
  return this.savedFilterRepo.getDetailsByCode(code);
100
100
  }
101
+
102
+
101
103
  }
@@ -1,4 +1,4 @@
1
- import { Module } from '@nestjs/common';
1
+ import { forwardRef, Module } from '@nestjs/common';
2
2
  import { TypeOrmModule } from '@nestjs/typeorm';
3
3
  import { ListMasterData } from './entity/list-master.entity';
4
4
  import { ListMasterItems } from './entity/list-master-items.entity';
@@ -11,8 +11,9 @@ import { ThirdPartyModule } from '../third-party-module/third-party.module';
11
11
  import { HttpModule } from '@nestjs/axios';
12
12
 
13
13
  @Module({
14
- imports: [TypeOrmModule.forFeature([ListMasterData, ListMasterItems]),EntityModule, ThirdPartyModule, HttpModule],
14
+ imports: [TypeOrmModule.forFeature([ListMasterData, ListMasterItems]),forwardRef(() => EntityModule), ThirdPartyModule, HttpModule],
15
15
  providers: [ListMasterRepository, ListMasterItemsRepository, ListMasterService],
16
- controllers: [ListMasterController]
16
+ controllers: [ListMasterController],
17
+ exports:[ListMasterService]
17
18
  })
18
19
  export class ListMasterModule {}
@@ -10,17 +10,18 @@ import { ApiRegistryService } from '../../third-party-module/service/api-registr
10
10
  import { firstValueFrom } from 'rxjs';
11
11
  import { HttpService } from '@nestjs/axios';
12
12
  import { EntityManager } from 'typeorm';
13
+ import { EntityMasterService } from 'src/module/meta/service/entity-master.service';
13
14
 
14
15
  @Injectable()
15
- export class ListMasterService extends EntityServiceImpl {
16
+ export class ListMasterService {
16
17
  constructor(
17
18
  private readonly entityManager: EntityManager,
19
+ private readonly entityMasterService: EntityMasterService,
18
20
  private readonly listMasterRepo: ListMasterRepository,
19
21
  private readonly listItemsRepo: ListMasterItemsRepository,
20
22
  private readonly apiRegistryService: ApiRegistryService,
21
23
  private readonly httpService: HttpService,
22
24
  ) {
23
- super();
24
25
  }
25
26
 
26
27
  async getDropdownOptions(type: string, params: Record<string, string>) {
@@ -1,4 +1,4 @@
1
- import { Controller, HttpStatus, Post, Query, Res, UseGuards } from '@nestjs/common';
1
+ import { Controller, HttpStatus, Post, Query, Req, Res, UseGuards } from '@nestjs/common';
2
2
  import { EntityTableService } from '../service/entity-table.service';
3
3
  import { Response } from 'express';
4
4
  import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
@@ -11,8 +11,11 @@ export class MetaController {
11
11
  @Post('get-table-data')
12
12
  async getTableMetaData(@Query('entity_type') entityType: string,
13
13
  @Query('list_type') listType: string,
14
- @Res() response: Response) {
15
- let entityTableDto = await this.entityTableService.getTableMetaDataForListing(entityType, listType);
14
+ @Res() response: Response,
15
+ @Req() req: Request & { user: any }) {
16
+ const userId = req.user.userId;
17
+ console.log(userId)
18
+ let entityTableDto = await this.entityTableService.getTableMetaDataForListing(entityType, listType,userId);
16
19
  return response.status(HttpStatus.OK).json({
17
20
  success: true,
18
21
  data: entityTableDto,
@@ -3,4 +3,8 @@ import { EntityTableColumn } from '../entity/entity-table-column.entity';
3
3
 
4
4
  export class EntityTableDto extends EntityTable{
5
5
  column_list: EntityTableColumn[];
6
+ operation_list:{};
7
+ default_filter:{} | null;
8
+ saved_filter:{ label: string; value: number }[]
9
+ | null;
6
10
  }
@@ -1,4 +1,4 @@
1
- import { Module } from '@nestjs/common';
1
+ import { forwardRef, Module } from '@nestjs/common';
2
2
  import { EntityMasterService } from './service/entity-master.service';
3
3
  import { EntityServiceImpl } from './service/entity-service-impl.service';
4
4
  import { EntityController } from './controller/entity.controller';
@@ -36,6 +36,8 @@ import { ViewMasterController } from './controller/view-master.controller';
36
36
  import { ViewMaterRespository } from './repository/view-master.repository';
37
37
  import { MetaController } from './controller/meta.controller';
38
38
  import { EntityValidationService } from './service/entity-validation.service';
39
+ import { ListMasterModule } from '../listmaster/listmaster.module';
40
+ import { FilterModule } from '../filter/filter.module';
39
41
 
40
42
  @Module({
41
43
  imports: [
@@ -52,8 +54,9 @@ import { EntityValidationService } from './service/entity-validation.service';
52
54
  SectionMaster,
53
55
  FieldGroup,
54
56
  ]),
55
- UtilsModule,
56
- ],
57
+ forwardRef(() => ListMasterModule),
58
+ forwardRef(() => FilterModule),
59
+ UtilsModule ],
57
60
  providers: [
58
61
  EntityMasterService,
59
62
  EntityServiceImpl,
@@ -80,15 +83,21 @@ import { EntityValidationService } from './service/entity-validation.service';
80
83
  EntityServiceImpl,
81
84
  PreferenceService,
82
85
  EntityListService,
83
- EntityTableService,
84
86
  EntityValidationService,
87
+ EntityTableService,
85
88
  EntityTableColumnService,
86
89
  MediaDataService,
87
90
  SectionMasterService,
88
91
  FieldGroupService,
89
92
  'ViewMasterService',
90
- AttributeMasterService
93
+ AttributeMasterService,
94
+ ],
95
+ controllers: [
96
+ EntityController,
97
+ MasterController,
98
+ MediaController,
99
+ ViewMasterController,
100
+ MetaController,
91
101
  ],
92
- controllers: [EntityController, MasterController, MediaController, ViewMasterController, MetaController],
93
102
  })
94
103
  export class EntityModule {}
@@ -10,23 +10,27 @@ export class EntityTableColumnRepository {
10
10
  private entityTableColumnRepository: Repository<EntityTableColumn>,
11
11
  ) {}
12
12
 
13
- async findByParentIdAndParentType(parentId: number, parentType: string, nonVisible?) {
14
- if (nonVisible) {
13
+ async findByParentIdAndParentType(
14
+ parentId: number,
15
+ parentType: string,
16
+ isVisible?: boolean,
17
+ ) {
18
+ if (isVisible) {
15
19
  return await this.entityTableColumnRepository.find({
16
20
  where: {
17
21
  parent_id: parentId,
18
22
  parent_type: parentType,
19
23
  },
20
- order: { col_position: 'ASC' }
24
+ order: { col_position: 'ASC' },
21
25
  });
22
26
  }
23
27
  return await this.entityTableColumnRepository.find({
24
28
  where: {
25
29
  parent_id: parentId,
26
30
  parent_type: parentType,
27
- visible: "1",
31
+ visible: '1',
28
32
  },
29
- order: { col_position: 'ASC' }
33
+ order: { col_position: 'ASC' },
30
34
  });
31
35
  }
32
36
  }
@@ -1,8 +1,7 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { InjectRepository } from "@nestjs/typeorm";
3
- import { In } from "typeorm";
4
- import { AttributeMasterRepository } from "../repository/attribute-master.repository";
5
-
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectRepository } from '@nestjs/typeorm';
3
+ import { In } from 'typeorm';
4
+ import { AttributeMasterRepository } from '../repository/attribute-master.repository';
6
5
 
7
6
  @Injectable()
8
7
  export class AttributeMasterService {
@@ -10,8 +9,9 @@ export class AttributeMasterService {
10
9
  private readonly attributeMasterRepository: AttributeMasterRepository,
11
10
  ) {}
12
11
 
13
- async findAttributesByMappedEntityType(entity_type){
14
- return await this.attributeMasterRepository.findAttributesByMappedEntityType(entity_type);
12
+ async findAttributesByMappedEntityType(entity_type) {
13
+ return await this.attributeMasterRepository.findAttributesByMappedEntityType(
14
+ entity_type,
15
+ );
15
16
  }
16
-
17
- }
17
+ }
@@ -21,11 +21,16 @@ export class EntityTableColumnService {
21
21
  return attributeJson;
22
22
  }
23
23
 
24
- async findByParentIdAndParentType(parentId: number, parentType: string) {
24
+ async findByParentIdAndParentType(
25
+ parentId: number,
26
+ parentType: string,
27
+ isVisible?: boolean,
28
+ ) {
25
29
  let entityTableColumns =
26
30
  await this.entityTableColumnRepository.findByParentIdAndParentType(
27
31
  parentId,
28
32
  parentType,
33
+ isVisible,
29
34
  );
30
35
  return entityTableColumns;
31
36
  }
@@ -1,15 +1,23 @@
1
- import { Injectable } from '@nestjs/common';
1
+ import { forwardRef, Inject, Injectable } from '@nestjs/common';
2
2
  import { EntityTableRepository } from '../repository/entity-table.repository';
3
3
  import { EntityTableColumnRepository } from '../repository/entity-table-column.repository';
4
4
  import { EntityTableDto } from '../dto/entity-table.dto';
5
5
  import { DISPLAY_LIST } from '../../../constant/global.constant';
6
+ import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
7
+ import { SavedFilterService } from 'src/module/filter/service/saved-filter.service';
8
+ import { SavedFilterRepositoryService } from 'src/module/filter/repository/saved-filter.repository';
6
9
 
7
10
  @Injectable()
8
11
  export class EntityTableService {
9
12
  constructor(
10
13
  private entityTableRepository: EntityTableRepository,
11
14
  private readonly entityTableColumnRepository: EntityTableColumnRepository,
12
- ) {}
15
+ @Inject(forwardRef(() => ListMasterService))
16
+ private readonly listMasterService: ListMasterService,
17
+
18
+ private readonly savedFilterRepoService: SavedFilterRepositoryService,
19
+ ) {
20
+ }
13
21
 
14
22
  async findByEntityTypeAndListType(entityType: string, listType: string) {
15
23
  return await this.entityTableRepository.findByEntityTypeAndListType(
@@ -30,14 +38,15 @@ export class EntityTableService {
30
38
  );
31
39
  }
32
40
 
33
- async getTableMetaDataForListing(entityType: string, listType: string) {
34
- return await this.getTableMetaData(entityType, listType, DISPLAY_LIST);
41
+ async getTableMetaDataForListing(entityType: string, listType: string,userId?: number) {
42
+ return await this.getTableMetaData(entityType, listType, DISPLAY_LIST,userId);
35
43
  }
36
44
 
37
45
  async getTableMetaData(
38
46
  entityType: string,
39
47
  listType: string,
40
48
  displayType: string,
49
+ userId?: number
41
50
  ) {
42
51
  let entityTable = await this.findByEntityTypeAndListTypeAndDisplayType(
43
52
  entityType,
@@ -52,7 +61,18 @@ export class EntityTableService {
52
61
  entityTable.id,
53
62
  entityTable.entity_type,
54
63
  );
64
+ entityTableDto.operation_list = {
65
+ "text": await this.listMasterService.getDropdownOptions("OPT",{})
66
+ // Add any other operations you want to include
67
+ };
68
+ entityTableDto.default_filter= await this.savedFilterRepoService.getDefaultFilterByEntityType(entityTable.list_type);
69
+ if(userId){
70
+ entityTableDto.saved_filter = await this.savedFilterRepoService.getSavedFiltersByUserIdAndEntityType(userId, entityTable.list_type);
71
+ }
55
72
  }
73
+
74
+
75
+
56
76
  return entityTableDto;
57
77
  }
58
78
  }
@@ -35,7 +35,9 @@ export class ModuleData {
35
35
  @Column({ type: 'varchar', length: 100, nullable: true })
36
36
  title: string;
37
37
 
38
+ @Column({ type: 'varchar', length: 100, nullable: true })
39
+ component_name: string;
40
+
38
41
  @Column({ type: 'json', nullable: true })
39
42
  ui_config: JSON;
40
-
41
43
  }