serializer stuff
This commit is contained in:
@@ -7,12 +7,12 @@ module Suppliers
|
||||
@employee_shifts.select! do |shift|
|
||||
current_supplier.employee_ids.include?(shift.employee.try(:id))
|
||||
end
|
||||
render json: JSONAPI::Serializer.serialize(@employee_shifts, serializer: Suppliers::EmployeeShiftSerializer, is_collection: true, include: %w[employee supplier])
|
||||
render json: JSONAPI::Serializer.serialize(@employee_shifts, serializer: Suppliers::EmployeeShiftSerializer, is_collection: true, include: %w[employee])
|
||||
end
|
||||
def create
|
||||
@employee_shift.supplier = current_supplier
|
||||
@employee_shift.save
|
||||
render json: JSONAPI::Serializer.serialize(@employee_shift, serializer: Suppliers::EmployeeShiftSerializer, include: %w[employee supplier])
|
||||
render json: JSONAPI::Serializer.serialize(@employee_shift, serializer: Suppliers::EmployeeShiftSerializer, include: %w[employee])
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -31,6 +31,5 @@ module Suppliers
|
||||
def employee_shift_params
|
||||
params.require(:employee_shift).permit(:start_from, :end_on, :employee_id, :description)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,13 +23,9 @@ module Suppliers
|
||||
|
||||
render json: JSONAPI::Serializer.serialize(@lists, serializer: Suppliers::ListSerializer, is_collection: true, include: %w[
|
||||
orders
|
||||
orders.list
|
||||
orders.user
|
||||
orders.product_orders
|
||||
orders.product_orders.product
|
||||
users
|
||||
section
|
||||
table
|
||||
])
|
||||
end
|
||||
|
||||
|
||||
@@ -6,6 +6,15 @@ module Suppliers
|
||||
|
||||
def show
|
||||
current_supplier.sections.include_relations(:tables, :section_areas, :section_elements, product_categories: {products: :product_variants})
|
||||
#render json: JSONAPI::Serializer.serialize(current_supplier, serializer: Suppliers::SupplierSerializer, include: %w[
|
||||
#sections
|
||||
#sections.tables
|
||||
#sections.section_areas
|
||||
#sections.section_elements
|
||||
#product_categories
|
||||
#product_categories.products
|
||||
#product_categories.products.product_variants
|
||||
#]) #.new(current_supplier).as_json
|
||||
render json: JSONAPI::Serializer.serialize(current_supplier, serializer: Suppliers::SupplierSerializer, include: %w[
|
||||
sections
|
||||
sections.tables
|
||||
@@ -14,7 +23,7 @@ module Suppliers
|
||||
product_categories
|
||||
product_categories.products
|
||||
product_categories.products.product_variants
|
||||
]) #.new(current_supplier).as_json
|
||||
])
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
Reference in New Issue
Block a user