-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97afc46
commit b29ff6d
Showing
10 changed files
with
783 additions
and
3,371 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const { ApolloServer } = require("apollo-server"); | ||
const { resolvers } = require("../resolvers/index.resolver"); | ||
const { prisma } = require("../prisma/generated/prisma-client/index"); | ||
const { schema } = require("./squema"); | ||
|
||
const server = new ApolloServer({ | ||
typeDefs: schema, | ||
resolvers, | ||
context: req => ({ | ||
prisma, | ||
req | ||
}) | ||
}); | ||
|
||
server.listen({ port: process.env.PORT || 4000 }).then( | ||
console.log("its working!") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
const { gql } = require("apollo-server"); | ||
|
||
schema = gql` | ||
type Query { | ||
me: User! | ||
users( | ||
query: String | ||
first: Int | ||
skip: Int | ||
orderBy: UserOrderByInput | ||
): [User] | ||
posts( | ||
query: String | ||
first: Int | ||
skip: Int | ||
orderBy: PostOrderByInput | ||
): [Post] | ||
myPosts( | ||
query: String | ||
first: Int | ||
skip: Int | ||
orderBy: PostOrderByInput | ||
): [Post] | ||
comments(first: Int, skip: Int, orderBy: CommentOrderByInput): [Comment] | ||
post(id: ID!): Post! | ||
} | ||
type Mutation { | ||
createUser(data: CreateUserInput): userPayload! | ||
deleteUser(id: ID!): User! | ||
updateUser(data: updateUserInput): User! | ||
createPost(data: CreatePostInput): Post! | ||
deletePost(id: ID!): Post! | ||
updatePost(id: ID!, data: updatePostInput): Post! | ||
createComment(data: CreateCommentInput): Comment! | ||
deleteComment(id: ID!): Comment! | ||
updateComment(id: ID!, data: updateCommentInput): Comment! | ||
login(data: userCredentialsInput!): userPayload! | ||
} | ||
input userCredentialsInput { | ||
email: String! | ||
password: String! | ||
} | ||
type userPayload { | ||
token: String! | ||
user: User! | ||
} | ||
type Subscription { | ||
comment(postId: ID!): CommentSubscriptionPayload | ||
post: PostSubscriptionPayload | ||
myPost: PostSubscriptionPayload | ||
} | ||
input CreateUserInput { | ||
name: String! | ||
email: String! | ||
password: String! | ||
} | ||
input updateUserInput { | ||
name: String | ||
email: String | ||
password: String | ||
} | ||
input CreatePostInput { | ||
title: String! | ||
body: String! | ||
published: Boolean! | ||
} | ||
input updatePostInput { | ||
title: String | ||
body: String | ||
published: Boolean | ||
} | ||
input CreateCommentInput { | ||
text: String! | ||
post: ID! | ||
} | ||
input updateCommentInput { | ||
text: String | ||
} | ||
type User { | ||
id: ID! | ||
name: String! | ||
email: String | ||
password: String | ||
posts: [Post] | ||
comments: [Comment] | ||
createdAt: String! | ||
updatedAt: String! | ||
} | ||
type Post { | ||
id: ID! | ||
title: String! | ||
body: String! | ||
published: Boolean! | ||
author: User! | ||
comments: [Comment] | ||
createdAt: String! | ||
updatedAt: String! | ||
} | ||
type Comment { | ||
id: ID! | ||
text: String! | ||
author: User! | ||
post: Post! | ||
createdAt: String! | ||
updatedAt: String! | ||
} | ||
enum MutationType { | ||
CREATED | ||
UPDATED | ||
DELETED | ||
} | ||
type PostSubscriptionPayload { | ||
mutation: MutationType | ||
node: Post | ||
} | ||
type CommentSubscriptionPayload { | ||
mutation: MutationType | ||
node: Comment | ||
} | ||
enum UserOrderByInput { | ||
name_ASC | ||
name_DESC | ||
updatedAt_ASC | ||
updatedAt_DESC | ||
createdAt_ASC | ||
createdAt_DESC | ||
} | ||
enum PostOrderByInput { | ||
title_ASC | ||
title_DESC | ||
body_ASC | ||
body_DESC | ||
published_ASC | ||
published_DESC | ||
updatedAt_ASC | ||
updatedAt_DESC | ||
createdAt_ASC | ||
createdAt_DESC | ||
} | ||
enum CommentOrderByInput { | ||
text_ASC | ||
text_DESC | ||
updatedAt_ASC | ||
updatedAt_DESC | ||
createdAt_ASC | ||
createdAt_DESC | ||
} | ||
`; | ||
|
||
module.exports = { | ||
schema | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
test("fdsa fdsa fdsafdsa", () => { | ||
throw new Error('fdsafds') | ||
}); |