-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathrouter.ex
146 lines (127 loc) · 6.79 KB
/
router.ex
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
137
138
139
140
141
142
143
144
145
146
defmodule CodeCorpsWeb.Router do
use CodeCorpsWeb, :router
use Plug.ErrorHandler
use Sentry.Plug
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json-api", "json"]
plug JaSerializer.Deserializer
end
pipeline :bearer_auth do
plug CodeCorps.Auth.BearerAuthPipeline
end
pipeline :ensure_auth do
plug CodeCorps.Auth.EnsureAuthPipeline
end
pipeline :current_user do
plug CodeCorpsWeb.Plug.CurrentUser
plug CodeCorpsWeb.Plug.SetSentryUserContext
plug CodeCorpsWeb.Plug.AnalyticsIdentify
end
pipeline :stripe_webhooks do
plug :accepts, ["json"]
end
pipeline :github_webhooks do
plug :accepts, ["json"]
end
pipeline :tracking do
plug CodeCorpsWeb.Plug.Segment
end
scope "/", CodeCorpsWeb do
pipe_through [:browser] # Use the default browser stack
get "/", PageController, :index
end
scope "/", CodeCorpsWeb, host: "api." do
pipe_through [:stripe_webhooks]
post "/webhooks/stripe/connect", StripeConnectEventsController, :create
post "/webhooks/stripe/platform", StripePlatformEventsController, :create
end
scope "/", CodeCorpsWeb, host: "api." do
pipe_through [:github_webhooks]
post "/webhooks/github", GithubEventController, :create, as: :github_events
end
scope "/", CodeCorpsWeb, host: "api." do
pipe_through [:api, :bearer_auth, :ensure_auth, :current_user, :tracking]
resources "/categories", CategoryController, only: [:create, :update]
resources "/comments", CommentController, only: [:create, :update]
resources "/donation-goals", DonationGoalController, only: [:create, :update, :delete]
post "/oauth/github", UserController, :github_oauth
resources "/github-app-installations", GithubAppInstallationController, only: [:create]
resources "/github-events", GithubEventController, only: [:index, :show, :update]
resources "/github-repos", GithubRepoController, only: [:update]
resources "/organization-github-app-installations", OrganizationGithubAppInstallationController, only: [:create, :delete]
resources "/organizations", OrganizationController, only: [:create, :update]
resources "/organization-invites", OrganizationInviteController, only: [:create, :update]
resources "/previews", PreviewController, only: [:create]
resources "/project-categories", ProjectCategoryController, only: [:create, :delete]
resources "/project-skills", ProjectSkillController, only: [:create, :delete]
resources "/project-users", ProjectUserController, only: [:create, :update, :delete]
resources "/projects", ProjectController, only: [:create, :update]
resources "/role-skills", RoleSkillController, only: [:create, :delete]
resources "/roles", RoleController, only: [:create]
resources "/skills", SkillController, only: [:create]
resources "/skills/search", SkillController, only: [:show]
resources "/stripe-connect-accounts", StripeConnectAccountController, only: [:show, :create, :update]
resources "/stripe-connect-plans", StripeConnectPlanController, only: [:show, :create]
resources "/stripe-connect-subscriptions", StripeConnectSubscriptionController, only: [:show, :create]
resources "/stripe-platform-cards", StripePlatformCardController, only: [:show, :create]
resources "/stripe-platform-customers", StripePlatformCustomerController, only: [:show, :create]
resources "/task-skills", TaskSkillController, only: [:create, :delete]
resources "/tasks", TaskController, only: [:create, :update]
resources "/user-categories", UserCategoryController, only: [:create, :delete]
resources "/user-roles", UserRoleController, only: [:create, :delete]
resources "/user-skills", UserSkillController, only: [:create, :delete]
resources "/user-tasks", UserTaskController, only: [:create, :update, :delete]
resources "/users", UserController, only: [:update]
end
scope "/", CodeCorpsWeb, host: "api." do
pipe_through [:api, :bearer_auth, :current_user, :tracking]
post "/token", TokenController, :create
post "/token/refresh", TokenController, :refresh
post "/password/reset", PasswordResetController, :reset_password
resources "/categories", CategoryController, only: [:index, :show]
resources "/comments", CommentController, only: [:index, :show]
resources "/donation-goals", DonationGoalController, only: [:index, :show]
resources "/github-app-installations", GithubAppInstallationController, only: [:index, :show]
resources "/github-issues", GithubIssueController, only: [:index, :show]
resources "/github-pull-requests", GithubPullRequestController, only: [:index, :show]
resources "/github-repos", GithubRepoController, only: [:index, :show]
resources "/organization-github-app-installations", OrganizationGithubAppInstallationController, only: [:index, :show]
resources "/organizations", OrganizationController, only: [:index, :show]
resources "/organization-invites", OrganizationInviteController, only: [:index, :show]
post "/password/forgot", PasswordController, :forgot_password
resources "/project-categories", ProjectCategoryController, only: [:index, :show]
resources "/project-skills", ProjectSkillController, only: [:index, :show]
resources "/project-users", ProjectUserController, only: [:index, :show]
resources "/projects", ProjectController, only: [:index, :show] do
resources "/task-lists", TaskListController, only: [:index, :show]
get "/tasks/:number", TaskController, :show
resources "/tasks", TaskController, only: [:index]
end
resources "/role-skills", RoleSkillController, only: [:index, :show]
resources "/roles", RoleController, only: [:index, :show]
resources "/skills", SkillController, only: [:index, :show]
resources "/task-lists", TaskListController, only: [:index, :show] do
resources "/tasks", TaskController, only: [:index]
get "/tasks/:number", TaskController, :show
end
resources "/task-skills", TaskSkillController, only: [:index, :show]
resources "/tasks", TaskController, only: [:index, :show]
resources "/user-categories", UserCategoryController, only: [:index, :show]
resources "/user-roles", UserRoleController, only: [:index, :show]
resources "/user-skills", UserSkillController, only: [:index, :show]
resources "/user-tasks", UserTaskController, only: [:index, :show]
get "/users/email_available", UserController, :email_available
get "/users/username_available", UserController, :username_available
resources "/users", UserController, only: [:index, :show, :create]
get "/:slug", SluggedRouteController, :show
get "/:slug/projects", ProjectController, :index
get "/:slug/:project_slug", ProjectController, :show
end
end