@soinlabs/db
Advanced tools
Comparing version 1.1.0-alpha.15 to 1.1.0-alpha.16
{ | ||
"name": "@soinlabs/db", | ||
"version": "1.1.0-alpha.15", | ||
"version": "1.1.0-alpha.16", | ||
"main": "index.js", | ||
@@ -53,2 +53,3 @@ "repository": "", | ||
"commitizen": "^4.1.2", | ||
"codecov": "^3.8.2", | ||
"cz-conventional-changelog-emoji": "^0.1.0", | ||
@@ -65,5 +66,4 @@ "eslint": "^7.22.0", | ||
"eslint-plugin-testing-library": "^3.10.1", | ||
"oracledb": "^5.2.0", | ||
"pg": "^8.7.1", | ||
"oracledb": "^5.2.0", | ||
"codecov": "^3.8.2", | ||
"husky": "^3.1.0", | ||
@@ -70,0 +70,0 @@ "jest": "^26.6.0", |
@@ -105,10 +105,4 @@ class AbstractEntity { | ||
const attributes = this.getAttributes() | ||
const requiredColumns = [] | ||
const requiredColumns = Object.values(attributes).filter(x => x.required) | ||
for (const attribute of attributes) { | ||
if (attributes[attribute].required) { | ||
requiredColumns.push(attributes[attribute]) | ||
} | ||
} | ||
return requiredColumns | ||
@@ -119,10 +113,4 @@ } | ||
const attributes = this.getAttributes() | ||
const uniqueColumns = [] | ||
const uniqueColumns = Object.values(attributes).filter(x => x.unique) | ||
for (const attribute of attributes) { | ||
if (attributes[attribute].unique) { | ||
uniqueColumns.push(attributes[attribute]) | ||
} | ||
} | ||
return uniqueColumns | ||
@@ -129,0 +117,0 @@ } |
@@ -21,4 +21,4 @@ class ConnectionConfig { | ||
if (!(json === undefined || json === null)) { | ||
for (const propertieName of json) { | ||
this[propertieName] = json[propertieName] | ||
for (const [key, property] of Object.entries(json)) { | ||
this[key] = property | ||
} | ||
@@ -25,0 +25,0 @@ } |
@@ -56,4 +56,3 @@ /* eslint-disable global-require */ | ||
_buildEntities(modelsPath) { | ||
for (const pathIndex of modelsPath) { | ||
const path = modelsPath[pathIndex] | ||
for (const path of modelsPath) { | ||
const conector = this._ormInstance.getConnector() | ||
@@ -75,4 +74,3 @@ const model = require(path)( | ||
_associateEntities(modelsPath) { | ||
for (const pathIndex of modelsPath) { | ||
const path = modelsPath[pathIndex] | ||
for (const path of modelsPath) { | ||
const conector = this._ormInstance.getConnector() | ||
@@ -79,0 +77,0 @@ const model = require(path)( |
@@ -66,4 +66,4 @@ const AbstractEntity = require('../common/abstract/AbstractEntity') | ||
const newModelObj = newModel | ||
for (const method of methods) { | ||
newModelObj.prototype[method] = methods[method] | ||
for (const [key, method] of Object.entries(methods)) { | ||
newModelObj.prototype[key] = method | ||
} | ||
@@ -74,3 +74,3 @@ return newModelObj | ||
defineHooks(hooks, newModel) { | ||
for (const hook of hooks) { | ||
for (const [key, hook] of Object.entries(hooks)) { | ||
if ( | ||
@@ -86,5 +86,5 @@ [ | ||
'beforeCreate', | ||
].includes(hook) | ||
].includes(key) | ||
) { | ||
newModel[hook](hooks[hook]) | ||
newModel[key](hook) | ||
} | ||
@@ -91,0 +91,0 @@ } |
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
133799
4281