@trudb/tru-common-lib 0.0.499 → 0.0.501
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.
|
@@ -827,22 +827,26 @@ class TruDataContext {
|
|
|
827
827
|
return errorsPerEntity;
|
|
828
828
|
};
|
|
829
829
|
this.formatValidationErrors = (entities = null) => {
|
|
830
|
-
let
|
|
830
|
+
let entitiesWithErrors = this.getValidationErrors(entities);
|
|
831
831
|
let formattedErrors = new Array();
|
|
832
|
-
|
|
833
|
-
if (
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
832
|
+
entitiesWithErrors.forEach((entityWithErrors) => {
|
|
833
|
+
if (entityWithErrors.length) {
|
|
834
|
+
formattedErrors.push(entityWithErrors.map((e) => {
|
|
835
|
+
if (e.propertyName) {
|
|
836
|
+
return e.entity.entityType.defaultResourceName + '.' + e.propertyName + ': ' + e.errorMessage;
|
|
837
|
+
}
|
|
838
|
+
var mergeData = JSON.parse(e.entity.Merge_Data);
|
|
839
|
+
if (mergeData &&
|
|
840
|
+
mergeData.constructor === Object &&
|
|
841
|
+
Object.entries(mergeData).length > 0 &&
|
|
842
|
+
mergeData[e.property.name]) {
|
|
843
|
+
return mergeData[e.property.name].modifiedBy + ' changed ' + e.property.name + ' to ' + mergeData[e.property.name].value + '. Accept or Decline the change. ';
|
|
844
|
+
}
|
|
845
|
+
var propertyName = e.property.name ? e.property.name : '[Unknown Property]';
|
|
846
|
+
return e.entity.entityType.defaultResourceName + '.' + propertyName + ': has invalid data.';
|
|
847
|
+
}));
|
|
842
848
|
}
|
|
843
|
-
|
|
844
|
-
return e.entity.entityType.defaultResourceName + '.' + propertyName + ': has invalid data.';
|
|
845
|
-
}));
|
|
849
|
+
});
|
|
846
850
|
return formattedErrors;
|
|
847
851
|
};
|
|
848
852
|
this.findCachedCascadeDeleteDescendants = (entity) => {
|