From db78dc3a67beefdef697c4a55878e2dad5937fc2 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 24 Nov 2016 19:36:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[fixes=20#1359]=20multiple-column=20sort=20?= =?UTF-8?q?problem=20=E4=BF=AE=E5=A4=8D=E5=A4=9A=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If some field aliases, some without an alias is to generate the Order by clause orders the results is not expected --- lib/waterline/core/transformations.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/waterline/core/transformations.js b/lib/waterline/core/transformations.js index 441ee771b..872c35ac9 100644 --- a/lib/waterline/core/transformations.js +++ b/lib/waterline/core/transformations.js @@ -58,7 +58,7 @@ Transformation.prototype.initialize = function(attributes, tables) { // Set transformation attr to new key if (key === 'columnName') { - if (attr === attributes[attr][key]) return; + // if (attr === attributes[attr][key]) return; // cjy37 del self._transformations[attr] = attributes[attr][key]; } @@ -103,8 +103,9 @@ Transformation.prototype.serialize = function(attributes, behavior) { // Schema must be serialized in first level only if (behavior === 'schema') { if (hasOwnProperty(self._transformations, property)) { - obj[self._transformations[property]] = _.clone(obj[property]); + var tmpval = _.clone(obj[property]); // cjy37 delete obj[property]; + obj[self._transformations[property]] = tmpval; // cjy37 } return; } @@ -117,8 +118,9 @@ Transformation.prototype.serialize = function(attributes, behavior) { // check if object key is in the transformations if (hasOwnProperty(self._transformations, property)) { - obj[self._transformations[property]] = _.clone(obj[property]); + var tmpval = _.clone(obj[property]); // cjy37 delete obj[property]; + obj[self._transformations[property]] = tmpval; // cjy37 return recursiveParse(obj[self._transformations[property]]); } @@ -129,8 +131,10 @@ Transformation.prototype.serialize = function(attributes, behavior) { // Check if property is a transformation key if (hasOwnProperty(self._transformations, property)) { - obj[self._transformations[property]] = obj[property]; + var tmpval = obj[property]; // cjy37 delete obj[property]; + obj[self._transformations[property]] = tmpval; // cjy37 + } }); } From 190408789814af3d131e2325b262a077f2aa735f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E8=BF=9C?= Date: Fri, 21 Apr 2017 16:12:43 +0800 Subject: [PATCH 2/3] v0.11.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c6c517719..bbe3722e0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "waterline", "description": "An ORM for Node.js and the Sails framework.", - "version": "0.11.11", + "version": "0.11.7", "homepage": "http://waterlinejs.org", "contributors": [ { From 2cf477c6c0e7fe03fb48c73ba83b520a990e17ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E8=BF=9C?= Date: Fri, 21 Apr 2017 16:24:18 +0800 Subject: [PATCH 3/3] v0.11.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bbe3722e0..8d01e830e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "waterline", "description": "An ORM for Node.js and the Sails framework.", - "version": "0.11.7", + "version": "0.11.12", "homepage": "http://waterlinejs.org", "contributors": [ {