Skip to content

Commit

Permalink
chore: split routes in specific files
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasleger committed Dec 11, 2024
1 parent 2a82786 commit 438b0d1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 31 deletions.
35 changes: 4 additions & 31 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,8 @@

# Routes are in French voluntarily, but inner code is in English.

# Quotes

get "profils", to: "quote_checks#profiles", as: :profiles
match ":profile/devis/verifier",
to: "quote_checks#new",
via: %i[get post],
as: :new_quote_check,
constraints: { profile: /#{QuoteCheck::PROFILES.join('|')}/ }
resources :quote_checks, only: %i[index show], path: "devis" do
member do
get "resultats_verification", to: "quote_checks#show"
get "corriger", to: "quote_checks#edit"
put "corriger", to: "quote_checks#update"
end
end

namespace :api do
namespace :v1 do
resources :profiles, only: %i[index]
resources :quote_checks, only: %i[create show]
end
end

# Website static pages

root "home#index"

get "a_propos", to: "pages#a_propos"
get "contact", to: "pages#contact"

mount GoodJob::Engine => "mdso_good_job"
draw(:api)
draw(:internal)
draw(:webapp)
draw(:website)
end
10 changes: 10 additions & 0 deletions config/routes/api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :profiles, only: %i[index]
resources :quote_checks, only: %i[create show]
end
end
end
5 changes: 5 additions & 0 deletions config/routes/internal.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Rails.application.routes.draw do
mount GoodJob::Engine => "mdso_good_job"
end
19 changes: 19 additions & 0 deletions config/routes/webapp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

Rails.application.routes.draw do
# Quotes

get "profils", to: "quote_checks#profiles", as: :profiles
match ":profile/devis/verifier",
to: "quote_checks#new",
via: %i[get post],
as: :new_quote_check,
constraints: { profile: /#{QuoteCheck::PROFILES.join('|')}/ }
resources :quote_checks, only: %i[index show], path: "devis" do
member do
get "resultats_verification", to: "quote_checks#show"
get "corriger", to: "quote_checks#edit"
put "corriger", to: "quote_checks#update"
end
end
end
10 changes: 10 additions & 0 deletions config/routes/website.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

Rails.application.routes.draw do
# Website static pages

root "home#index"

get "a_propos", to: "pages#a_propos"
get "contact", to: "pages#contact"
end

0 comments on commit 438b0d1

Please sign in to comment.