-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypeDefs.js
More file actions
46 lines (38 loc) · 886 Bytes
/
typeDefs.js
File metadata and controls
46 lines (38 loc) · 886 Bytes
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
const { gql } = require('apollo-server');
const typeDefs = gql`
type Product {
_id: String
name: String
price: Int
category: String
tags: [String]
image: String
headline: String
description: String
inventory: Int
instock: Boolean
featured: Boolean
rating: Int
}
type Category {
_id: String
category: String
}
type User {
_id: String
username: String
token: String
}
type Query {
"List of all products"
products: [Product]
categories: [Category]
product(_id: String): Product
productsById(ids: [String]): [Product]
}
type Mutation {
login(username: String, password: String): User
createProduct(name: String, price: Int, category: String, image: String, tags: [String], image: String, headline: String, description: String, inventory: Int , instock: Boolean, featured: Boolean, rating: Int): Product
}
`;
module.exports = typeDefs