-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathremoteSchema.js
145 lines (130 loc) · 3.25 KB
/
remoteSchema.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
const remoteTypeDefs = `
scalar Date
input LoginInput {
email: String!
password: String!
}
# The "Long" scalar type represents non-fractional signed whole numeric values.
# Long can represent values between -(2^63) and 2^63 - 1.
scalar Long
type Mutation {
# Create a new document in the collection of 'Todo'
createTodo(
# 'Todo' input values
data: TodoInput!
): Todo!
# Update an existing document in the collection of 'User'
updateUser(
# The 'User' document's ID
id: ID!
# 'User' input values
data: UserInput!
): User
# Create a new document in the collection of 'User'
createUser(
# 'User' input values
data: UserInput!
): User!
logout: Boolean!
userCreateTodo(data: UserTodoInput): Todo!
# Delete an existing document in the collection of 'Todo'
deleteTodo(
# The 'Todo' document's ID
id: ID!
): Todo
# Delete an existing document in the collection of 'User'
deleteUser(
# The 'User' document's ID
id: ID!
): User
login(data: LoginInput): String!
# Update an existing document in the collection of 'Todo'
updateTodo(
# The 'Todo' document's ID
id: ID!
# 'Todo' input values
data: TodoInput!
): Todo
}
type Query {
# Find a document from the collection of 'Todo' by its id.
findTodoByID(
# The 'Todo' document's ID
id: ID!
): Todo
# Find a document from the collection of 'User' by its id.
findUserByID(
# The 'User' document's ID
id: ID!
): User
me: User!
}
scalar Time
type Todo {
# The document's ID.
_id: ID!
completed: Boolean!
owner: User
title: String!
# The document's timestamp.
_ts: Long!
}
# 'Todo' input values
input TodoInput {
title: String!
completed: Boolean!
owner: TodoOwnerRelation
}
# Allow manipulating the relationship between the types 'Todo' and 'User' using the field 'Todo.owner'.
input TodoOwnerRelation {
# Create a document of type 'User' and associate it with the current document.
create: UserInput
# Connect a document of type 'User' with the current document using its ID.
connect: ID
# If true, disconnects this document from 'User'
disconnect: Boolean
}
# The pagination object for elements of type 'Todo'.
type TodoPage {
# The elements of type 'Todo' in this page.
data: [Todo]!
# A cursor for elements coming after the current page.
after: String
# A cursor for elements coming before the current page.
before: String
}
type User {
# The document's ID.
_id: ID!
# The document's timestamp.
_ts: Long!
email: String!
todos(
# The number of items to return per page.
_size: Int
# The pagination cursor.
_cursor: String
): TodoPage!
}
# 'User' input values
input UserInput {
email: String!
todos: UserTodosRelation
}
input UserTodoInput {
title: String!
completed: Boolean!
}
# Allow manipulating the relationship between the types 'User' and 'Todo'.
input UserTodosRelation {
# Create one or more documents of type 'Todo' and associate them with the current document.
create: [TodoInput]
# Connect one or more documents of type 'Todo' with the current document using their IDs.
connect: [ID]
# Disconnect the given documents of type 'Todo' from the current document using their IDs.
disconnect: [ID]
}
`
module.exports = {
remoteTypeDefs
}