feat(lifecycle): add REST routes for rules, config, deliveries, concierge

Wires 3 new captain namespace resources (lifecycle_rules, lifecycle_config,
lifecycle_deliveries) and a member action `patch :concierge` on units.
Includes stub controllers (to be expanded in Tasks 4-7) and passing routing spec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Rodribm10 2026-04-15 10:11:39 -03:00
parent 7d21530bc7
commit fbc91e2fa8
5 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,5 @@
class Api::V1::Accounts::Captain::LifecycleConfigsController < Api::V1::Accounts::BaseController
def show
head :ok
end
end

View File

@ -0,0 +1,5 @@
class Api::V1::Accounts::Captain::LifecycleDeliveriesController < Api::V1::Accounts::BaseController
def index
head :ok
end
end

View File

@ -0,0 +1,5 @@
class Api::V1::Accounts::Captain::LifecycleRulesController < Api::V1::Accounts::BaseController
def index
head :ok
end
end

View File

@ -92,7 +92,14 @@ Rails.application.routes.draw do
post :label_suggestion
post :follow_up
end
resources :units
resources :lifecycle_rules
resource :lifecycle_config, only: [:show, :update], controller: 'lifecycle_configs'
resources :lifecycle_deliveries, only: [:index, :show]
resources :units do
member do
patch :concierge, action: :update_concierge
end
end
namespace :reports do
resource :operational, only: [:show], controller: 'reports/operational'
resources :insights, only: [:index, :show] do

View File

@ -0,0 +1,27 @@
require 'rails_helper'
RSpec.describe 'Captain lifecycle routes', type: :routing do
it 'routes GET /api/v1/accounts/1/captain/lifecycle_rules' do
expect(get: '/api/v1/accounts/1/captain/lifecycle_rules')
.to route_to(controller: 'api/v1/accounts/captain/lifecycle_rules', action: 'index',
account_id: '1', format: 'json')
end
it 'routes GET /api/v1/accounts/1/captain/lifecycle_config' do
expect(get: '/api/v1/accounts/1/captain/lifecycle_config')
.to route_to(controller: 'api/v1/accounts/captain/lifecycle_configs', action: 'show',
account_id: '1', format: 'json')
end
it 'routes GET /api/v1/accounts/1/captain/lifecycle_deliveries' do
expect(get: '/api/v1/accounts/1/captain/lifecycle_deliveries')
.to route_to(controller: 'api/v1/accounts/captain/lifecycle_deliveries', action: 'index',
account_id: '1', format: 'json')
end
it 'routes PATCH /api/v1/accounts/1/captain/units/5/concierge' do
expect(patch: '/api/v1/accounts/1/captain/units/5/concierge')
.to route_to(controller: 'api/v1/accounts/captain/units', action: 'update_concierge',
account_id: '1', id: '5', format: 'json')
end
end