Class: UffizziCore::Api::Cli::V1::Projects::Deployments::ActivityItemsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/uffizzi_core/api/cli/v1/projects/deployments/activity_items_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

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
# File 'app/controllers/uffizzi_core/api/cli/v1/projects/deployments/activity_items_controller.rb', line 17

def index
  activity_items = resource_deployment
    .activity_items
    .page(page)
    .per(per_page)
    .order(updated_at: :desc)
    .ransack(q_param)
    .result

  meta = meta(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: meta,
  }
end