gesJav-wocxo3-vedgyg

This commit is contained in:
Riccardo
2021-08-16 08:54:17 +02:00
parent 28014b2850
commit 93169095c0
9 changed files with 6329 additions and 6086 deletions

View File

@@ -1,12 +0,0 @@
import mongoose from 'mongoose';
const Schema = mongoose.Schema;
const ProductSchema = new Schema({
title: {
type: String,
required: true
},
qty: {
type: Number
}
});
export default mongoose.model('product', ProductSchema);

View File

@@ -1,5 +1,4 @@
// import Appointment from '../../client/src/components/Appointment.js';
import Product from './models/product.js';
import Appointment from './models/appointment.js';
import User from './models/user.js'
// import { createAppointment } from './resolvers/Mutation.js';
@@ -18,9 +17,6 @@ export const resolvers = {
_id: args._id
});
},
async allProducts() {
return await Product.find();
},
async allUsers() {
return await User.find();
},
@@ -77,33 +73,7 @@ export const resolvers = {
args
}, args, {
new: true
})
},
async deleteAppointment(parent, args, context, info) {
return await Appointment.findOneAndUpdate({ _id: args._id }, { deleted: true })
// return await Appointment.deleteOne({ _id: args._id });
},
async createProduct(root, {
input
}) {
return await Product.create(input);
},
async updateProduct(root, {
_id,
input
}) {
return await Product.findOneAndUpdate({
_id
}, input, {
new: true
})
},
async deleteProduct(root, {
_id
}) {
return await Product.findOneAndRemove({
_id
});
},
}
}
};

View File

@@ -6,7 +6,6 @@ type Query {
take: Int
orderBy: AppointmentOrderByInput
): Feed!
allProducts: [Product]
allAppointments: [Appointment]
oneAppointment(
_id: ID!
@@ -42,16 +41,6 @@ type Mutation {
deleteAppointment(
_id: ID!
) : Appointment
createProduct(
input: ProductInput
) : Product
updateProduct(
_id: ID!,
input: ProductInput
): Product
deleteProduct(
_id: ID!
) : Product
signup(
email: String!
password: String!
@@ -117,17 +106,6 @@ input AppointmentOrderByInput {
# createdAt: Sort
}
# Product schemas
type Product {
_id: ID!
title: String!
qty: Int
}
input ProductInput {
title: String!
qty: Int
}
# Follow schemas
type Follow {
_id: ID!