This repository was archived by the owner on Jan 1, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroutes.rb
79 lines (62 loc) · 2.16 KB
/
routes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Rails.application.routes.draw do
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
devise_scope :user do
get 'sign_in', to: 'devise/sessions#new', as: :new_user_session
get 'sign_out', to: 'devise/sessions#destroy', as: :destroy_user_session
end
post 'locale/set', to: 'locale#update'
resources :cards, only: [:index, :show] do
collection do
get 'mine', to: redirect('cards')
get 'select'
end
end
get 'cards/no/:id', to: 'cards#no'
get 'cards/ex/:id', to: 'cards#ex'
get 'packs', to: 'card_packs#index'
resources :npcs, only: [:index, :show] do
post 'add'
post 'remove'
post 'defeated/update', on: :collection, to: 'npcs#update_defeated', as: :update_defeated
end
resources :cards, only: [] do
post 'add'
post 'remove'
post 'set', on: :collection
end
resources :decks do
get 'mine', as: :my, on: :collection
post 'upvote'
post 'downvote'
end
get 'users/:uid', to: 'users#show', as: :user
get 'user/settings', to: 'users#edit'
post 'user/settings', to: 'users#update'
get 'user/import', to: 'users#import'
post 'user/import', to: 'users#submit'
namespace :api do
%w(npcs cards packs decks).each do |model|
resources model, only: [:index, :show], defaults: { format: :json }
end
resources :users, only: :show
end
get 'api/docs', to: redirect('https://documenter.getpostman.com/view/1779678/TzXzDHRR')
get 'commands', to: 'static#commands'
post 'discord/interactions'
namespace :admin do
resources :users, only: :index
resources :npcs, only: [:index, :edit, :update]
resources :cards, only: [:index, :edit, :update] do
delete 'delete_sources'
end
end
get '404', to: 'static#not_found', as: :not_found
match "api/*path", via: :all, to: -> (_) { [404, { 'Content-Type' => 'application/json' },
['{"status": 404, "error": "Not found"}'] ] }
match "*path", via: :all, to: redirect('404')
# Quick 404 for missing images
scope format: true, constraints: { format: 'png' } do
get "/*missing", to: proc { [404, {}, ['']] }
end
root 'static#home'
end