forked from javascripteverywhere/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.js
48 lines (42 loc) · 979 Bytes
/
schema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const { gql } = require('apollo-server-express');
module.exports = gql`
scalar DateTime
type Note {
id: ID!
content: String!
author: User!
favoriteCount: Int!
favoritedBy: [User]
createdAt: DateTime!
updatedAt: DateTime!
}
type User {
id: ID!
username: String!
email: String!
avatar: String
notes: [Note!]!
favorites: [Note!]!
}
type NoteFeed {
notes: [Note]!
cursor: String!
hasNextPage: Boolean!
}
type Query {
notes: [Note!]!
note(id: ID): Note!
user(username: String!): User
users: [User!]!
me: User!
noteFeed(cursor: String): NoteFeed
}
type Mutation {
newNote(content: String!): Note
updateNote(id: ID!, content: String!): Note!
deleteNote(id: ID!): Boolean!
toggleFavorite(id: ID!): Note!
signUp(username: String!, email: String!, password: String!): String!
signIn(username: String, email: String, password: String!): String!
}
`;