Browse Source

add project pm

pull/347/head
呱呱呱 2 years ago
parent
commit
840bbff88a
9 changed files with 43 additions and 10 deletions
  1. +2
    -0
      app/assets/javascripts/api/pm/projects.js
  2. +3
    -0
      app/assets/stylesheets/api/pm/projects.scss
  3. +11
    -0
      app/controllers/api/pm/projects_controller.rb
  4. +0
    -9
      app/controllers/projects_controller.rb
  5. +2
    -0
      app/helpers/api/pm/projects_helper.rb
  6. +0
    -1
      config/routes.rb
  7. +5
    -0
      config/routes/api.rb
  8. +5
    -0
      spec/controllers/api/pm/projects_controller_spec.rb
  9. +15
    -0
      spec/helpers/api/pm/projects_helper_spec.rb

+ 2
- 0
app/assets/javascripts/api/pm/projects.js View File

@@ -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.

+ 3
- 0
app/assets/stylesheets/api/pm/projects.scss View File

@@ -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/

+ 11
- 0
app/controllers/api/pm/projects_controller.rb View File

@@ -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

+ 0
- 9
app/controllers/projects_controller.rb View File

@@ -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


+ 2
- 0
app/helpers/api/pm/projects_helper.rb View File

@@ -0,0 +1,2 @@
module Api::Pm::ProjectsHelper
end

+ 0
- 1
config/routes.rb View File

@@ -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'


+ 5
- 0
config/routes/api.rb View File

@@ -16,6 +16,11 @@ defaults format: :json do
end
end
end
resources :projects do
collection do
get :convert
end
end
end

namespace :v1 do


+ 5
- 0
spec/controllers/api/pm/projects_controller_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe Api::Pm::ProjectsController, type: :controller do

end

+ 15
- 0
spec/helpers/api/pm/projects_helper_spec.rb View File

@@ -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

Loading…
Cancel
Save