lambdaorm-base
Advanced tools
Comparing version 0.1.22 to 0.1.23
{ | ||
"name": "lambdaorm-base", | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"description": "ORM", | ||
@@ -5,0 +5,0 @@ "author": "Flavio Lionel Rita <flaviolrita@proton.me>", |
@@ -123,3 +123,3 @@ "use strict"; | ||
const intermediaPropertyPk = { name: 'id', type: 'integer', required: true, autoIncrement: true }; | ||
const intermediaEntity = { intermediate: true, name: intermediaEntityName, primaryKey: ['id'], properties: [intermediaPropertyPk, childProperty, parentProperty], uniqueKey: [parentProperty.name, childProperty.name], required: [], indexes: [], relations: [], dependents: [] }; | ||
const intermediaEntity = { name: intermediaEntityName, intermediate: true, primaryKey: ['id'], properties: [intermediaPropertyPk, childProperty, parentProperty], uniqueKey: [parentProperty.name, childProperty.name], required: [], indexes: [], relations: [], dependents: [] }; | ||
const parentRelation = { | ||
@@ -216,3 +216,3 @@ name: this.helper.str.notation(entity.name, 'camel'), | ||
getPk(objType) { | ||
const uniques = objType.properties.filter(p => { var _a; return ((_a = p.type) === null || _a === void 0 ? void 0 : _a.unique) === true; }); | ||
const uniques = objType.properties.filter(p => { var _a, _b; return ((_a = p.type) === null || _a === void 0 ? void 0 : _a.unique) === true || ((_b = p.type) === null || _b === void 0 ? void 0 : _b.onParentDistinctUnique) === true; }); | ||
return this.getKey(uniques); | ||
@@ -230,7 +230,5 @@ } | ||
else if (uniques.length > 1) { | ||
for (const keyName of ['id', 'code', 'key', 'name']) { | ||
const id = uniques.find(p => p.name.toLowerCase() === keyName); | ||
if (id) { | ||
return id; | ||
} | ||
const id = uniques.find(p => ['id', 'code', 'key', 'name'].includes(p.name.toLowerCase())); | ||
if (id) { | ||
return id; | ||
} | ||
@@ -237,0 +235,0 @@ const idNumber = uniques.find(p => { var _a, _b; return ((_a = p.type) === null || _a === void 0 ? void 0 : _a.primitive) === 'number' || ((_b = p.type) === null || _b === void 0 ? void 0 : _b.primitive) === 'integer'; }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
223768
3555