Skip to content

Commit 7cb5d60

Browse files
author
Franciszek Stodulski
committed
feat: updated schemas
1 parent 4a950b1 commit 7cb5d60

6 files changed

+36
-2
lines changed
File renamed without changes.

datamodel.prisma

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ type Post {
99
id: ID! @id
1010
title: String!
1111
published: Boolean! @default(value: false)
12-
author: User @relation(link: INLINE)
12+
author: User!
1313
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"typescript": "^3.4.5"
2323
},
2424
"scripts": {
25-
"prepare": "prisma deploy && npm run start:rest",
25+
"prepare": "npm i && prisma deploy && npm run start:rest",
2626
"start:graphql": "ts-node GRAPHQL_index.ts",
2727
"start:rest": "ts-node REST_index.ts",
2828
"dev:rest": "ts-node-dev --no-notify --respawn --transpileOnly ./REST_index.ts",

schema.graphql

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#import Query.*, Mutation.*, * from './src/graphql/Post/post-schema.graphql'
2+
#import Query.*, Mutation.*, * from './src/graphql/User/user-schema.graphql'

src/graphql/Post/post-schema.graphql

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#import User from '../User/user-schema.graphql'
2+
3+
type Post {
4+
id: ID!
5+
title: String!
6+
published: Boolean!
7+
author: User!
8+
}
9+
10+
type Mutation {
11+
createNewPost(title: String!, author: ID!): Post!
12+
}
13+
14+
type Query {
15+
getAllPosts: [Post!]!
16+
}

src/graphql/User/user-schema.graphql

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#import Post from '../Post/post-schema.graphql'
2+
3+
type User {
4+
id: ID!
5+
email: String
6+
name: String!
7+
posts: [Post!]!
8+
}
9+
10+
type Mutation {
11+
createNewUser(email: String!, name: String!): User!
12+
}
13+
14+
type Query {
15+
getAllUsers: [User!]!
16+
}

0 commit comments

Comments
 (0)