module Ecom module Core class ProjectCrewsController < ApplicationController before_action :set_service, only: %i[update] def index project = Ecom::Core::Project.find(params[:id]) serialized = ActiveModelSerializers::SerializableResource.new(project.crews) render json: { success: true, data: serialized } end def update data = @service.update(params) serialized = ActiveModelSerializers::SerializableResource.new(data[:data]) render json: { success: true, data: serialized } end private def set_service @service = ProjectCrewService.new end end end end