lambdaorm-base
Advanced tools
Comparing version 0.1.28 to 0.1.29
{ | ||
"name": "lambdaorm-base", | ||
"version": "0.1.28", | ||
"version": "0.1.29", | ||
"description": "ORM", | ||
@@ -5,0 +5,0 @@ "author": "Flavio Lionel Rita <flaviolrita@proton.me>", |
@@ -75,2 +75,6 @@ "use strict"; | ||
else { | ||
const fkValue = value[fk.name]; | ||
if (fkValue !== undefined) { | ||
row[propertyName] = fkValue; | ||
} | ||
const schemaEntityData = this.getSchemaEntityData(schemaData, relatedEntityName); | ||
@@ -80,12 +84,7 @@ if (relatedPkName === '_id') { | ||
} | ||
else if (schemaEntityData.rows.some(p => p[relatedPkName] === value[relatedPkName])) { | ||
// En el caso de que el id ya exista, no se añade la fila | ||
continue; | ||
else if (!schemaEntityData.rows.some(p => p[relatedPkName] === value[relatedPkName])) { | ||
// En el caso que el registro no exista, se añade | ||
const childRow = this.objectToRow(schemaData, prop.type.obj, value, relatedEntityName, relatedPkName); | ||
schemaEntityData.rows.push(childRow); | ||
} | ||
const childRow = this.objectToRow(schemaData, prop.type.obj, value, relatedEntityName, relatedPkName); | ||
const fkValue = value[fk.name]; | ||
if (fkValue !== undefined) { | ||
row[propertyName] = fkValue; | ||
} | ||
schemaEntityData.rows.push(childRow); | ||
} | ||
@@ -92,0 +91,0 @@ } |
Sorry, the diff of this file is not supported yet
249925
3844