jsonapi-store-relationaldb
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -6,1 +6,3 @@ 2015-06-29 - Initial release | ||
2015-12-10 - v1.0.0 | ||
2015-12-11 - Foreign relations | ||
2015-12-11 - v1.0.1 |
@@ -42,3 +42,4 @@ "use strict"; | ||
dialect: self.config.dialect, | ||
logging: self.config.logging || debug | ||
logging: self.config.logging || debug, | ||
freezeTableName: true | ||
}); | ||
@@ -74,3 +75,3 @@ | ||
if (!settings) return false; | ||
return (settings.__one || settings.__many); | ||
return (settings.__one || settings.__many) && !settings.__as; | ||
}); | ||
@@ -157,5 +158,5 @@ relations = _.pick(self.resourceConfig.attributes, relations); | ||
if (many) { | ||
self.baseModel.hasMany(relatedModel, { onDelete: "CASCADE" }); | ||
self.baseModel.hasMany(relatedModel, { onDelete: "CASCADE", foreignKey: self.resourceConfig.resource + "Id" }); | ||
} else { | ||
self.baseModel.hasOne(relatedModel, { onDelete: "CASCADE" }); | ||
self.baseModel.hasOne(relatedModel, { onDelete: "CASCADE", foreignKey: self.resourceConfig.resource + "Id" }); | ||
} | ||
@@ -168,5 +169,3 @@ | ||
var self = this; | ||
var bleh = self.resourceConfig.resource; | ||
if (bleh[bleh.length - 1] === "s") bleh = bleh.substring(0, bleh.length - 1); | ||
bleh += "Id"; | ||
var resourceId = self.resourceConfig.resource + "Id"; | ||
@@ -186,3 +185,3 @@ Object.keys(json).forEach(function(attribute) { | ||
if (j.uid) delete j.uid; | ||
if (j[bleh]) delete j[bleh]; | ||
if (j[resourceId]) delete j[resourceId]; | ||
}); | ||
@@ -189,0 +188,0 @@ }); |
{ | ||
"name": "jsonapi-store-relationaldb", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Relational data store for jsonapi-server.", | ||
@@ -41,3 +41,3 @@ "keywords": [ | ||
"mocha-performance": "0.1.0", | ||
"jsonapi-server": "1.0.1" | ||
"jsonapi-server": "1.0.2" | ||
}, | ||
@@ -44,0 +44,0 @@ "scripts": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
25008
493
1