Class: Spree::Api::V2::Operator::CheckInsController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/spree/api/v2/operator/check_ins_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/spree/api/v2/operator/check_ins_controller.rb', line 14

def create
  spree_authorize! :create, model_class

  result = SpreeCmCommissioner::CheckIns::CreateBulk.call(
    check_ins_attributes: [{ guest_id: params[:guest_id], check_in_session_id: params[:check_in_session_id] }],
    check_in_by: spree_current_user
  )

  if result.success?
    render_serialized_payload(201) { serialize_resource(result.value[:check_ins][0]) }
  else
    render_error_payload(result.error)
  end
end

#indexObject



8
9
10
11
12
# File 'app/controllers/spree/api/v2/operator/check_ins_controller.rb', line 8

def index
  render_serialized_payload do
    serialize_collection(paginated_collection)
  end
end