Sha256: 07d40624854a42ff229e78935f1ae50db84272bc04920e6cfdacdc551209c58a

Contents?: true

Size: 824 Bytes

Versions: 7

Compression:

Stored size: 824 Bytes

Contents

module MnoEnterprise
  class Jpi::V1::Admin::AppCommentsController < Jpi::V1::Admin::BaseResourceController

    # POST /mnoe/jpi/v1/admin/app_comments
    def create
      @app_review = MnoEnterprise::AppComment.new(app_comment_params)

      if @app_review.save
        render :show
      else
        render json: @app_review.errors, status: :bad_request
      end
    end

    private

    def app_comment_params
      # for an admin, the organization does not matter
      organization_id = current_user.organizations.first.id
      params.require(:app_comment).permit(:description)
        .merge(user_id: current_user.id, feedback_id: parent.id, organization_id: organization_id, app_id: parent.app_id)
    end

    def parent
      @parent ||= MnoEnterprise::AppFeedback.find(params[:feedback_id])
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mno-enterprise-api-3.4.0 app/controllers/mno_enterprise/jpi/v1/admin/app_comments_controller.rb
mno-enterprise-api-3.3.3 app/controllers/mno_enterprise/jpi/v1/admin/app_comments_controller.rb
mno-enterprise-api-3.3.2 app/controllers/mno_enterprise/jpi/v1/admin/app_comments_controller.rb
mno-enterprise-api-3.2.1 app/controllers/mno_enterprise/jpi/v1/admin/app_comments_controller.rb
mno-enterprise-api-3.3.1 app/controllers/mno_enterprise/jpi/v1/admin/app_comments_controller.rb
mno-enterprise-api-3.3.0 app/controllers/mno_enterprise/jpi/v1/admin/app_comments_controller.rb
mno-enterprise-api-3.2.0 app/controllers/mno_enterprise/jpi/v1/admin/app_comments_controller.rb