ee-soa-service
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -50,2 +50,4 @@ | ||
name : (row.aliasName || row.referencedModel.name) | ||
, hasAlias : row.aliasName ? true : false | ||
, referencedModelName : row.referencedModel.name | ||
, key : row.name | ||
@@ -77,4 +79,7 @@ , type : row.type | ||
ormSpecs.columns.id.mapsTo.forEach(function(mapping) { | ||
this.specs.hasMany[mapping.model.name] = { | ||
name : mapping.model.name | ||
var collectionName = mapping.aliasName || mapping.model.name; | ||
this.specs.hasMany[collectionName] = { | ||
name : collectionName | ||
, hasAlias : mapping.aliasName ? true : false | ||
, modelName : mapping.model.name | ||
, primaryKeys : mapping.model.primaryKeys | ||
@@ -84,4 +89,4 @@ , primaryKey : mapping.model.primaryKeys[0] | ||
collection : '/' + mapping.model.name | ||
, setMapping : '/' + this.table + '/{id}/' + mapping.model.name + '/{id}' | ||
, getMapping : '/' + this.table + '/{id}/' + mapping.model.name | ||
, setMapping : '/' + this.table + '/{id}/' + collectionName + '/{id}' | ||
, getMapping : '/' + this.table + '/{id}/' + collectionName | ||
} | ||
@@ -95,3 +100,3 @@ }; | ||
this.specs.hasMany[mapping.model.name].table = table; | ||
this.specs.hasMany[collectionName].table = table; | ||
@@ -480,2 +485,5 @@ }.bind(this)); | ||
// Add alias support | ||
if(this.specs.hasOne[collection].hasAlias) subRequest.collection = this.specs.hasOne[collection].referencedModelName; | ||
this.emit('request', subRequest, function(err, data) { | ||
@@ -608,2 +616,5 @@ if(err) return callback(err); | ||
// Add alias support | ||
if(this.specs.hasMany[collection].hasAlias) subRequest.collection = this.specs.hasMany[collection].modelName; | ||
this.emit('request', subRequest, function(err, data) { | ||
@@ -610,0 +621,0 @@ if(err) return callback(err); |
@@ -5,3 +5,3 @@ { | ||
, "keywords" : ["ee", "soa", "service"] | ||
, "version" : "0.2.12" | ||
, "version" : "0.2.13" | ||
, "author": { | ||
@@ -8,0 +8,0 @@ "name" : "Tobias Kneubuehler" |
73455
1257