gesJav-wocxo3-vedgyg
This commit is contained in:
@@ -23,14 +23,14 @@
|
||||
"dotenv": "^8.2.0",
|
||||
"esm": "^3.2.25",
|
||||
"express": "^4.17.1",
|
||||
"express-graphql": "^0.12.0",
|
||||
"graphql": "^15.4.0",
|
||||
"graphql-compose": "^7.23.0",
|
||||
"graphql-compose-connection": "^8.0.1",
|
||||
"graphql-compose-mongoose": "^9.0.0",
|
||||
"graphql-depth-limit": "^1.1.0",
|
||||
"graphql-middleware": "^6.0.0",
|
||||
"graphql-tools": "^7.0.2",
|
||||
"express-graphql": "*",
|
||||
"graphql": "*",
|
||||
"graphql-compose": "*",
|
||||
"graphql-compose-connection": "*",
|
||||
"graphql-compose-mongoose": "*",
|
||||
"graphql-depth-limit": "*",
|
||||
"graphql-middleware": "*",
|
||||
"graphql-tools": "*",
|
||||
"jsonwebtoken": "8.5.1",
|
||||
"migrate": "^1.7.0",
|
||||
"mocha": "^8.2.1",
|
||||
@@ -55,4 +55,4 @@
|
||||
"nodemon": "^2.0.6",
|
||||
"prettier": "^2.2.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
@@ -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
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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!
|
||||
|
||||
12264
server/yarn.lock
12264
server/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user