diff --git a/lib/Models/Projects.js b/lib/Models/Projects.js index ef0274f..dc23466 100644 --- a/lib/Models/Projects.js +++ b/lib/Models/Projects.js @@ -20,6 +20,7 @@ this.editMember = bind(this.editMember, this); this.addMember = bind(this.addMember, this); this.edit = bind(this.edit, this); + this.create_for_user = bind(this.create_for_user, this); this.create = bind(this.create, this); this.show = bind(this.show, this); this.all = bind(this.all, this); @@ -109,6 +110,21 @@ }); }; + Projects.prototype.create_for_user = function(params, fn) { + if (params == null) { + params = {}; + } + if (fn == null) { + fn = null; + } + this.debug("Projects::create_for_user()"); + return this.post("projects/user/" + params.user_id, params, function(data) { + if (fn) { + return fn(data); + } + }); + }; + Projects.prototype.edit = function(projectId, params, fn) { if (params == null) { params = {}; diff --git a/src/Models/Projects.coffee b/src/Models/Projects.coffee index 8e9314b..017e7cf 100644 --- a/src/Models/Projects.coffee +++ b/src/Models/Projects.coffee @@ -44,6 +44,10 @@ class Projects extends BaseModel @debug "Projects::create()" @post "projects", params, (data) -> fn data if fn + create_for_user: (params={}, fn=null) => + @debug "Projects::create_for_user()" + @post "projects/user/#{params.user_id}", params, (data) -> fn data if fn + edit: (projectId, params={}, fn=null) => @debug "Projects::edit()" @put "projects/#{Utils.parseProjectId projectId}", params, (data) -> fn data if fn