rez_core 2.2.128 → 2.2.129
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/master/service/master.service.js +2 -12
- package/dist/module/master/service/master.service.js.map +1 -1
- package/dist/module/meta/service/entity-validation.service.d.ts +1 -0
- package/dist/module/meta/service/entity-validation.service.js +7 -1
- package/dist/module/meta/service/entity-validation.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/master/service/master.service.ts +2 -20
- package/src/module/meta/service/entity-validation.service.ts +16 -2
- package/.vscode/extensions.json +0 -5
package/package.json
CHANGED
|
@@ -220,7 +220,7 @@ export class MasterService {
|
|
|
220
220
|
|
|
221
221
|
const attributes =
|
|
222
222
|
await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
223
|
-
|
|
223
|
+
entityMaster.mapped_entity_type,
|
|
224
224
|
loggedInUser,
|
|
225
225
|
);
|
|
226
226
|
|
|
@@ -358,7 +358,7 @@ export class MasterService {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
// ✅ validate single row
|
|
361
|
-
const rowErrors = await this.entityValidationService.
|
|
361
|
+
const rowErrors = await this.entityValidationService.validateImportData(
|
|
362
362
|
row,
|
|
363
363
|
entityMaster,
|
|
364
364
|
loggedInUser,
|
|
@@ -528,24 +528,6 @@ export class MasterService {
|
|
|
528
528
|
await entityService.updateEntity(row, loggedInUser);
|
|
529
529
|
}
|
|
530
530
|
} else {
|
|
531
|
-
const rowErrors = await this.entityValidationService.validateEntityData(
|
|
532
|
-
row,
|
|
533
|
-
entityMaster,
|
|
534
|
-
loggedInUser,
|
|
535
|
-
);
|
|
536
|
-
|
|
537
|
-
if (rowErrors && rowErrors.length > 0) {
|
|
538
|
-
errors.push({
|
|
539
|
-
row: i + 1,
|
|
540
|
-
errors: rowErrors,
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
if (errors.length > 0) {
|
|
545
|
-
throw new Error(
|
|
546
|
-
`Validation errors found in the uploaded data: ${JSON.stringify(errors)}`,
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
531
|
await entityService.createEntity(row, loggedInUser);
|
|
550
532
|
}
|
|
551
533
|
}
|
|
@@ -134,10 +134,9 @@ export class EntityValidationService {
|
|
|
134
134
|
): Promise<ValidationError[]> {
|
|
135
135
|
const attributes =
|
|
136
136
|
await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
137
|
-
|
|
137
|
+
entityMaster.mapped_entity_type,
|
|
138
138
|
loggedInUser,
|
|
139
139
|
);
|
|
140
|
-
|
|
141
140
|
const requiredErrors = this.validateRequiredFields(entityData, attributes);
|
|
142
141
|
const uniqueErrors = await this.validateUniqueFields(
|
|
143
142
|
entityData,
|
|
@@ -163,6 +162,21 @@ export class EntityValidationService {
|
|
|
163
162
|
// const regexErros = await this.validateRegexFields(entityData, attributes);
|
|
164
163
|
// return [...requiredErrors, ...regexErros];
|
|
165
164
|
// }
|
|
165
|
+
async validateImportData(
|
|
166
|
+
entityData: Record<string, any>,
|
|
167
|
+
entityMaster,
|
|
168
|
+
loggedInUser: any,
|
|
169
|
+
): Promise<ValidationError[]> {
|
|
170
|
+
const attributes =
|
|
171
|
+
await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
172
|
+
entityMaster.mapped_entity_type,
|
|
173
|
+
loggedInUser,
|
|
174
|
+
);
|
|
175
|
+
const requiredErrors = this.validateRequiredFields(entityData, attributes);
|
|
176
|
+
const regexErros = await this.validateRegexFields(entityData, attributes);
|
|
177
|
+
return [...requiredErrors, ...regexErros];
|
|
178
|
+
}
|
|
179
|
+
|
|
166
180
|
private hasValidValue(value: any): boolean {
|
|
167
181
|
if (value === null || value === undefined) return false;
|
|
168
182
|
if (typeof value === 'string' && value.trim() === '') return false;
|