-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
routes.rb
136 lines (115 loc) · 4.37 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
Rails.application.routes.draw do
if !Rails.application.multi_tenancy?
mount Rswag::Api::Engine => '/api-docs'
end
if Rails.application.multi_tenancy?
constraints subdomain: 'showcase' do
root to: 'static_pages#showcase', as: :showcase
end
constraints subdomain: 'api' do
mount Rswag::Api::Engine => '/api-docs'
end
constraints subdomain: 'login' do
get '/signup', to: 'tenants#new'
get '/is_available', to: 'tenants#is_available'
resource :tenants, only: [:create]
end
constraints subdomain: 'billing' do
get '/billing', to: 'billing#index'
get '/billing/return', to: 'billing#return'
post '/create_checkout_session', to: 'billing#create_checkout_session'
get '/session_status', to: 'billing#session_status'
post '/webhook', to: 'billing#webhook'
end
end
constraints subdomain: /.*/ do
root to: 'static_pages#root'
get '/roadmap', to: 'static_pages#roadmap'
get '/embedded_roadmap', to: 'static_pages#embedded_roadmap'
get '/pending-tenant', to: 'static_pages#pending_tenant'
get '/blocked-tenant', to: 'static_pages#blocked_tenant'
get '/request_billing_page', to: 'billing#request_billing_page'
devise_for :users, :controllers => {
:registrations => 'registrations',
:sessions => 'sessions',
:passwords => 'passwords'
}
devise_scope :user do
get '/users/send_set_password_instructions', to: 'registrations#send_set_password_instructions', as: :send_set_password_instructions
end
resources :tenants, only: [:show, :update]
resources :users, only: [:index, :update]
resources :webhooks, only: [:index, :create, :update, :destroy]
put '/webhooks_preview', to: 'webhooks#preview'
put '/webhooks/:id/test', to: 'webhooks#test'
resources :o_auths, only: [:index, :create, :update, :destroy] do
resource :tenant_default_o_auths, only: [:create, :destroy]
end
get '/o_auths/:id/start', to: 'o_auths#start', as: :o_auth_start
get '/o_auths/:id/callback', to: 'o_auths#callback', as: :o_auth_callback
get '/o_auths/sign_in_from_oauth_token', to: 'o_auths#sign_in_from_oauth_token', as: :o_auth_sign_in_from_oauth_token
resources :posts, only: [:index, :create, :show, :update, :destroy] do
resource :follows, only: [:create, :destroy]
resources :follows, only: [:index]
resource :likes, only: [:create, :destroy]
resources :likes, only: [:index]
resources :comments, only: [:index, :create, :update, :destroy]
resources :post_status_changes, only: [:index]
get '/moderation', on: :collection, to: 'posts#moderation'
end
resources :boards, only: [:index, :create, :update, :destroy, :show] do
patch 'update_order', on: :collection
end
resources :post_statuses, only: [:index, :create, :update, :destroy] do
patch 'update_order', on: :collection
end
resources :invitations, only: [:create]
post '/invitations/test', to: 'invitations#test', as: :invitation_test
resources :api_keys, only: [:create]
namespace :site_settings do
get 'general'
get 'authentication'
get 'boards'
get 'post_statuses'
get 'roadmap'
get 'webhooks'
get 'invitations'
get 'appearance'
end
namespace :moderation do
get 'feedback'
get 'users'
end
# API routes
namespace :api do
namespace :v1 do
resources :boards, only: [:index, :show, :create]
resources :post_statuses, only: [:index]
resources :posts, only: [:index, :show, :create, :update, :destroy] do
member do
put :update_board, :update_status, :approve, :reject
end
end
resources :comments, only: [:index, :show, :create, :update, :destroy] do
member do
put :mark_as_post_update, :unmark_as_post_update
end
end
resources :votes, only: [:index, :show, :create, :destroy], controller: 'likes'
resources :users, only: [:index, :show, :create] do
collection do
get :get_by_email, controller: 'users', action: 'show_by_email'
end
member do
put :block
end
end
end
end
end
# Healthcheck endpoint
get '/health', to: proc {
Tenant.first # to make sure db works
[200, {}, ['success']]
}
end