Skip to content

Commit

Permalink
Merge pull request #14 from fuzicast/master
Browse files Browse the repository at this point in the history
Updated collection.load to accept workspace_handle
  • Loading branch information
fbardelli-shutterstock committed Mar 14, 2014
2 parents 1fbbb59 + 3a24e3b commit 3c472f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ Collection.load = function*(args) {

var id = args.id;
var name = args.name;
var workspace_handle = args.workspace_handle;

var criteria = {};

if (id) { criteria.id = id; }
if (name) { criteria.name = name; }
if (workspace_handle) { criteria.workspace_handle = workspace_handle; }

var data = yield models.collections
.find({ where: criteria })
Expand Down
2 changes: 1 addition & 1 deletion routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports.initialize = function(app) {
var data = req.body;
var user_id = api.user.id;

var collection = yield Collection.load({ name: collection_name });
var collection = yield Collection.load({ name: collection_name, workspace_handle: workspace.handle });

if (!collection) return res.json(404, {
message: "couldn't find collection",
Expand Down

0 comments on commit 3c472f7

Please sign in to comment.