| @@ -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. | |||||
| @@ -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/ | |||||
| @@ -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 | |||||
| @@ -232,15 +232,6 @@ class ProjectsController < ApplicationController | |||||
| def show | def show | ||||
| end | 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 | def destroy | ||||
| if current_user.admin? || @project.manager?(current_user) | if current_user.admin? || @project.manager?(current_user) | ||||
| ActiveRecord::Base.transaction do | ActiveRecord::Base.transaction do | ||||
| @@ -0,0 +1,2 @@ | |||||
| module Api::Pm::ProjectsHelper | |||||
| end | |||||
| @@ -127,7 +127,6 @@ Rails.application.routes.draw do | |||||
| # blockchain related routes | # blockchain related routes | ||||
| get 'users/blockchain/balance', to: 'users#blockchain_balance' | 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/balance_project', to: 'users#blockchain_balance_one_project' | ||||
| post 'users/blockchain/transfer', to: 'users#blockchain_transfer' | post 'users/blockchain/transfer', to: 'users#blockchain_transfer' | ||||
| post 'users/blockchain/exchange', to: 'users#blockchain_exchange' | post 'users/blockchain/exchange', to: 'users#blockchain_exchange' | ||||
| @@ -16,6 +16,11 @@ defaults format: :json do | |||||
| end | end | ||||
| end | end | ||||
| end | end | ||||
| resources :projects do | |||||
| collection do | |||||
| get :convert | |||||
| end | |||||
| end | |||||
| end | end | ||||
| namespace :v1 do | namespace :v1 do | ||||
| @@ -0,0 +1,5 @@ | |||||
| require 'rails_helper' | |||||
| RSpec.describe Api::Pm::ProjectsController, type: :controller do | |||||
| end | |||||
| @@ -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 | |||||