From fcf9e9459e01b21732324afc0fa43d01260ecc48 Mon Sep 17 00:00:00 2001 From: shancheas Date: Thu, 26 Jun 2025 15:12:08 +0700 Subject: [PATCH] fix: enhance relation validation logic to check for existing relations in data --- src/core/helpers/validation/validate-relation.helper.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/helpers/validation/validate-relation.helper.ts b/src/core/helpers/validation/validate-relation.helper.ts index ae5b929..0ae626b 100644 --- a/src/core/helpers/validation/validate-relation.helper.ts +++ b/src/core/helpers/validation/validate-relation.helper.ts @@ -52,10 +52,12 @@ export class ValidateRelationHelper { `Failed! this data already connected to ${relation.relation}`; if (relation.singleQuery) { + const relationObject = data[relation.relation] ?? {}; + const isRelationExist = `${relation.singleQuery[0]}` in relationObject; const relationColumn = data[relation.relation]?.[`${relation.singleQuery[0]}`]; if ( - // !!relationColumn && + isRelationExist && this.mappingValidator( relationColumn, relation.singleQuery[1],