feat: improve seo urls?
This commit is contained in:
128
config/routes.rb
128
config/routes.rb
@@ -1,81 +1,72 @@
|
||||
Rails.application.routes.draw do
|
||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
||||
|
||||
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
||||
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
||||
# Health check
|
||||
get "up" => "rails/health#show", as: :rails_health_check
|
||||
|
||||
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
||||
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
||||
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
|
||||
|
||||
# Defines the root path route ("/")
|
||||
|
||||
# Root
|
||||
root "pages#home"
|
||||
|
||||
# === Devise ===
|
||||
# Routes for devise authentication Gem
|
||||
# Bind devise to user
|
||||
# === Authentication ===
|
||||
devise_for :users, path: "auth", path_names: {
|
||||
sign_in: "sign_in", # Route for user login
|
||||
sign_out: "sign_out", # Route for user logout
|
||||
password: "reset-password", # Route for changing password
|
||||
confirmation: "verification", # Route for account confirmation
|
||||
unlock: "unblock", # Route for account unlock
|
||||
# registration: "account", # Route for user account
|
||||
sign_up: "signup" # Route for user registration
|
||||
},
|
||||
controllers: {
|
||||
sessions: "auth/sessions", # Custom controller for sessions
|
||||
registrations: "auth/registrations", # Custom controller for registrations
|
||||
passwords: "auth/passwords", # Custom controller for passwords
|
||||
confirmation: "auth/confirmations" # Custom controller for confirmations
|
||||
sign_in: "sign_in",
|
||||
sign_out: "sign_out",
|
||||
password: "reset-password",
|
||||
confirmation: "verification",
|
||||
unlock: "unblock",
|
||||
sign_up: "signup"
|
||||
}, controllers: {
|
||||
sessions: "auth/sessions",
|
||||
registrations: "auth/registrations",
|
||||
passwords: "auth/passwords",
|
||||
confirmation: "auth/confirmations"
|
||||
}
|
||||
|
||||
# === Pages ===
|
||||
get "dashboard", to: "pages#dashboard", as: "dashboard"
|
||||
# === Main App - SEO Friendly URLs ===
|
||||
get "dashboard", to: "pages#dashboard"
|
||||
|
||||
# Events with date-based SEO structure
|
||||
get "events", to: "events#index", as: "events"
|
||||
get "events/:year/:month/:slug", to: "events#show", as: "event",
|
||||
constraints: { year: /\d{4}/, month: /\d{2}/ }
|
||||
|
||||
# Booking workflow with semantic URLs
|
||||
get "events/:year/:month/:slug/book-tickets", to: "orders#new", as: "book_event_tickets",
|
||||
constraints: { year: /\d{4}/, month: /\d{2}/ }
|
||||
post "events/:year/:month/:slug/book-tickets", to: "orders#create", as: "create_booking",
|
||||
constraints: { year: /\d{4}/, month: /\d{2}/ }
|
||||
|
||||
# Checkout process with semantic URLs
|
||||
get "events/:year/:month/:slug/checkout", to: "orders#checkout", as: "event_checkout",
|
||||
constraints: { year: /\d{4}/, month: /\d{2}/ }
|
||||
get "booking/:order_id/summary", to: "orders#show", as: "booking_summary"
|
||||
post "booking/:order_id/retry-payment", to: "orders#retry_payment", as: "retry_booking_payment"
|
||||
post "booking/:order_id/increment-attempts", to: "orders#increment_payment_attempt", as: "increment_booking_attempts"
|
||||
|
||||
# Individual tickets with descriptive URLs
|
||||
get "tickets/:event_slug-:ticket_id", to: "tickets#show", as: "ticket"
|
||||
get "tickets/:event_slug-:ticket_id/view", to: "tickets#view", as: "view_ticket"
|
||||
get "tickets/:event_slug-:ticket_id/download", to: "tickets#download", as: "download_ticket"
|
||||
post "tickets/:event_slug-:ticket_id/retry-payment", to: "tickets#retry_payment", as: "retry_ticket_payment"
|
||||
|
||||
# === Events ===
|
||||
get "events", to: "events#index", as: "events"
|
||||
get "events/:slug.:id", to: "events#show", as: "event"
|
||||
|
||||
# === Orders (scoped to events) ===
|
||||
get "orders/new/events/:slug.:id", to: "orders#new", as: "event_order_new"
|
||||
post "orders/create/events/:slug.:id", to: "orders#create", as: "event_order_create"
|
||||
|
||||
resources :orders, only: [ :show ] do
|
||||
member do
|
||||
get :checkout
|
||||
post :retry_payment
|
||||
post :increment_payment_attempt
|
||||
end
|
||||
# Payment callbacks with descriptive paths
|
||||
namespace :booking do
|
||||
get "payment-success", to: "payments#success", as: "payment_success"
|
||||
get "payment-cancelled", to: "payments#cancel", as: "payment_cancelled"
|
||||
end
|
||||
|
||||
get "orders/payments/success", to: "orders#payment_success", as: "order_payment_success"
|
||||
get "orders/payments/cancel", to: "orders#payment_cancel", as: "order_payment_cancel"
|
||||
# Legacy redirects for backward compatibility
|
||||
get "events/:slug", to: "legacy_redirects#event_redirect"
|
||||
|
||||
# Legacy payment routes
|
||||
get "payments/success", to: redirect("/booking/payment-success")
|
||||
get "payments/cancel", to: redirect("/booking/payment-cancelled")
|
||||
|
||||
# legacy routes
|
||||
get "payments/success", to: "tickets#payment_success", as: "payment_success"
|
||||
get "payments/cancel", to: "tickets#payment_cancel", as: "payment_cancel"
|
||||
|
||||
# === Tickets ===
|
||||
get "tickets/checkout/events/:slug.:id", to: "tickets#checkout", as: "ticket_checkout"
|
||||
post "tickets/retry/events/:slug.:id", to: "tickets#retry_payment", as: "ticket_retry_payment"
|
||||
get "tickets/:ticket_id", to: "tickets#show", as: "ticket"
|
||||
get "tickets/:ticket_id/view", to: "tickets#ticket_view", as: "ticket_view"
|
||||
get "tickets/:ticket_id/download", to: "tickets#download_ticket", as: "download_ticket"
|
||||
|
||||
# === Promoter Routes ===
|
||||
# === Promoter Dashboard ===
|
||||
namespace :promoter do
|
||||
resources :events do
|
||||
resources :events, path: "my-events" do
|
||||
member do
|
||||
patch :publish
|
||||
patch :unpublish
|
||||
patch :cancel
|
||||
patch :mark_sold_out
|
||||
patch :publish, :unpublish, :cancel, :mark_sold_out
|
||||
end
|
||||
|
||||
# Nested ticket types routes
|
||||
resources :ticket_types do
|
||||
resources :ticket_types, path: "ticket-options" do
|
||||
member do
|
||||
post :duplicate
|
||||
end
|
||||
@@ -83,17 +74,14 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# API routes versioning
|
||||
# === API ===
|
||||
namespace :api do
|
||||
namespace :v1 do
|
||||
# RESTful routes for event management
|
||||
resources :events, only: [ :index, :show, :create, :update, :destroy ] do
|
||||
resources :events, except: [:new, :edit] do
|
||||
member do
|
||||
post :store_cart
|
||||
end
|
||||
end
|
||||
# resources :ticket_types, only: [ :index, :show, :create, :update, :destroy ]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user