We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e36262e commit 36a014eCopy full SHA for 36a014e
2 files changed
graphQL/data/resolvers.js
@@ -40,6 +40,13 @@ const resolvers = {
40
throw new Error(e)
41
}
42
},
43
+ getAllProducts: async () => {
44
+ try {
45
+ return await Widgets.find({})
46
+ } catch (e) {
47
+ throw new Error(e)
48
+ }
49
+ },
50
updateProduct: async ({input}) => {
51
try {
52
const updateWidgets = Widgets.findOneAndUpdate({_id:input.id}, input,
graphQL/data/schema.js
@@ -21,6 +21,7 @@ const schema = buildSchema(`
21
22
type Query {
23
getProduct(id: ID): Product
24
+ getAllProducts: [Product]
25
26
"""
27
input StoreInput {
0 commit comments