@@ -10,14 +10,20 @@ import {
1010} from '../utils/clinic-appointment.js'
1111import { kebabToCamelCase } from '../utils/string.js'
1212
13+ /**
14+ * @typedef {import('express').Request } Request
15+ * @typedef {import('express').Response } Response
16+ * @typedef {import('express').NextFunction } Next
17+ */
18+
1319export const bookIntoClinicController = {
1420 /**
1521 * Record the session preset
1622 *
17- * @param {* } request
18- * @param {* } response
19- * @param {* } next
20- * @param {* } session_preset_slug
23+ * @param {Request } request
24+ * @param {Response } response
25+ * @param {Next } next
26+ * @param {string } session_preset_slug
2127 */
2228 read ( request , response , next , session_preset_slug ) {
2329 const serviceName = 'Book into a clinic'
@@ -43,8 +49,8 @@ export const bookIntoClinicController = {
4349 /**
4450 * Send to the start page
4551 *
46- * @param {* } request
47- * @param {* } response
52+ * @param {Request } request
53+ * @param {Response } response
4854 */
4955 redirect ( request , response ) {
5056 const { sessionPreset } = response . locals
@@ -55,8 +61,8 @@ export const bookIntoClinicController = {
5561 /**
5662 * Start a new clinic booking for clinics with the primary programme we've been given
5763 *
58- * @param {* } request
59- * @param {* } response
64+ * @param {Request } request
65+ * @param {Response } response
6066 */
6167 new ( request , response ) {
6268 const { data } = request . session
@@ -81,16 +87,17 @@ export const bookIntoClinicController = {
8187 * This includes code to set up radio button groups for various pages (we set them up
8288 * regardless of which specific route we're handling).
8389 *
84- * @param {* } request
85- * @param {* } response
86- * @param {* } next
90+ * @param {Request } request
91+ * @param {Response } response
92+ * @param {Next } next
8793 */
8894 readForm ( request , response , next ) {
8995 const { session_preset_slug, booking_uuid } = request . params
9096 const appointment_uuid = request . params . appointment_uuid
9197 const { data, referrer } = request . session
9298
93- /** NOTE:
99+ /**
100+ * NOTE:
94101 *
95102 * The nature of the journey here is complex, as there are two separate sections in which we need to
96103 * iterate over children. Or over appointments, if you want to think of it that way (each child has
@@ -113,7 +120,7 @@ export const bookIntoClinicController = {
113120 * - Health question n <-- final page of the per-child health question journey; iterate to next child if required
114121 * - Confirmation
115122 *
116- * * /
123+ */
117124
118125 // Create objects on the global context to allow us to check branching conditions, etc.
119126 // And make them available to the view.
@@ -204,8 +211,8 @@ export const bookIntoClinicController = {
204211 /**
205212 * Render the requested form page
206213 *
207- * @param {* } request
208- * @param {* } response
214+ * @param {Request } request
215+ * @param {Response } response
209216 */
210217 showForm ( request , response ) {
211218 const { appointment } = response . locals
@@ -258,24 +265,14 @@ export const bookIntoClinicController = {
258265 ]
259266 }
260267
261- /////////////////////
262- // console.log(`view: ${view}`)
263- // console.log(
264- // `data.wizard: ${JSON.stringify(request.session.data.wizard, null, 2)}`
265- // )
266- // console.log(
267- // `data.appointment: ${JSON.stringify(request.session.data.appointment, null, 2)}`
268- // )
269- /////////////////////
270-
271268 response . render ( `book-into-a-clinic/form/${ view } ` , { key, hasSubQuestions } )
272269 } ,
273270
274271 /**
275272 * Store the latest values entered into a form in the booking journey
276273 *
277- * @param {* } request
278- * @param {* } response
274+ * @param {Request } request
275+ * @param {Response } response
279276 */
280277 updateForm ( request , response ) {
281278 const { booking_uuid, appointment_uuid, view } = request . params
@@ -357,8 +354,8 @@ export const bookIntoClinicController = {
357354 /**
358355 * Catch-all for pages not needing to reference a given clinic booking
359356 *
360- * @param {* } request
361- * @param {* } response
357+ * @param {Request } request
358+ * @param {Response } response
362359 */
363360 show ( request , response ) {
364361 const view = request . params . view || 'start'
0 commit comments