diff --git a/app/assets/javascripts/api/pm/projects.js b/app/assets/javascripts/api/pm/projects.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/api/pm/projects.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/api/pm/projects.scss b/app/assets/stylesheets/api/pm/projects.scss new file mode 100644 index 000000000..7053c94f2 --- /dev/null +++ b/app/assets/stylesheets/api/pm/projects.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the api/pm/projects controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/api/pm/projects_controller.rb b/app/controllers/api/pm/projects_controller.rb new file mode 100644 index 000000000..4627b189a --- /dev/null +++ b/app/controllers/api/pm/projects_controller.rb @@ -0,0 +1,11 @@ +class Api::Pm::ProjectsController < Api::Pm::BaseController + + def convert + @project = Project.joins(:owner).find params[:project_id] + data = { + owner: @project.owner.try(:login), + identifier: @project.identifier + } + render_ok(data: data) + end +end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2045eb7fd..fbc65960a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -232,15 +232,6 @@ class ProjectsController < ApplicationController def show end - def mp_show - @project = Project.joins(:owner).find params[:project_id] - data={ - owner:@project.owner.try(:login), - identifier:@project.identifier - } - render_ok(data:data) - end - def destroy if current_user.admin? || @project.manager?(current_user) ActiveRecord::Base.transaction do diff --git a/app/helpers/api/pm/projects_helper.rb b/app/helpers/api/pm/projects_helper.rb new file mode 100644 index 000000000..172c270e7 --- /dev/null +++ b/app/helpers/api/pm/projects_helper.rb @@ -0,0 +1,2 @@ +module Api::Pm::ProjectsHelper +end diff --git a/config/routes.rb b/config/routes.rb index 647405bdb..9994206da 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -127,7 +127,6 @@ Rails.application.routes.draw do # blockchain related routes get 'users/blockchain/balance', to: 'users#blockchain_balance' - get 'projects/mp_show', to: 'projects#mp_show' post 'users/blockchain/balance_project', to: 'users#blockchain_balance_one_project' post 'users/blockchain/transfer', to: 'users#blockchain_transfer' post 'users/blockchain/exchange', to: 'users#blockchain_exchange' diff --git a/config/routes/api.rb b/config/routes/api.rb index 382843f89..fc38709ab 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -16,6 +16,11 @@ defaults format: :json do end end end + resources :projects do + collection do + get :convert + end + end end namespace :v1 do diff --git a/spec/controllers/api/pm/projects_controller_spec.rb b/spec/controllers/api/pm/projects_controller_spec.rb new file mode 100644 index 000000000..8b9e3c903 --- /dev/null +++ b/spec/controllers/api/pm/projects_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Api::Pm::ProjectsController, type: :controller do + +end diff --git a/spec/helpers/api/pm/projects_helper_spec.rb b/spec/helpers/api/pm/projects_helper_spec.rb new file mode 100644 index 000000000..b93449cc2 --- /dev/null +++ b/spec/helpers/api/pm/projects_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Api::Pm::ProjectsHelper. For example: +# +# describe Api::Pm::ProjectsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Api::Pm::ProjectsHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end