diff options
Diffstat (limited to 'lib/api/todos.rb')
-rw-r--r-- | lib/api/todos.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/api/todos.rb b/lib/api/todos.rb index 64ac8ece56c..99aad6eb964 100644 --- a/lib/api/todos.rb +++ b/lib/api/todos.rb @@ -7,22 +7,22 @@ module API before { authenticate! } ISSUABLE_TYPES = { - 'merge_requests' => ->(iid) { find_merge_request_with_access(iid) }, - 'issues' => ->(iid) { find_project_issue(iid) } + "merge_requests" => ->(iid) { find_merge_request_with_access(iid) }, + "issues" => ->(iid) { find_project_issue(iid) }, }.freeze params do - requires :id, type: String, desc: 'The ID of a project' + requires :id, type: String, desc: "The ID of a project" end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do ISSUABLE_TYPES.each do |type, finder| type_id_str = "#{type.singularize}_iid".to_sym - desc 'Create a todo on an issuable' do + desc "Create a todo on an issuable" do success Entities::Todo end params do - requires type_id_str, type: Integer, desc: 'The IID of an issuable' + requires type_id_str, type: Integer, desc: "The IID of an issuable" end post ":id/#{type}/:#{type_id_str}/todo" do issuable = instance_exec(params[type_id_str], &finder) @@ -44,7 +44,7 @@ module API end end - desc 'Get a todo list' do + desc "Get a todo list" do success Entities::Todo end params do @@ -54,21 +54,21 @@ module API present paginate(find_todos), with: Entities::Todo, current_user: current_user end - desc 'Mark a todo as done' do + desc "Mark a todo as done" do success Entities::Todo end params do - requires :id, type: Integer, desc: 'The ID of the todo being marked as done' + requires :id, type: Integer, desc: "The ID of the todo being marked as done" end - post ':id/mark_as_done' do + post ":id/mark_as_done" do TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user) todo = current_user.todos.find(params[:id]) present todo, with: Entities::Todo, current_user: current_user end - desc 'Mark all todos as done' - post '/mark_as_done' do + desc "Mark all todos as done" + post "/mark_as_done" do todos = find_todos TodoService.new.mark_todos_as_done(todos, current_user) |