nox-validation 1.0.4 → 1.0.6

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.
Files changed (2) hide show
  1. package/lib/helpers.js +5 -4
  2. package/package.json +1 -1
package/lib/helpers.js CHANGED
@@ -504,7 +504,7 @@ const getForeignCollectionDetails = ({
504
504
 
505
505
  if (isSingleRelation) {
506
506
  const mainTable = relations.find(
507
- (d) => d.many_collection_id === collection && d.many_field === field
507
+ (d) => d.many_collection_id === collection && d.many_field_id === field
508
508
  );
509
509
  if (!mainTable) return {};
510
510
 
@@ -592,8 +592,9 @@ const buildNestedStructure = (
592
592
 
593
593
  const definedType =
594
594
  apiVersion === constants.API_VERSION.V1 ? convertTypesV1(item) : convertTypes(item);
595
+ const isUserKey = item?.path?.includes("updated_by") || item?.path?.includes("created_by");
595
596
 
596
- if (definedType.find_relations) {
597
+ if (definedType.find_relations && !isUserKey) {
597
598
  const relationDetail = getForeignCollectionDetails({
598
599
  relations: relations,
599
600
  collection: item?.schema_id,
@@ -822,14 +823,14 @@ const generateFieldCompareRules = (rule) => {
822
823
  return modifiedRule;
823
824
  };
824
825
 
825
- const generateModifiedRules = (meta,custom_message) => {
826
+ const generateModifiedRules = (meta, custom_message) => {
826
827
  return meta?.validations?.rules?.map((rule, index) => {
827
828
  let modifiedRule = {
828
829
  identifier: String(index),
829
830
  case: constants.rulesTypes.RULES_COMPARE,
830
831
  value: [],
831
832
  options: {},
832
- custom_message
833
+ custom_message,
833
834
  };
834
835
  switch (rule.rule) {
835
836
  case "contains":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nox-validation",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "validate dynamic schema",
5
5
  "main": "index.js",
6
6
  "scripts": {