switch to JSONAPI for suppliers

This commit is contained in:
2015-09-09 09:12:30 +02:00
parent 9c1945252d
commit 5cdbe57dec
10 changed files with 58 additions and 11 deletions
@@ -2,7 +2,7 @@ module Employees
class EmployeeShiftsController < Employees::ApplicationController
def index
@employee_shifts = EmployeeShift.for_employee(current_employee).include_relation(:supplier)
render json: @employee_shifts, each_serializer: Employees::EmployeeShiftSerializer
render json: JSONAPI::Serializer.serialize(@employee_shifts, serializer: Employees::EmployeeShiftSerializer, is_collection: true)
end
end
end
@@ -2,7 +2,7 @@ module Employees
class SuppliersController < Employees::ApplicationController
def index
@suppliers = current_employee.suppliers
render json: @suppliers, each_serializer: Employees::SupplierSerializer
render json: JSONAPI::Serializer.serialize(@suppliers, serializer: Employees::SupplierSerializer, is_collection: true)
end
end
end
@@ -23,6 +23,7 @@ module Suppliers
render json: JSONAPI::Serializer.serialize(@lists, serializer: Suppliers::ListSerializer, is_collection: true, include: %w[
orders
orders.list
orders.product_orders
orders.product_orders.order
orders.product_orders.product