-
Notifications
You must be signed in to change notification settings - Fork 0
/
typeDefs.js
50 lines (41 loc) · 1.06 KB
/
typeDefs.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
const { gql } = require('apollo-server-express');
const typeDefs = gql`
type Query {
products: [Product!]!
product(_id: ID!): Product!
users: [User]!
user(_id: ID!): User!
orders: [Order!]!
order(_id: ID!): Order!
}
type Product {
_id: ID!
title: String!
description: String!
price: Float!
inStock: Boolean!
}
type Order {
_id: ID!
number: String!
customer: User!
status: String!
created: String!
}
type User {
_id: ID!
email: String!
password: String
orders: [Order!]
}
type Mutation {
createProduct(title: String!, description: String!, price: Float! ): Product!
updateProduct(_id: ID!, title: String, description: String, price: Float, inStock: Boolean): Product!
deleteProduct(_id: ID!): Product!
createUser(email: String!, password: String!): User!
createOrder(_customerID: ID!): Order!
deleteOrder(_id: ID!): String
updateStatus(_orderID: ID!, status: String!): Order!
}
`;
module.exports.typeDefs = typeDefs