forked from code-corps/code-corps-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.ex
More file actions
130 lines (113 loc) · 5.75 KB
/
router.ex
File metadata and controls
130 lines (113 loc) · 5.75 KB
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
defmodule CodeCorps.Router do
use CodeCorps.Web, :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 :logging do
plug Timber.ContextPlug
plug Timber.EventPlug
end
pipeline :api do
plug :accepts, ["json-api", "json"]
plug JaSerializer.Deserializer
end
pipeline :bearer_auth do
plug Guardian.Plug.VerifyHeader, realm: "Bearer"
plug Guardian.Plug.LoadResource
end
pipeline :ensure_auth do
plug Guardian.Plug.EnsureAuthenticated
end
pipeline :current_user do
plug CodeCorps.Plug.CurrentUser
plug CodeCorps.Plug.SetSentryUserContext
plug CodeCorps.Plug.AnalyticsIdentify
end
pipeline :stripe_webhooks do
plug :accepts, ["json"]
end
pipeline :tracking do
plug CodeCorps.Plug.Segment
end
scope "/", CodeCorps do
pipe_through [:logging, :browser] # Use the default browser stack
get "/", PageController, :index
end
scope "/", CodeCorps, host: "api." do
pipe_through [:logging, :stripe_webhooks]
post "/webhooks/stripe/connect", StripeConnectEventsController, :create
post "/webhooks/stripe/platform", StripePlatformEventsController, :create
end
scope "/", CodeCorps, host: "api." do
pipe_through [:logging, :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, :update]
resources "/organizations", OrganizationController, 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 "/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 "/", CodeCorps, host: "api." do
pipe_through [:logging, :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 "/organizations", OrganizationController, 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]
resources "/tasks", TaskController, only: [:index, :show]
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, :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