Skip to content

Commit

Permalink
feature: restructure business controller to provide parameters for pa…
Browse files Browse the repository at this point in the history
…gination
  • Loading branch information
Douglas Egiemeh authored and Douglas Egiemeh committed Jul 3, 2018
1 parent 7bf47db commit 4f98b8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/controllers/businesses.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,13 @@ class Businesses {
.then((business) => {
if (business) {
return ReviewsModel
.findAll({
.findAndCountAll({
where: {
businessId: req.params.businessId
}
})
.then((reviews) => {
// const { reviewsNumber } = reviews;
if (!reviews) {
return res.status(404).json({
message: 'this business does not have any reviews yet'
Expand All @@ -240,7 +241,7 @@ class Businesses {
businessdata: {
id: business.id,
title: business.title,
Reviews: reviews
Reviews: reviews,
}
});
});
Expand Down

0 comments on commit 4f98b8a

Please sign in to comment.