Class: GroundControl::Api::WorkersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ground_control/api/workers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/ground_control/api/workers_controller.rb', line 8

def index
  page = MissionControl::Jobs::Page.new(
    MissionControl::Jobs::Current.server.workers_relation,
    page: params[:page].to_i,
    page_size: GroundControl::Api.page_size
  )

  render json: { data: PageResource.new(page, inner_resource_class: WorkerResource).serializable_hash }
end

#showObject



18
19
20
21
22
# File 'app/controllers/ground_control/api/workers_controller.rb', line 18

def show
  worker = MissionControl::Jobs::Current.server.find_worker(params[:id])

  render json: { data: WorkerResource.new(worker).serializable_hash }
end