From b35f3415229542906beb471c93bcb43ca4aa952b Mon Sep 17 00:00:00 2001 From: Ankit Sobti Date: Mon, 14 Dec 2015 16:58:25 +0530 Subject: [PATCH 1/3] Collection controller with retrieve method that selectively populates the id of the user --- .../app/api/controllers/CollectionController.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/integration/app/api/controllers/CollectionController.js b/tests/integration/app/api/controllers/CollectionController.js index 24b0da4..dfb03c8 100644 --- a/tests/integration/app/api/controllers/CollectionController.js +++ b/tests/integration/app/api/controllers/CollectionController.js @@ -6,6 +6,13 @@ */ module.exports = { - + retrieve: function (req, res) { + Collection.findOne(req.param('id')).populate('user', {select: ['id']}).exec(function (err, collection) { + if (err) { + return res.serverError(err); + } + res.json(collection); + }); + }, }; From 43dcaa6bd5525b63acd062c73d6b28e210635f30 Mon Sep 17 00:00:00 2001 From: Shamasis Bhattacharya Date: Wed, 30 Dec 2015 17:46:04 +0530 Subject: [PATCH 2/3] Updated waterline to version that supports selective populates for one to many --- package.json | 2 +- .../app/api/controllers/CollectionController.js | 8 +++++++- waterline | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 343fe11..c77894a 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dependencies": { "lodash": "3.5.0", "mysql": "2.6.2", - "sails-mysql": "git+https://github.com/postmanlabs/sails-mysql.git#v0.10.12-postman.3" + "sails-mysql": "git+https://github.com/postmanlabs/sails-mysql.git#v0.10.12-postman.4" }, "devDependencies": { "expect.js": "^0.3.1", diff --git a/tests/integration/app/api/controllers/CollectionController.js b/tests/integration/app/api/controllers/CollectionController.js index dfb03c8..d76c137 100644 --- a/tests/integration/app/api/controllers/CollectionController.js +++ b/tests/integration/app/api/controllers/CollectionController.js @@ -7,7 +7,13 @@ module.exports = { retrieve: function (req, res) { - Collection.findOne(req.param('id')).populate('user', {select: ['id']}).exec(function (err, collection) { + Collection.findOne({ + select: ['name'], + where: {id: req.param('id')} + }) + .populate('user', {select: ['name']}) + .populate('requests', {select: ['name', 'collection', 'id']}) + .exec(function (err, collection) { if (err) { return res.serverError(err); } diff --git a/waterline b/waterline index 0d2a87f..eb6bfc7 160000 --- a/waterline +++ b/waterline @@ -1 +1 @@ -Subproject commit 0d2a87f4ed23a775feb6fea3e5de1f46f6db9664 +Subproject commit eb6bfc781d8b893920f11723727ca1a64f522f01 From 9091d5d46858e1baa22b8053e6d2598d2e505784 Mon Sep 17 00:00:00 2001 From: Shamasis Bhattacharya Date: Fri, 1 Jan 2016 15:15:20 +0530 Subject: [PATCH 3/3] Upgraded sails-mysql to pm.5 which removes string manipulation from adapter and moves work to wl-sequel for junction tables + also fixed issue with criteria less exec queries failing on deferred. --- package.json | 2 +- waterline | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c77894a..1ccbcff 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dependencies": { "lodash": "3.5.0", "mysql": "2.6.2", - "sails-mysql": "git+https://github.com/postmanlabs/sails-mysql.git#v0.10.12-postman.4" + "sails-mysql": "git+https://github.com/postmanlabs/sails-mysql.git#v0.10.12-postman.5" }, "devDependencies": { "expect.js": "^0.3.1", diff --git a/waterline b/waterline index eb6bfc7..8146800 160000 --- a/waterline +++ b/waterline @@ -1 +1 @@ -Subproject commit eb6bfc781d8b893920f11723727ca1a64f522f01 +Subproject commit 81468000ac72af3ac3a841b404a0ad2d120ec1d8