Skip to content

Commit 29ac3e3

Browse files
committed
un-array-atize auth rules on relationship modeling page
1 parent 45d52e6 commit 29ac3e3

File tree

1 file changed

+6
-6
lines changed
  • src/pages/[platform]/build-a-backend/data/data-modeling/relationships

1 file changed

+6
-6
lines changed

src/pages/[platform]/build-a-backend/data/data-modeling/relationships/index.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const schema = a.schema({
7070
// from the `Member`s model.
7171
members: a.hasMany('Member', 'teamId'),
7272
}),
73-
}).authorization(allow => [allow.publicApiKey()]);
73+
}).authorization((allow) => allow.publicApiKey());
7474
```
7575

7676
### Create a "Has Many" relationship between records
@@ -462,7 +462,7 @@ const schema = a.schema({
462462
// from the Cart model
463463
activeCart: a.hasOne('Cart', 'customerId')
464464
}),
465-
}).authorization(allow => [allow.publicApiKey()]);
465+
}).authorization((allow) => allow.publicApiKey());
466466
```
467467

468468
### Create a "Has One" relationship between records
@@ -830,7 +830,7 @@ const schema = a.schema({
830830
// highlight-next-line
831831
posts: a.hasMany('PostTag', 'tagId'),
832832
}),
833-
}).authorization(allow => [allow.publicApiKey()]);
833+
}).authorization((allow) => allow.publicApiKey());
834834
```
835835

836836
## Model multiple relationships between two models
@@ -856,7 +856,7 @@ const schema = a.schema({
856856
authoredPosts: a.hasMany('Post', 'authorId'),
857857
// highlight-end
858858
}),
859-
}).authorization(allow => [allow.publicApiKey()]);
859+
}).authorization((allow) => allow.publicApiKey());
860860
```
861861

862862
On the client-side, you can fetch the related data with the following code:
@@ -919,7 +919,7 @@ const schema = a.schema({
919919
authoredPosts: a.hasMany('Post', ['authorName', 'authorDoB']),
920920
// highlight-next-line
921921
}).identifier(['name', 'dateOfBirth']),
922-
}).authorization(allow => [allow.publicApiKey()]);
922+
}).authorization((allow) => allow.publicApiKey());
923923
```
924924

925925
## Make relationships required or optional
@@ -949,5 +949,5 @@ const schema = a.schema({
949949
authoredPosts: a.hasMany('Post', 'authorId'),
950950
// highlight-end
951951
}),
952-
}).authorization(allow => [allow.publicApiKey()]);
952+
}).authorization((allow) => allow.publicApiKey());
953953
```

0 commit comments

Comments
 (0)