fix: enhance relation validation logic to check for existing relations in data
parent
2c92d4b8b3
commit
fcf9e9459e
|
@ -52,10 +52,12 @@ export class ValidateRelationHelper<Entity> {
|
||||||
`Failed! this data already connected to ${relation.relation}`;
|
`Failed! this data already connected to ${relation.relation}`;
|
||||||
|
|
||||||
if (relation.singleQuery) {
|
if (relation.singleQuery) {
|
||||||
|
const relationObject = data[relation.relation] ?? {};
|
||||||
|
const isRelationExist = `${relation.singleQuery[0]}` in relationObject;
|
||||||
const relationColumn =
|
const relationColumn =
|
||||||
data[relation.relation]?.[`${relation.singleQuery[0]}`];
|
data[relation.relation]?.[`${relation.singleQuery[0]}`];
|
||||||
if (
|
if (
|
||||||
// !!relationColumn &&
|
isRelationExist &&
|
||||||
this.mappingValidator(
|
this.mappingValidator(
|
||||||
relationColumn,
|
relationColumn,
|
||||||
relation.singleQuery[1],
|
relation.singleQuery[1],
|
||||||
|
|
Loading…
Reference in New Issue