rez_core 5.0.46 → 5.0.47
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/.idea/250218_nodejs_core.iml +12 -0
- package/.idea/codeStyles/Project.xml +59 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/dist/module/meta/service/entity-dynamic.service.js +4 -2
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/meta/service/entity-dynamic.service.ts +34 -22
- package/.vscode/extensions.json +0 -5
package/package.json
CHANGED
|
@@ -15,8 +15,7 @@ export class EntityDynamicService {
|
|
|
15
15
|
private readonly resolverService: ResolverService,
|
|
16
16
|
private readonly configService: ConfigService,
|
|
17
17
|
private readonly entityMasterRepo: EntityMasterRepository,
|
|
18
|
-
) {
|
|
19
|
-
}
|
|
18
|
+
) {}
|
|
20
19
|
|
|
21
20
|
// -----------------------------
|
|
22
21
|
async createEntity(
|
|
@@ -28,7 +27,10 @@ export class EntityDynamicService {
|
|
|
28
27
|
const organizationId = loggedInUser.organization_id;
|
|
29
28
|
|
|
30
29
|
const tableName = await this.getTableName(entityType, organizationId);
|
|
31
|
-
const validAttributes = await this.getAttributeCodes(
|
|
30
|
+
const validAttributes = await this.getAttributeCodes(
|
|
31
|
+
entityType,
|
|
32
|
+
organizationId,
|
|
33
|
+
);
|
|
32
34
|
|
|
33
35
|
// -------------------------------------------------------
|
|
34
36
|
// AUTO fields
|
|
@@ -47,11 +49,9 @@ export class EntityDynamicService {
|
|
|
47
49
|
if (!entityData.level_type)
|
|
48
50
|
entityData.level_type = loggedInUser.level_type;
|
|
49
51
|
|
|
50
|
-
if (!entityData.level_id)
|
|
51
|
-
entityData.level_id = loggedInUser.level_id;
|
|
52
|
+
if (!entityData.level_id) entityData.level_id = loggedInUser.level_id;
|
|
52
53
|
|
|
53
|
-
if (!entityData.entity_type)
|
|
54
|
-
entityData.entity_type = entityType;
|
|
54
|
+
if (!entityData.entity_type) entityData.entity_type = entityType;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// -------------------------------------------------------
|
|
@@ -112,7 +112,7 @@ export class EntityDynamicService {
|
|
|
112
112
|
];
|
|
113
113
|
|
|
114
114
|
for (const col of bypassColumns) {
|
|
115
|
-
if (!validAttributes.some(a => a.attribute_key === col)) {
|
|
115
|
+
if (!validAttributes.some((a) => a.attribute_key === col)) {
|
|
116
116
|
validAttributes.push({
|
|
117
117
|
attribute_key: col,
|
|
118
118
|
is_hidden: false,
|
|
@@ -131,12 +131,14 @@ export class EntityDynamicService {
|
|
|
131
131
|
const placeholders: string[] = [];
|
|
132
132
|
|
|
133
133
|
for (const attr of validAttributes) {
|
|
134
|
+
if (attr.attribute_key === 'id') continue;
|
|
135
|
+
|
|
134
136
|
columns.push(attr.attribute_key);
|
|
135
137
|
values.push(entityData[attr.attribute_key] ?? null);
|
|
136
138
|
placeholders.push(`$${idx++}`);
|
|
137
139
|
}
|
|
138
140
|
|
|
139
|
-
const colList = columns.map(c => `"${c}"`).join(', ');
|
|
141
|
+
const colList = columns.map((c) => `"${c}"`).join(', ');
|
|
140
142
|
const placeholderList = placeholders.join(', ');
|
|
141
143
|
|
|
142
144
|
const sql = `
|
|
@@ -450,7 +452,10 @@ export class EntityDynamicService {
|
|
|
450
452
|
const organizationId = loggedInUser.organization_id;
|
|
451
453
|
|
|
452
454
|
const tableName = await this.getTableName(entityType, organizationId);
|
|
453
|
-
const validAttributes = await this.getAttributeCodes(
|
|
455
|
+
const validAttributes = await this.getAttributeCodes(
|
|
456
|
+
entityType,
|
|
457
|
+
organizationId,
|
|
458
|
+
);
|
|
454
459
|
|
|
455
460
|
const updates: string[] = [];
|
|
456
461
|
const values: any[] = [];
|
|
@@ -567,9 +572,9 @@ export class EntityDynamicService {
|
|
|
567
572
|
row[attr.attribute_key] =
|
|
568
573
|
row[attr.attribute_key] != null
|
|
569
574
|
? await this.mediaDataService.getMediaDownloadUrl(
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
575
|
+
Number(row[attr.attribute_key]),
|
|
576
|
+
loggedInUser,
|
|
577
|
+
)
|
|
573
578
|
: null;
|
|
574
579
|
}
|
|
575
580
|
}
|
|
@@ -622,9 +627,9 @@ export class EntityDynamicService {
|
|
|
622
627
|
row[attr.attribute_key] =
|
|
623
628
|
row[attr.attribute_key] != null
|
|
624
629
|
? await this.mediaDataService.getMediaDownloadUrl(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
630
|
+
Number(row[attr.attribute_key]),
|
|
631
|
+
loggedInUser,
|
|
632
|
+
)
|
|
628
633
|
: null;
|
|
629
634
|
}
|
|
630
635
|
}
|
|
@@ -636,8 +641,10 @@ export class EntityDynamicService {
|
|
|
636
641
|
entityType: string,
|
|
637
642
|
organizationId: string,
|
|
638
643
|
): Promise<string> {
|
|
639
|
-
|
|
640
|
-
|
|
644
|
+
const result = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
645
|
+
entityType,
|
|
646
|
+
organizationId,
|
|
647
|
+
);
|
|
641
648
|
|
|
642
649
|
if (!result) {
|
|
643
650
|
console.log(`Entity type '${entityType}' not found in frm_entity_master`);
|
|
@@ -652,8 +659,10 @@ export class EntityDynamicService {
|
|
|
652
659
|
entityType: string,
|
|
653
660
|
organizationId: string,
|
|
654
661
|
): Promise<string> {
|
|
655
|
-
|
|
656
|
-
|
|
662
|
+
let entityMaster = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
663
|
+
entityType,
|
|
664
|
+
organizationId,
|
|
665
|
+
);
|
|
657
666
|
|
|
658
667
|
if (!entityMaster) {
|
|
659
668
|
console.log(`Entity type '${entityType}' not found in frm_entity_master`);
|
|
@@ -673,7 +682,7 @@ export class EntityDynamicService {
|
|
|
673
682
|
.select('fea.attribute_key', 'attribute_key')
|
|
674
683
|
.addSelect('MAX(fea.db_datatype)', 'db_datatype')
|
|
675
684
|
.addSelect('MAX(fea.element_type)', 'element_type')
|
|
676
|
-
.addSelect('BOOL_OR(fea.is_hidden)', 'is_hidden')
|
|
685
|
+
.addSelect('BOOL_OR(fea.is_hidden)', 'is_hidden') // ✅ FIXED for Postgres
|
|
677
686
|
.from('frm_entity_attribute', 'fea')
|
|
678
687
|
.where('fea.mapped_entity_type = :entityType', { entityType })
|
|
679
688
|
.andWhere('fea.organization_id = :organizationId', { organizationId });
|
|
@@ -737,7 +746,10 @@ export class EntityDynamicService {
|
|
|
737
746
|
|
|
738
747
|
// 1. Get db_table_name from entity master
|
|
739
748
|
|
|
740
|
-
const result = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
749
|
+
const result = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
750
|
+
entityType,
|
|
751
|
+
organizationId,
|
|
752
|
+
);
|
|
741
753
|
|
|
742
754
|
if (!result) {
|
|
743
755
|
throw new Error(
|