Static Fullcalendar visible

This commit is contained in:
Riccardo
2021-01-06 09:41:48 +01:00
parent 436eb4410c
commit 07cbbf12de
10 changed files with 410 additions and 33 deletions

View File

@@ -18,13 +18,13 @@ dotenv.config();
app.use(cors());
app.get('/', (req, res) => {
res.json({
msg: 'GraphQL home!'
})
});
// app.get('/', (req, res) => {
// res.json({
// msg: 'GraphQL home!'
// })
// });
app.use('/graphql', graphqlHTTP({
app.use('/djhb58fytkh476dk45yh49', graphqlHTTP({
schema: schema,
graphiql: true
}));

View File

@@ -20,39 +20,38 @@ export const resolvers = {
},
},
Mutation: {
async signup(root, {
input
}) {
console.log(input.password);
input.password = await bcrypt.hash(input.password, 10);
async signup(root, args, context, info) {
console.log(args, args.password);
const user = await User.create(input);
args.password = await bcrypt.hash(args.password, 10);
console.log("pre ", args.password)
const user = await User.create(args);
const token = jwt.sign({ userId: user.id }, process.env.APP_SECRET);
console.log("post", user.password);
return {
token,
user
};
},
async login(root, {
email, password
}) {
async login(parent, args, context, info) {
console.log(args);
const user = await User.findOne({
email: email
email: args.email
});
if (!user) {
throw new Error('No such user found');
}
const pwd = await bcrypt.hash(password, 10);
console.log(pwd);
console.log(user.password);
const valid = await bcrypt.compare(
password,
args.password,
user.password
);
if (!valid) {
@@ -67,6 +66,37 @@ export const resolvers = {
};
},
// async login(parent, args, context, info) {
// console.log(args);
// const user = await User.findOne({
// email: args.email
// });
// if (!user) {
// throw new Error('No such user found');
// }
// const pwd = await bcrypt.hash(args.password, 10);
// console.log(pwd);
// console.log(args.password)
// console.log(user.password);
// const valid = await bcrypt.compare(
// args.password,
// user.password
// );
// if (!valid) {
// throw new Error('Invalid password');
// }
// const token = jwt.sign({ userId: user.id }, process.env.APP_SECRET);
// return {
// token,
// user
// };
// },
async createAppointment(root, {
input
}) {

View File

@@ -40,12 +40,14 @@ type Mutation {
_id: ID!
) : Product
signup(
input: UserInput
email: String!
password: String!
username: String!
): AuthPayload
login(
email: String!,
password: String!
): AuthPayload
): AuthPayload
follow(
appointmentId: ID!
): Follow
@@ -80,8 +82,6 @@ type Appointment {
_id: ID!
title: String!
description: String!
# dateStart: Date!
# dateEnd: Date!
timeStart: Time!
timeEnd: Time!
deleted: Boolean
@@ -92,8 +92,6 @@ type Appointment {
input AppointmentInput {
title: String!
description: String!
# dateStart: Date!
# dateEnd: Date!
timeStart: Time!
timeEnd: Time!
}