server v1.0.1

This commit is contained in:
2020-09-17 19:00:30 +02:00
parent 27552e5eb0
commit fa0b7e6503
3 changed files with 11 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ router.get("/", (req, res) => {
{ {
$and: [ $and: [
{ $or: [{ city: { $regex: regex } }, { name: { $regex: regex } }] }, { $or: [{ city: { $regex: regex } }, { name: { $regex: regex } }] },
{ hidden: false }, { $or: [{ hidden: false }, { hidden: { $exists: false } }] },
{ subscriptionActive: true }, { subscriptionActive: true },
], ],
}, },

View File

@@ -53,7 +53,10 @@ export async function createRestaurant(request, oldRestaurant) {
name: sanitizer.sanitize.keepUnicode(request.name), name: sanitizer.sanitize.keepUnicode(request.name),
city: sanitizer.sanitize.keepUnicode(request.city), city: sanitizer.sanitize.keepUnicode(request.city),
adress: sanitizer.sanitize.keepUnicode(request.adress), adress: sanitizer.sanitize.keepUnicode(request.adress),
location: request.location, location: {
type: "Point",
coordinates: request.coordinates,
},
imgUrl: img, imgUrl: img,
workingHours: request.workingHours, workingHours: request.workingHours,
description: sanitizer.sanitize.keepUnicode(request.description), description: sanitizer.sanitize.keepUnicode(request.description),
@@ -70,7 +73,10 @@ export async function createRestaurant(request, oldRestaurant) {
city: sanitizer.sanitize.keepUnicode(request.city), city: sanitizer.sanitize.keepUnicode(request.city),
dishes: oldRestaurant.dishes, dishes: oldRestaurant.dishes,
adress: sanitizer.sanitize.keepUnicode(request.adress), adress: sanitizer.sanitize.keepUnicode(request.adress),
location: request.location, location: {
type: "Point",
coordinates: request.coordinates,
},
imgUrl: img, imgUrl: img,
workingHours: request.workingHours, workingHours: request.workingHours,
description: sanitizer.sanitize.keepUnicode(request.description), description: sanitizer.sanitize.keepUnicode(request.description),

View File

@@ -66,14 +66,14 @@ function generatePasswordResetToken(email) {
email: email, email: email,
}, },
jwtSecret, jwtSecret,
{ expiresIn: "15m" } { expiresIn: "30m" }
); );
return token; return token;
} }
export function generatePasswordResetLink(email) { export function generatePasswordResetLink(email) {
const token = generatePasswordResetToken(email); const token = generatePasswordResetToken(email);
const link = `https://www.menui.pl/forgot?token=${token}`; const link = `localhost:3000/resetpassword?token=${token}`;
return link; return link;
} }