rez_core 2.1.68 → 2.1.70
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/module/filter/service/filter.service.js +1 -1
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/meta/entity.module.js +3 -0
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/service/populate-meta.service.d.ts +11 -0
- package/dist/module/meta/service/populate-meta.service.js +60 -0
- package/dist/module/meta/service/populate-meta.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/filter/service/filter.service.ts +1 -1
- package/src/module/meta/entity.module.ts +3 -0
- package/src/module/meta/service/populate-meta.service.ts +54 -0
package/package.json
CHANGED
|
@@ -139,7 +139,7 @@ export class FilterService {
|
|
|
139
139
|
const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
|
|
140
140
|
|
|
141
141
|
// check level_id and level_type
|
|
142
|
-
if (entity_type != '
|
|
142
|
+
if (entity_type != 'ORG' && level_type && level_id && organization_id) {
|
|
143
143
|
baseWhere.push({
|
|
144
144
|
query:
|
|
145
145
|
'e.organization_id = :organization_id AND e.level_type = :level_type AND e.level_id = :level_id',
|
|
@@ -47,6 +47,7 @@ import { UserRoleMapping } from '../user/entity/user-role-mapping.entity';
|
|
|
47
47
|
import { AppMasterService } from './service/app-master.service';
|
|
48
48
|
import { AppMasterRespository } from './repository/app-master.repository';
|
|
49
49
|
import { AppMaster } from './entity/app-master.entity';
|
|
50
|
+
import { PopulateMetaService } from './service/populate-meta.service';
|
|
50
51
|
|
|
51
52
|
@Module({
|
|
52
53
|
imports: [
|
|
@@ -79,6 +80,7 @@ import { AppMaster } from './entity/app-master.entity';
|
|
|
79
80
|
MasterService,
|
|
80
81
|
EntityTableRepository,
|
|
81
82
|
EntityTableService,
|
|
83
|
+
PopulateMetaService,
|
|
82
84
|
EntityTableColumnRepository,
|
|
83
85
|
EntityTableColumnService,
|
|
84
86
|
EntityListService,
|
|
@@ -103,6 +105,7 @@ import { AppMaster } from './entity/app-master.entity';
|
|
|
103
105
|
EntityListService,
|
|
104
106
|
EntityValidationService,
|
|
105
107
|
EntityTableService,
|
|
108
|
+
PopulateMetaService,
|
|
106
109
|
EntityTableColumnService,
|
|
107
110
|
MediaDataService,
|
|
108
111
|
SectionMasterService,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
import { EntityServiceImpl } from './entity-service-impl.service';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class PopulateMetaService {
|
|
7
|
+
constructor(
|
|
8
|
+
private readonly dataSource: DataSource,
|
|
9
|
+
private readonly entityServiceImpl: EntityServiceImpl,
|
|
10
|
+
) {}
|
|
11
|
+
|
|
12
|
+
async populateMetaData(organization_id: number) {
|
|
13
|
+
// Define metadata tables
|
|
14
|
+
const metadataTables = [
|
|
15
|
+
'cr_entity_master',
|
|
16
|
+
'cr_attribute_master',
|
|
17
|
+
'cr_entity_table',
|
|
18
|
+
'cr_entity_table_column',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// Fetch and transform all factory data
|
|
22
|
+
for (const table of metadataTables) {
|
|
23
|
+
const factoryData = await this.dataSource.query(
|
|
24
|
+
`SELECT * FROM ${table} WHERE organization_id = -1 AND level_type = 'ORG' AND level_id = -1`,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (!factoryData.length) continue;
|
|
28
|
+
|
|
29
|
+
// Clean and transform data for insertion
|
|
30
|
+
const transformedData = factoryData.map((row) => {
|
|
31
|
+
const { id, created_date, modified_date, ...rest } = row;
|
|
32
|
+
return {
|
|
33
|
+
...rest,
|
|
34
|
+
organization_id,
|
|
35
|
+
level_type: 'ORG',
|
|
36
|
+
level_id: organization_id,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Perform bulk insert into the same table
|
|
41
|
+
await this.dataSource
|
|
42
|
+
.createQueryBuilder()
|
|
43
|
+
.insert()
|
|
44
|
+
.into(table)
|
|
45
|
+
.values(transformedData)
|
|
46
|
+
.execute();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
message: 'Metadata populated successfully',
|
|
51
|
+
status: 'success',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|