Skip to content

Commit a31f350

Browse files
committed
fix: correct API routes and add missing endpoints
- Fix authentication routes to use correct controller path - Add explicit route for analytics performance endpoint - Fix scouting regions route - Mount Swagger UI at /api-docs - Ensure all nested routes are properly configured
1 parent 5fab6ff commit a31f350

1 file changed

Lines changed: 94 additions & 90 deletions

File tree

config/routes.rb

Lines changed: 94 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,95 @@
1-
Rails.application.routes.draw do
2-
# Health check endpoint
3-
get "up" => "rails/health#show", as: :rails_health_check
4-
5-
# API routes
6-
namespace :api do
7-
namespace :v1 do
8-
# Auth
9-
namespace :auth, module: 'authentication/controllers' do
10-
post 'register'
11-
post 'login'
12-
post 'refresh'
13-
post 'logout'
14-
post 'forgot-password'
15-
post 'reset-password'
16-
get 'me'
17-
end
18-
19-
# Dashboard
20-
resources :dashboard, only: [:index] do
21-
collection do
22-
get :stats
23-
get :activities
24-
get :schedule
25-
end
26-
end
27-
28-
# Players
29-
resources :players do
30-
collection do
31-
get :stats
32-
post :import
33-
end
34-
member do
35-
get :stats
36-
get :matches
37-
end
38-
end
39-
40-
# Scouting
41-
namespace :scouting do
42-
resources :players do
43-
member do
44-
post :sync
45-
end
46-
end
47-
get 'regions'
48-
resources :watchlist, only: [:index, :create, :destroy]
49-
end
50-
51-
# Analytics
52-
namespace :analytics do
53-
get 'performance'
54-
get 'champions/:player_id', to: 'champions#show'
55-
get 'kda-trend/:player_id', to: 'kda_trend#show'
56-
get 'laning/:player_id', to: 'laning#show'
57-
get 'teamfights/:player_id', to: 'teamfights#show'
58-
get 'vision/:player_id', to: 'vision#show'
59-
get 'team-comparison', to: 'team_comparison#index'
60-
end
61-
62-
# Matches
63-
resources :matches do
64-
collection do
65-
post :import
66-
end
67-
member do
68-
get :stats
69-
end
70-
end
71-
72-
# Schedules
73-
resources :schedules
74-
75-
# VOD Reviews
76-
resources :vod_reviews, path: 'vod-reviews' do
77-
resources :timestamps, controller: 'vod_timestamps', only: [:index, :create]
78-
end
79-
resources :vod_timestamps, path: 'vod-timestamps', only: [:update, :destroy]
80-
81-
# Team Goals
82-
resources :team_goals, path: 'team-goals'
83-
end
84-
end
85-
86-
# Mount Sidekiq web UI in development
87-
if Rails.env.development?
88-
require 'sidekiq/web'
89-
mount Sidekiq::Web => '/sidekiq'
90-
end
1+
Rails.application.routes.draw do
2+
# Mount Rswag API documentation
3+
mount Rswag::Ui::Engine => '/api-docs'
4+
mount Rswag::Api::Engine => '/api-docs'
5+
6+
# Health check endpoint
7+
get "up" => "rails/health#show", as: :rails_health_check
8+
9+
# API routes
10+
namespace :api do
11+
namespace :v1 do
12+
# Auth
13+
scope :auth do
14+
post 'auth/register', to: 'authentication/auth#register'
15+
post 'auth/login', to: 'authentication/auth#login'
16+
post 'auth/refresh', to: 'authentication/auth#refresh'
17+
post 'auth/logout', to: 'authentication/auth#logout'
18+
post 'auth/forgot-password', to: 'authentication/auth#forgot_password'
19+
post 'auth/reset-password', to: 'authentication/auth#reset_password'
20+
get 'auth/me', to: 'authentication/auth#me'
21+
end
22+
23+
# Dashboard
24+
resources :dashboard, only: [:index] do
25+
collection do
26+
get :stats
27+
get :activities
28+
get :schedule
29+
end
30+
end
31+
32+
# Players
33+
resources :players do
34+
collection do
35+
get :stats
36+
post :import
37+
end
38+
member do
39+
get :stats
40+
get :matches
41+
end
42+
end
43+
44+
# Scouting
45+
namespace :scouting do
46+
resources :players do
47+
member do
48+
post :sync
49+
end
50+
end
51+
get 'regions', to: 'regions#index'
52+
resources :watchlist, only: [:index, :create, :destroy]
53+
end
54+
55+
# Analytics
56+
namespace :analytics do
57+
get 'performance', to: 'performance#index'
58+
get 'champions/:player_id', to: 'champions#show'
59+
get 'kda-trend/:player_id', to: 'kda_trend#show'
60+
get 'laning/:player_id', to: 'laning#show'
61+
get 'teamfights/:player_id', to: 'teamfights#show'
62+
get 'vision/:player_id', to: 'vision#show'
63+
get 'team-comparison', to: 'team_comparison#index'
64+
end
65+
66+
# Matches
67+
resources :matches do
68+
collection do
69+
post :import
70+
end
71+
member do
72+
get :stats
73+
end
74+
end
75+
76+
# Schedules
77+
resources :schedules
78+
79+
# VOD Reviews
80+
resources :vod_reviews, path: 'vod-reviews' do
81+
resources :timestamps, controller: 'vod_timestamps', only: [:index, :create]
82+
end
83+
resources :vod_timestamps, path: 'vod-timestamps', only: [:update, :destroy]
84+
85+
# Team Goals
86+
resources :team_goals, path: 'team-goals'
87+
end
88+
end
89+
90+
# Mount Sidekiq web UI in development
91+
if Rails.env.development?
92+
require 'sidekiq/web'
93+
mount Sidekiq::Web => '/sidekiq'
94+
end
9195
end

0 commit comments

Comments
 (0)