-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.graphql
More file actions
213 lines (156 loc) · 5.12 KB
/
Copy pathschema.graphql
File metadata and controls
213 lines (156 loc) · 5.12 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
"""A person credited as the author of a book."""
type Author {
"""Author's given name."""
firstName: String!
"""Author's family name."""
lastName: String!
"""Author's middle name, when known."""
middleName: String
}
"""Author details supplied when creating or updating a book."""
input AuthorInput {
"""Author's given name."""
firstName: String!
"""Author's family name."""
lastName: String!
"""Author's middle name, when known."""
middleName: String!
}
"""A book stored in the catalog."""
type Book {
Id: ID!
"""Primary title of the book."""
title: String!
"""Author credited on the book."""
author: Author!
"""Listed price in the store currency."""
price: Float!
"""Optional subtitle shown with the title."""
subtitle: String
"""Long-form description or synopsis."""
description: String
"""ISBN used to identify the edition."""
isbn: String
"""Physical or digital format (for example paperback or ebook)."""
bookFormat: String
"""Aggregate customer rating, when available."""
rating: Float
"""Whether downstream async processing still needs to run."""
asyncUpdateRequired: Boolean
"""ISO-8601 timestamp when the record was created."""
createdOn: String
"""ISO-8601 timestamp of the most recent update."""
lastUpdatedOn: String
}
"""Response wrapper for a create operation."""
type BookCreateResponse {
success: Boolean!
errorMessage: String
"""The created record, when persistence succeeds."""
result: Book
"""MongoDB identifier assigned to the new record."""
recordId: ID!
}
"""Response wrapper for a delete operation."""
type BookDeleteResponse {
success: Boolean!
errorMessage: String
"""The deleted record, when removal succeeds."""
result: Book
"""MongoDB identifier of the removed record."""
recordId: ID!
}
"""Response wrapper for a single-record read."""
type BookGetResponse {
success: Boolean!
errorMessage: String
"""The requested record, when found."""
result: Book
}
"""Response wrapper for an update operation."""
type BookUpdateResponse {
success: Boolean!
errorMessage: String
"""The updated record after changes are applied."""
result: Book
"""MongoDB identifier of the updated record."""
recordId: ID!
}
"""Date with time (isoformat)"""
scalar DateTime
"""Create, update, and delete operations for books and reviews."""
type Mutation {
"""Add a new book to the catalog."""
createBook(title: String!, author: AuthorInput!, price: Float!, subtitle: String!, description: String!, isbn: String!, bookFormat: String!): BookCreateResponse!
"""Update fields on an existing book."""
updateBook(bookId: String!, title: String!, author: AuthorInput!, price: Float!, subtitle: String!, description: String!, isbn: String!, bookFormat: String!, rating: Float!): BookUpdateResponse!
"""Remove a book from the catalog."""
deleteBook(bookId: String!): BookDeleteResponse!
"""Submit a new review for a book."""
createReview(bookId: String!, reviewerId: String!, rating: Float!, reviewComments: String!): ReviewCreateResponse!
"""Change rating or comments on an existing review."""
updateReview(reviewId: String!, rating: Float!, reviewComments: String!): ReviewUpdateResponse!
"""Remove a review by ID."""
deleteReview(reviewId: String!): ReviewDeleteResponse!
}
"""Read operations for books and reviews."""
type Query {
"""Fetch one book by MongoDB document ID."""
getBookById(bookId: String!): BookGetResponse!
"""Fetch one book by ISBN."""
getBookByIsbn(isbn: String!): BookGetResponse!
"""Fetch one review by MongoDB document ID."""
getReviewById(reviewId: String!): ReviewGetResponse!
"""Fetch reviews associated with a book."""
getReviewByBookId(bookId: String!): ReviewGetResponse!
}
"""A customer review for a book."""
type Review {
Id: ID!
"""MongoDB identifier of the book being reviewed."""
bookId: String!
"""Identifier of the reviewer who wrote the review."""
reviewerId: String!
"""Numeric rating, typically on a 1–5 scale."""
rating: Float!
"""Free-text review body."""
reviewComments: String!
"""When the review was first submitted."""
createdOn: DateTime!
"""When the review was last edited, if ever."""
lastUpdatedOn: DateTime
}
"""Response wrapper for a create operation."""
type ReviewCreateResponse {
success: Boolean!
errorMessage: String
"""The created record, when persistence succeeds."""
result: Review
"""MongoDB identifier assigned to the new record."""
recordId: ID!
}
"""Response wrapper for a delete operation."""
type ReviewDeleteResponse {
success: Boolean!
errorMessage: String
"""The deleted record, when removal succeeds."""
result: Review
"""MongoDB identifier of the removed record."""
recordId: ID!
}
"""Response wrapper for a single-record read."""
type ReviewGetResponse {
success: Boolean!
errorMessage: String
"""The requested record, when found."""
result: Review
}
"""Response wrapper for an update operation."""
type ReviewUpdateResponse {
success: Boolean!
errorMessage: String
"""The updated record after changes are applied."""
result: Review
"""MongoDB identifier of the updated record."""
recordId: ID!
}