Class: UffizziCore::Api::Cli::V1::Projects::Deployments::ActivityItemsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UffizziCore::Api::Cli::V1::Projects::Deployments::ActivityItemsController
- Defined in:
- app/controllers/uffizzi_core/api/cli/v1/projects/deployments/activity_items_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
Get activity items for a deployment.
Instance Method Details
#index ⇒ Object
Get activity items for a deployment
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/uffizzi_core/api/cli/v1/projects/deployments/activity_items_controller.rb', line 17 def index deployment = resource_project.deployments.enabled.find(params[:deployment_id]) unless deployment.active? return render json: { errors: { title: [I18n.t('deployment.invalid_state', id: deployment.id, state: deployment.state)] } }, status: :unprocessable_entity end activity_items = deployment .activity_items .page(page) .per(per_page) .order(updated_at: :desc) .ransack(q_param) .result = (activity_items) activity_items = activity_items.map do |activity_item| UffizziCore::Api::Cli::V1::Projects::Deployments::ActivityItemSerializer.new(activity_item).as_json end render json: { activity_items: activity_items, meta: , } end |