Use slug for searching specific product.

This commit is contained in:
2020-07-21 13:03:12 +02:00
parent f05336b5b9
commit f525bb499e
3 changed files with 10 additions and 10 deletions

View File

@@ -29,8 +29,8 @@ class Products {
return Product.find().populate('variations');
}
getById(id) {
return Product.findById(id).populate('variations');
getBySlug(slug) {
return Product.findOne({ urlSlug: slug }).populate('variations');
}
}