Sha256: ec2f8517107ff9e4cd2268147632d3d4355660475d19c899a736fb5f058805a9

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

module Ecom
  module Core
    class ProjectsController < ApplicationController
      before_action :set_project, only: %i[show]
      # GET /projects
      def index
        projects = Ecom::Core::Project.includes(:employer, :contractor, :consultant, :project_manager)
                                      .where(company_id: params[:id])
        serialized = ActiveModelSerializers::SerializableResource.new(projects)
        render json: { success: true, data: serialized }
      end

      def show
        render json: @project
      end

      private

      def set_project
        @project = Project.find(params[:id])
      end

      def model_params
        params.require(:project).permit(:name, :description, :location, :objective, :project_scope, :employer_id,
                                        :contractor_id, :consultant_id, :project_manager_id, :contract_number,
                                        :company_id, :date_contract_signed, :commencement_date, :completion_date,
                                        :contract_amount, :advance_payment, :retention, :remark, :task_template_type_id,
                                        :currency_id)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ecom_core-1.2.31 app/controllers/ecom/core/projects_controller.rb
ecom_core-1.2.30 app/controllers/ecom/core/projects_controller.rb
ecom_core-1.2.29 app/controllers/ecom/core/projects_controller.rb
ecom_core-1.2.28 app/controllers/ecom/core/projects_controller.rb