Skip to content

Commit 63feeb3

Browse files
Apply suggestions from code review
Co-authored-by: Thomas Gauvin <[email protected]>
1 parent ca6aaa2 commit 63feeb3

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

articles/static-web-apps/database-azure-cosmosdb.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Create a sample table and seed it with sample data to match the tutorial.
6868

6969
1. Enter the Container ID of `MyTestPersonContainer`.
7070

71-
1. Enter a partition key of `Id` (this value is prefixed with `/`).
71+
1. Enter a partition key of `id` (this value is prefixed with `/`).
7272

7373
1. Select **OK**.
7474

@@ -183,7 +183,7 @@ Next, create the configuration file that your static web app uses to interface w
183183
184184
```gql
185185
type Person @model {
186-
Id: Id
186+
id: ID
187187
Name: String
188188
}
189189
```
@@ -315,7 +315,7 @@ async function list() {
315315
{
316316
people {
317317
items {
318-
Id
318+
id
319319
Name
320320
}
321321
}
@@ -342,7 +342,7 @@ Refresh the page and select the **List** button.
342342
343343
The browser's console window now displays a table that lists all the records in the database.
344344

345-
| ID | Name |
345+
| id | Name |
346346
|---|---|
347347
| 1 | Sunny |
348348
| 2 | Dheeraj |
@@ -388,15 +388,15 @@ async function get() {
388388
389389
In this example:
390390
391-
* The GraphQL query selects the `Id` and `Name` fields from the database.
391+
* The GraphQL query selects the `id` and `Name` fields from the database.
392392
* The request passed to the server requires a payload where the `query` property holds the query definition.
393393
* Data in the response payload is found in the `data.person_by_pk` property.
394394
395395
Refresh the page and select the **Get** button.
396396
397397
The browser's console window now displays a table listing the single record requested from the database.
398398

399-
| ID | Name |
399+
| id | Name |
400400
|---|---|
401401
| 1 | Sunny |
402402

@@ -414,8 +414,8 @@ async function update() {
414414
415415
const gql = `
416416
mutation update($id: Int!, $item: UpdatePersonInput!) {
417-
updatePerson(Id: $id, item: $item) {
418-
Id
417+
updatePerson(id: $id, item: $item) {
418+
id
419419
Name
420420
}
421421
}`;
@@ -442,7 +442,7 @@ async function update() {
442442
443443
In this example:
444444
445-
* The GraphQL query selects the `Id` and `Name` fields from the database.
445+
* The GraphQL query selects the `id` and `Name` fields from the database.
446446
* The `query` object holds the GraphQL query in the `query` property.
447447
* The argument values to the GraphQL function are passed in via the `query.variables` property.
448448
* The request passed to the server requires a payload where the `query` property holds the query definition.
@@ -452,7 +452,7 @@ Refresh the page and select the **Update** button.
452452
453453
The browser's console window now displays a table showing the updated data.
454454
455-
| ID | Name |
455+
| id | Name |
456456
|---|---|
457457
| 1 | Molly |
458458
@@ -464,13 +464,14 @@ Add the following code between the `script` tags in *index.html*.
464464
async function create() {
465465
466466
const data = {
467+
id: "6",
467468
Name: "Pedro"
468469
};
469470
470471
const gql = `
471472
mutation create($item: CreatePersonInput!) {
472473
createPerson(item: $item) {
473-
Id
474+
id
474475
Name
475476
}
476477
}`;
@@ -496,7 +497,7 @@ async function create() {
496497
497498
In this example:
498499
499-
* The GraphQL query selects the `Id` and `Name` fields from the database.
500+
* The GraphQL query selects the `id` and `Name` fields from the database.
500501
* The `query` object holds the GraphQL query in the `query` property.
501502
* The argument values to the GraphQL function are passed in via the `query.variables` property.
502503
* The request passed to the server requires a payload where the `query` property holds the query definition.
@@ -506,7 +507,7 @@ Refresh the page and select the **Create** button.
506507
507508
The browser's console window now displays a table showing the new record in the database.
508509
509-
| ID | Name |
510+
| id | Name |
510511
|---|---|
511512
| 3 | Pedro |
512513
@@ -521,8 +522,8 @@ async function del() {
521522
522523
const gql = `
523524
mutation del($id: Int!) {
524-
deletePerson(Id: $id) {
525-
Id
525+
deletePerson(id: $id) {
526+
id
526527
}
527528
}`;
528529

articles/static-web-apps/database-configuration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ The purpose of the configuration file is to:
3939

4040
If you're using Azure Cosmos DB with GraphQL, you also need to provide a [`gql` schema file](https://github.com/Azure/data-api-builder/blob/main/docs/getting-started/getting-started-azure-cosmos-db.md).
4141

42+
> [!NOTE]
43+
> Static Web Apps database connections requires a folder containing the configuration files. This folder must contain the *staticwebapp.database.config.json* configuration file for all database types. For Cosmos DB for NoSQL databases, a *staticwebapp.database.schema.gql* schema file is also required.
44+
>
45+
> By convention, this folder is named *swa-db-connections* and placed at the root of the repository. This convention can be overridden with a [custom-configuration-folder](#custom-configuration-folder).
46+
4247
## Sample configuration file
4348

4449
The following sample configuration file shows you how to connect to an Azure SQL database and expose both REST and GraphQL endpoints. For full details on the configuration file and its supported features, refer to the [Data API Builder documentation](https://github.com/Azure/data-api-builder/blob/main/docs/configuration-file.md).

0 commit comments

Comments
 (0)