-
Notifications
You must be signed in to change notification settings - Fork 242
/
reviewsWithoutTag.ts
96 lines (79 loc) 路 2.07 KB
/
reviewsWithoutTag.ts
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
import gql from 'graphql-tag';
export { name, url, resolvers } from '../reviews';
export const typeDefs = gql`
directive @stream on FIELD
directive @transform(from: String!) on FIELD
extend type Query {
topReviews(first: Int = 5): [Review]
}
type Review @key(fields: "id") {
id: ID!
body(format: Boolean = false): String
author: User @provides(fields: "username")
product: Product
metadata: [MetadataOrError]
}
input UpdateReviewInput {
id: ID!
body: String
}
extend type UserMetadata {
address: String @external
}
extend type User @key(fields: "id") {
id: ID! @external
username: String @external
reviews: [Review]
numberOfReviews: Int!
metadata: [UserMetadata] @external
goodAddress: Boolean @requires(fields: "metadata { address }")
}
extend interface Product {
reviews: [Review]
}
extend type Furniture implements Product @key(fields: "upc") {
upc: String! @external
reviews: [Review]
}
extend type Book implements Product @key(fields: "isbn") {
isbn: String! @external
reviews: [Review]
similarBooks: [Book]! @external
relatedReviews: [Review!]! @requires(fields: "similarBooks { isbn }")
}
extend interface Vehicle {
retailPrice: String
}
extend type Car implements Vehicle @key(fields: "id") {
id: String! @external
price: String @external
retailPrice: String @requires(fields: "price")
}
extend type Van implements Vehicle @key(fields: "id") {
id: String! @external
price: String @external
retailPrice: String @requires(fields: "price")
}
input ReviewProduct {
upc: String!
body: String!
stars: Int @deprecated(reason: "Stars are no longer in use")
}
extend type Mutation {
reviewProduct(input: ReviewProduct): Product
updateReview(review: UpdateReviewInput!): Review
deleteReview(id: ID!): Boolean
}
# Value type
type KeyValue {
key: String!
value: String!
}
# Value type
type Error {
code: Int
message: String
}
# Value type
union MetadataOrError = KeyValue | Error
`;