Skip to content

Commit

Permalink
update schema
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Oct 3, 2023
1 parent 67345a2 commit 3e29e93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
14 changes: 3 additions & 11 deletions src/fragments/lib/graphqlapi/android/relational/updated-schema.mdx
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
For the examples below with API (GraphQL) let's add a Post and Comment model to the [schema](/lib/graphqlapi/getting-started#configure-api):

```graphql
enum PostStatus {
ACTIVE
INACTIVE
}

type Post @model {
id: ID!
title: String!
rating: Int!
status: PostStatus!
# New field with @hasMany
comments: [Comment] @hasMany(indexName: "byPost", fields: ["id"])
comments: [Comment] @hasMany
}

type Comment @model {
id: ID!
postID: ID! @index(name: "byPost")
post: Post! @belongsTo(fields: ["postID"])
content: String!
content: String
post: Post @belongsTo
}
```

Expand Down
10 changes: 1 addition & 9 deletions src/fragments/lib/graphqlapi/ios/relational/updated-schema.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
For the examples below with API (GraphQL) let's add a Post and Comment model to the [schema](/lib/graphqlapi/getting-started#configure-api):

```graphql
enum PostStatus {
ACTIVE
INACTIVE
}

type Post @model @auth(rules: [{allow: public}]) {
type Post @model {
id: ID!
title: String!
rating: Int!
status: PostStatus!
# new field with @hasMany
comments: [Comment] @hasMany
}

# new model
type Comment @model {
id: ID!
content: String
Expand Down

0 comments on commit 3e29e93

Please sign in to comment.