Rails.application.routes.draw do # Health check get "up" => "rails/health#show", as: :rails_health_check # Root root "pages#home" # === Authentication === devise_for :users, path: "auth", path_names: { 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" } # === 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" # 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 # 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") # === Promoter Dashboard === namespace :promoter do resources :events, path: "my-events" do member do patch :publish, :unpublish, :cancel, :mark_sold_out end resources :ticket_types, path: "ticket-options" do member do post :duplicate end end end end # === API === namespace :api do namespace :v1 do resources :events, except: [:new, :edit] do member do post :store_cart end end end end end