-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathroutes.rb
More file actions
421 lines (348 loc) · 12.9 KB
/
routes.rb
File metadata and controls
421 lines (348 loc) · 12.9 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# frozen_string_literal: true
require "sidekiq/web"
require "sidekiq-scheduler/web"
require "sidekiq/throttled/web"
require "sidekiq_unique_jobs/web"
Rails.application.routes.draw do
# Redirect www subdomain to root in production envs
unless Rails.env.local?
match "(*any)",
to: redirect(subdomain: ""),
via: :all,
constraints: {
subdomain: "www"
}
end
get "/logout", to: "users/logout#show"
if Settings.cis2.enabled
devise_for :users,
module: :users,
controllers: {
omniauth_callbacks: "users/omniauth_callbacks"
}
devise_scope :user do
post "/users/auth/cis2/backchannel-logout",
to: "users/omniauth_callbacks#cis2_logout"
delete "/logout", to: "users/omniauth_callbacks#logout"
end
else
devise_for :users,
module: :users,
path_names: {
sign_in: "sign-in",
sign_out: "sign-out"
}
devise_scope :user do
delete "/logout", to: "users/sessions#destroy"
end
end
root to: redirect("/start")
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
ActiveSupport::SecurityUtils.secure_compare(
Rails.application.credentials.support_username,
username
) &&
ActiveSupport::SecurityUtils.secure_compare(
Rails.application.credentials.support_password,
password
)
end
mount Sidekiq::Web => "/sidekiq"
get "/start", to: "start#index"
get "/dashboard", to: "dashboard#index"
get "/accessibility-statement", to: "accessibility_statement#index"
get "/manifest/:name-:digest.json", to: "manifest#show", as: :manifest
get "/manifest/:name.json", to: "manifest#show"
get "/up", to: "rails/health#show", as: :rails_health_check
flipper_app =
Flipper::UI.app do |builder|
builder.use Rack::Auth::Basic do |username, password|
ActiveSupport::SecurityUtils.secure_compare(
Rails.application.credentials.support_username,
username
) &&
ActiveSupport::SecurityUtils.secure_compare(
Rails.application.credentials.support_password,
password
)
end
end
mount flipper_app, at: "/flipper"
unless Rails.env.production?
get "/random-consent-form(/:slug)", to: "dev/random_consent_form#call"
end
get "/csrf", to: "csrf#new"
namespace :parent_interface, path: "/" do
resources :consent_forms, path: "/consents", only: %i[create] do
collection do
get ":session_slug_or_team_location_id/:programme_types/start",
action: :start,
as: :start
get ":session_slug_or_team_location_id/:programme_types/deadline-passed",
action: :deadline_passed,
as: :deadline_passed
end
member do
get "cannot-consent-responsibility",
action: :cannot_consent_responsibility
get "confirm"
put "record"
get "submitted"
end
resources :edit, only: %i[show update], controller: "consent_forms/edit"
end
end
namespace :api do
unless Rails.env.production?
namespace :testing do
post "onboard", to: "onboard#create"
resources :locations, only: :index
resources :teams, only: :destroy, param: :workgroup do
delete "locations", action: :destroy_locations, on: :member
end
get "refresh-reporting", to: "refresh_reporting#create"
post "vaccinations-search-in-nhs",
to: "vaccinations_search_in_nhs#create"
get "vaccinations-search-in-nhs", to: "vaccinations_search_in_nhs#show"
end
end
namespace :reporting do
post "authorize", to: "one_time_tokens#authorize"
get "totals", controller: :totals, action: :index
end
end
resources :class_imports, path: "class-imports", except: %i[index destroy] do
member do
get :re_review, to: "class_imports#re_review"
get :imported_records, to: "class_imports#imported_records"
post :approve, to: "class_imports#approve"
post :cancel, to: "class_imports#cancel"
end
end
get "/cohort_imports/:id", to: redirect("/cohort-imports/%{id}")
resources :cohort_imports,
path: "cohort-imports",
except: %i[index destroy] do
member do
get :re_review, to: "cohort_imports#re_review"
get :imported_records, to: "cohort_imports#imported_records"
post :approve, to: "cohort_imports#approve"
post :cancel, to: "cohort_imports#cancel"
end
end
resources :consent_forms, path: "consent-forms", only: %i[index show] do
member do
get "search"
get "match/:patient_id", action: :edit_match, as: :match
post "match/:patient_id", action: :update_match
get "archive", action: :edit_archive
post "archive", action: :update_archive
get "patient", action: :new_patient
post "patient", action: :create_patient
end
end
resource :draft_import, only: %i[show update], path: "draft-import/:id"
resource :draft_consent, only: %i[show update], path: "draft-consent/:id"
resource :draft_session, only: %i[show update], path: "draft-session/:id"
resource :draft_vaccination_record,
only: %i[show update],
path: "draft-vaccination-record/:id"
resource :draft_school, only: %i[show update], path: "draft-school/:id"
resources :immunisation_imports,
path: "immunisation-imports",
except: %i[index destroy]
resources :imports, only: %i[index create] do
collection { get :records }
end
namespace :imports do
resources :issues, path: "issues", only: %i[index] do
get ":type", action: :show, on: :member, as: ""
patch ":type", action: :update, on: :member
end
resources :notices, only: %i[index destroy] do
member { get :dismiss }
end
get "bulk_remove_parents/:import_type/:import_id",
to: "bulk_remove_parents#new",
as: :bulk_remove_parents
post "bulk_remove_parents/:import_type/:import_id",
to: "bulk_remove_parents#create"
end
resources :notifications, only: :create
resources :patients, only: %i[index show edit] do
post "", action: :index, on: :collection
resource :archive,
path: "archive",
only: %i[new create],
controller: "patients/archive"
resources :parent_relationships,
path: "parents",
only: %i[new create edit update destroy] do
get "destroy", action: :confirm_destroy, on: :member, as: "destroy"
end
resources :programmes,
only: :show,
param: :type,
controller: "patients/programmes" do
member do
post "invite-to-clinic", action: :invite_to_clinic
post "record-already-vaccinated", action: :record_already_vaccinated
post "record-new-vaccination", action: :record_new_vaccination
post "send-consent-request", action: :send_consent_request
end
end
member do
get "pds-search-history"
get "edit/nhs-number",
controller: "patients/edit",
action: "edit_nhs_number"
put "edit/nhs-number",
controller: "patients/edit",
action: "update_nhs_number"
put "edit/nhs-number-merge",
controller: "patients/edit",
action: "update_nhs_number_merge"
get "edit/ethnic-group", to: "patients/edit#edit_ethnic_group"
put "edit/ethnic-group", to: "patients/edit#update_ethnic_group"
get "edit/ethnic-background", to: "patients/edit#edit_ethnic_background"
put "edit/ethnic-background", to: "patients/edit#update_ethnic_background"
get "edit/school", controller: "patients/edit", action: "edit_school"
put "edit/school", controller: "patients/edit", action: "update_school"
end
end
resources :careplus_reports,
path: "careplus-reports",
controller: "careplus_reports",
only: %i[index show] do
member { get :download }
end
resources :reports, only: :index
resources :school_moves, path: "school-moves", only: %i[index show update]
resources :school_move_exports,
path: "school-moves/exports",
controller: "school_moves/exports",
only: %i[create show update] do
get "download", on: :member
end
resources :schools, only: :index, param: :urn_and_site do
resource :invite_to_clinic,
only: %i[edit update],
path: "invite-to-clinic",
controller: "schools/invite_to_clinic"
resources :import, only: :new, controller: "schools/import"
resources :patients, only: :index, controller: "schools/patients"
resources :sessions, only: :index, controller: "schools/sessions"
end
resources :sessions, only: %i[index new show edit], param: :slug do
resource :patients, only: :show, controller: "sessions/patients" do
post ":patient_id/register/:status", as: :register, action: :register
end
resource :patient_specific_directions,
path: "patient-specific-directions",
only: %i[show new create],
controller: "sessions/patient_specific_directions"
resource :record, only: :show, controller: "sessions/record" do
get "batch/:programme_type/:vaccine_method",
action: :edit_batch,
as: :batch
post "batch/:programme_type/:vaccine_method", action: :update_batch
end
resource :invite_to_clinic,
path: "invite-to-clinic",
only: %i[edit update],
controller: "sessions/invite_to_clinic"
resource :manage_consent_reminders,
path: "manage-consent-reminders",
only: %i[show create],
controller: "sessions/manage_consent_reminders"
member do
get "import"
constraints -> { Flipper.enabled?(:dev_tools) } do
put "make-in-progress", to: "sessions#make_in_progress"
end
end
resources :patient_sessions,
path: "patients",
as: :patient,
only: [],
module: :patient_sessions do
resource :activity, only: %i[show create]
resource :attendance, only: %i[edit update]
resources :programmes, path: "", param: :type, only: :show do
get "record-already-vaccinated"
resources :consents, only: %i[index create show] do
post "send-request", on: :collection, action: :send_request
member do
get "follow-up", action: :edit_follow_up
post "follow-up", action: :update_follow_up
get "confirm-refusal", action: :edit_confirm_refusal
post "confirm-refusal", action: :update_confirm_refusal
get "withdraw", action: :edit_withdraw
post "withdraw", action: :update_withdraw
get "invalidate", action: :edit_invalidate
post "invalidate", action: :update_invalidate
end
end
resource :gillick_assessment, path: "gillick", only: %i[edit update]
resource :triages, only: %i[new create]
resource :vaccinations, only: %i[create]
end
end
end
resource :team, only: [] do
member do
get :contact_details
get :schools
get :sessions
get :clinics
end
resources :schools,
only: %i[new create edit update],
param: :urn_and_site,
controller: "teams/schools" do
collection { get :new_site }
end
end
resources :vaccination_records,
path: "vaccination-records",
only: %i[show update destroy] do
get "destroy", action: :confirm_destroy, on: :member, as: "destroy"
end
resource :vaccination_report, path: "vaccination-report", only: %i[new create]
get "consent-form/:type",
to: "consent_form_downloads#show",
as: :consent_form_download
resources :vaccines, only: %i[index show] do
resources :batches, only: %i[create edit new update] do
member do
get "archive", action: "edit_archive"
post "archive", action: "update_archive"
post "make-default", as: :make_default
end
end
end
namespace :users do
get "organisation-not-found", controller: :errors
get "workgroup-not-found", controller: :errors
get "role-not-found", controller: :errors
resource :teams, only: %i[new create]
devise_scope :user do
get "sessions/time-remaining", to: "sessions#time_remaining"
post "sessions/refresh", to: "sessions#refresh"
end
end
scope via: :all do
get "/404", to: "errors#not_found"
get "/422", to: "errors#unprocessable_entity"
get "/429", to: "errors#too_many_requests"
get "/500", to: "errors#internal_server_error"
end
get "/oidc/jwks", to: "jwks#jwks"
namespace :inspect do
get "dashboard", to: "dashboard#index"
get "graph/:object_type/:object_id", to: "graphs#show"
namespace :timeline do
resources :patients, only: [:show]
end
end
end