From c580153d376d630da9a2f00189c1f6063bb6dc60 Mon Sep 17 00:00:00 2001 From: Tuomas Liikala Date: Thu, 7 Nov 2024 09:04:49 +0200 Subject: [PATCH] Update part9c.md Should the patients have been fetched before diagnoses? --- src/content/9/en/part9c.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/content/9/en/part9c.md b/src/content/9/en/part9c.md index 43c0e30cdca..f126aa92713 100644 --- a/src/content/9/en/part9c.md +++ b/src/content/9/en/part9c.md @@ -863,15 +863,7 @@ Simillarly the request parameter has the type _Request_ that is also a generic t Similarly to Ilari's flight service, we do not use a real database in our app but instead use hardcoded data that is in the files [diagnoses.ts](https://github.com/fullstack-hy2020/misc/blob/master/diagnoses.ts) and [patients.ts](https://github.com/fullstack-hy2020/misc/blob/master/patients.ts). Get the files and store those in a directory called *data* in your project. All data modification can be done in runtime memory, so during this part, it is *not necessary to write to a file*. -#### 9.10: Patientor backend, step3 - -Create a type *Diagnosis* and use it to create endpoint */api/diagnoses* for fetching all diagnoses with HTTP GET. - -Structure your code properly by using meaningfully-named directories and files. - -**Note** that *diagnoses* may or may not contain the field *latin*. You might want to use [optional properties](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#optional-properties) in the type definition. - -#### 9.11: Patientor backend, step4 +#### 9.11: Patientor backend, step3 Create data type *Patient* and set up the GET endpoint */api/patients* which returns all the patients to the frontend, excluding field *ssn*. Use a [utility type](https://www.typescriptlang.org/docs/handbook/utility-types.html) to make sure you are selecting and returning only the wanted fields. @@ -889,6 +881,14 @@ After creating the endpoint, ensure that the *frontend* shows the list of patien
+#### 9.10: Patientor backend, step4 + +Create a type *Diagnosis* and use it to create endpoint */api/diagnoses* for fetching all diagnoses with HTTP GET. + +Structure your code properly by using meaningfully-named directories and files. + +**Note** that *diagnoses* may or may not contain the field *latin*. You might want to use [optional properties](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#optional-properties) in the type definition. + ### Preventing an accidental undefined result Let's extend the backend to support fetching one specific entry with an HTTP GET request to route *api/diaries/:id*.