Files
eminuxCRM/config/routes.rb
T
eminuxandCursor 936930e691 Espone API JSON e MCP HTTP per far lavorare gli agenti sul CRM.
Gli agenti autenticati con token Bearer possono leggere today/pipeline e annotare attività, con host MCP allineati a quelli di produzione.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-02 22:43:46 +02:00

89 lines
2.8 KiB
Ruby

Rails.application.routes.draw do
get "up" => "rails/health#show", as: :rails_health_check
get "t/o/:token.gif", to: "mail_opens#show", as: :mail_open, constraints: { token: /[A-Za-z0-9_-]+/ }
get "login", to: "sessions#new"
post "login", to: "sessions#create"
delete "logout", to: "sessions#destroy"
resource :password, only: %i[edit update]
resources :password_resets, only: %i[new create], path: "password_reset" do
collection do
get ":token/edit", action: :edit, as: :edit
patch ":token", action: :update, as: :update
end
end
# Launcher: scegli il progetto (istanza CRM)
root "home#index"
get "impostazioni", to: "admin#show", as: :admin
# CRUD progetti anche fuori da un'istanza (bootstrap admin)
resources :projects, only: %i[create edit update destroy]
resources :users, except: %i[show]
resources :mail_identities, except: %i[show]
resources :api_tokens, only: %i[index create destroy]
match "/mcp", to: "mcp#handle", via: %i[get post delete]
namespace :api do
namespace :v1 do
get "projects", to: "projects#index"
scope "/p/:project_code" do
get "today", to: "today#show"
get "search", to: "search#show"
get "organizations/:id", to: "organizations#show", as: :organization
post "tasks", to: "tasks#create"
post "tasks/:id/complete", to: "tasks#complete", as: :complete_task
post "activities", to: "activities#create"
patch "opportunities/:id/stage", to: "opportunities#update_stage", as: :opportunity_stage
end
end
end
# Ogni progetto = istanza CRM dedicata
scope "/p/:project_code" do
get "/", to: "dashboard#show", as: :project_root
get "/today", to: "today#show", as: :today
get "/pipeline", to: "pipeline#show", as: :pipeline
get "/search", to: "search#show", as: :search
get "/reports", to: "reports#index", as: :reports
get "/settings", to: "settings#show", as: :settings
patch "/settings/goal(/:id)", to: "settings#update_goal", as: :update_goal_settings
resources :organizations do
resources :activities, only: %i[create edit update destroy]
end
resources :contacts
resources :opportunities do
member do
patch :update_stage
end
end
resources :tasks do
member do
patch :complete
end
end
resources :imports, only: %i[new create]
resources :mail_templates, except: %i[show]
resources :mail_images, only: %i[create]
resources :mailings do
collection do
get :dashboard
end
member do
post :queue
post :cancel
post :test_send
get :test_preview
post :refresh_recipients
patch :update_recipients
get :preview
get :audience
patch :audience, action: :update_audience
end
end
end
end