25 lines
695 B
Ruby
25 lines
695 B
Ruby
module Suppliers
|
|
class EmployeeShiftsController < Suppliers::ApplicationController
|
|
def index
|
|
render json: current_supplier.employee_shifts, each_serializer: Suppliers::EmployeeShiftSerializer
|
|
end
|
|
def create
|
|
@employee_shift.supplier = current_supplier
|
|
@employee_shift.save
|
|
render json: @employee_shift, serializer: Suppliers::EmployeeShiftSerializer
|
|
end
|
|
|
|
def update
|
|
@employee_shift.update employee_shift_params
|
|
render json: @employee_shift, serializer: Suppliers::EmployeeShiftSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def employee_shift_params
|
|
params.require(:employee_shift).permit(:start_on, :end_on, :employee_id)
|
|
end
|
|
|
|
end
|
|
end
|