feat: Refactor cart storage to use API architecture

Move store_cart functionality from main EventsController to API namespace:
- Add store_cart method to Api::V1::EventsController with API key bypass
- Remove store_cart from main EventsController
- Update routes to use RESTful API endpoint structure
- Maintain session-based cart storage for frontend compatibility
This commit is contained in:
kbe
2025-08-30 20:12:50 +02:00
parent 6ea3005a65
commit b493027c86
5 changed files with 56 additions and 48 deletions

View File

@@ -39,7 +39,6 @@ Rails.application.routes.draw do
# === Events ===
get "events", to: "events#index", as: "events"
get "events/:slug.:id", to: "events#show", as: "event"
post "events/:slug.:id/store_cart", to: "events#store_cart", as: "store_cart"
# === Tickets ===
get "events/:slug.:id/tickets/new", to: "tickets#new", as: "ticket_new"
@@ -64,7 +63,11 @@ Rails.application.routes.draw do
namespace :api do
namespace :v1 do
# RESTful routes for event management
resources :events, only: [ :index, :show, :create, :update, :destroy ]
resources :events, only: [ :index, :show, :create, :update, :destroy ] do
member do
post :store_cart
end
end
# resources :bundles, only: [ :index, :show, :create, :update, :destroy ]