rez_core 1.0.63 → 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.
- package/dist/constant/global.constant.d.ts +3 -0
- package/dist/constant/global.constant.js +4 -1
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/module/meta/controller/meta.controller.d.ts +7 -0
- package/dist/module/meta/controller/meta.controller.js +47 -0
- package/dist/module/meta/controller/meta.controller.js.map +1 -0
- package/dist/module/meta/dto/entity-table.dto.d.ts +5 -0
- package/dist/module/meta/dto/entity-table.dto.js +8 -0
- package/dist/module/meta/dto/entity-table.dto.js.map +1 -0
- package/dist/module/meta/entity.module.js +2 -1
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/repository/entity-table-column.repository.js +1 -0
- package/dist/module/meta/repository/entity-table-column.repository.js.map +1 -1
- package/dist/module/meta/service/entity-table.service.d.ts +6 -1
- package/dist/module/meta/service/entity-table.service.js +18 -2
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/constant/global.constant.ts +5 -0
- package/src/module/meta/controller/meta.controller.ts +22 -0
- package/src/module/meta/dto/entity-table.dto.ts +6 -0
- package/src/module/meta/entity.module.ts +2 -1
- package/src/module/meta/repository/entity-table-column.repository.ts +1 -0
- package/src/module/meta/service/entity-table.service.ts +43 -3
package/package.json
CHANGED
|
@@ -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';
|
|
@@ -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
|
+
}
|
|
@@ -34,6 +34,7 @@ import { FieldGroupService } from './service/field-group.service';
|
|
|
34
34
|
import { ViewMasterService } from './service/view-master.service';
|
|
35
35
|
import { ViewMasterController } from './controller/view-master.controller';
|
|
36
36
|
import { ViewMaterRespository } from './repository/view-master.repository';
|
|
37
|
+
import { MetaController } from './controller/meta.controller';
|
|
37
38
|
|
|
38
39
|
@Module({
|
|
39
40
|
imports: [
|
|
@@ -84,6 +85,6 @@ import { ViewMaterRespository } from './repository/view-master.repository';
|
|
|
84
85
|
FieldGroupService,
|
|
85
86
|
'ViewMasterService',
|
|
86
87
|
],
|
|
87
|
-
controllers: [EntityController, MasterController, MediaController, ViewMasterController],
|
|
88
|
+
controllers: [EntityController, MasterController, MediaController, ViewMasterController, MetaController],
|
|
88
89
|
})
|
|
89
90
|
export class EntityModule {}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { EntityTableRepository } from '../repository/entity-table.repository';
|
|
3
|
+
import { EntityTableColumnRepository } from '../repository/entity-table-column.repository';
|
|
4
|
+
import { EntityTableDto } from '../dto/entity-table.dto';
|
|
5
|
+
import { DISPLAY_LIST } from '../../../constant/global.constant';
|
|
3
6
|
|
|
4
7
|
@Injectable()
|
|
5
8
|
export class EntityTableService {
|
|
6
|
-
constructor(
|
|
9
|
+
constructor(
|
|
10
|
+
private entityTableRepository: EntityTableRepository,
|
|
11
|
+
private readonly entityTableColumnRepository: EntityTableColumnRepository,
|
|
12
|
+
) {}
|
|
7
13
|
|
|
8
14
|
async findByEntityTypeAndListType(entityType: string, listType: string) {
|
|
9
15
|
return await this.entityTableRepository.findByEntityTypeAndListType(
|
|
@@ -12,7 +18,41 @@ export class EntityTableService {
|
|
|
12
18
|
);
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
async findByEntityTypeAndListTypeAndDisplayType(
|
|
16
|
-
|
|
21
|
+
async findByEntityTypeAndListTypeAndDisplayType(
|
|
22
|
+
entityType: string,
|
|
23
|
+
listType: string,
|
|
24
|
+
displayType: string,
|
|
25
|
+
) {
|
|
26
|
+
return await this.entityTableRepository.findByEntityTypeAndListTypeAndDisplayType(
|
|
27
|
+
entityType,
|
|
28
|
+
listType,
|
|
29
|
+
displayType,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async getTableMetaDataForListing(entityType: string, listType: string) {
|
|
34
|
+
return await this.getTableMetaData(entityType, listType, DISPLAY_LIST);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getTableMetaData(
|
|
38
|
+
entityType: string,
|
|
39
|
+
listType: string,
|
|
40
|
+
displayType: string,
|
|
41
|
+
) {
|
|
42
|
+
let entityTable = await this.findByEntityTypeAndListTypeAndDisplayType(
|
|
43
|
+
entityType,
|
|
44
|
+
listType,
|
|
45
|
+
displayType,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
let entityTableDto = entityTable as EntityTableDto;
|
|
49
|
+
if (entityTable) {
|
|
50
|
+
entityTableDto.column_list =
|
|
51
|
+
await this.entityTableColumnRepository.findByParentIdAndParentType(
|
|
52
|
+
entityTable.id,
|
|
53
|
+
entityTable.entity_type,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return entityTableDto;
|
|
17
57
|
}
|
|
18
58
|
}
|