From 6b8043d656e10291f68cbc147b6419e0f75150d9 Mon Sep 17 00:00:00 2001 From: chris erway Date: Thu, 12 Mar 2009 13:05:55 +0800 Subject: [PATCH] add new_todo API call that specifies project_id, too Signed-off-by: Reinier Balt --- app/apis/todo_api.rb | 4 ++++ app/controllers/backend_controller.rb | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/app/apis/todo_api.rb b/app/apis/todo_api.rb index 2266310a..bae240b8 100644 --- a/app/apis/todo_api.rb +++ b/app/apis/todo_api.rb @@ -2,6 +2,10 @@ class TodoApi < ActionWebService::API::Base api_method :new_todo, :expects => [{:username => :string}, {:token => :string}, {:context_id => :int}, {:description => :string}, {:notes => :string}], :returns => [:int] + + api_method :new_todo_for_project, + :expects => [{:username => :string}, {:token => :string}, {:context_id => :int}, {:project_id => :int}, {:description => :string}, {:notes => :string}], + :returns => [:int] api_method :new_rich_todo, :expects => [{:username => :string}, {:token => :string}, {:default_context_id => :int}, {:description => :string}, {:notes => :string}], diff --git a/app/controllers/backend_controller.rb b/app/controllers/backend_controller.rb index 206f2e81..0a96cb30 100644 --- a/app/controllers/backend_controller.rb +++ b/app/controllers/backend_controller.rb @@ -11,6 +11,13 @@ class BackendController < ApplicationController item = create_todo(description, context_id, nil, notes) item.id end + + def new_todo_for_project(username, token, context_id, project_id, description, notes) + check_token(username, token) + check_context_belongs_to_user(context_id) + item = create_todo(description, context_id, project_id, notes) + item.id + end def new_rich_todo(username, token, default_context_id, description, notes) check_token(username,token)