Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Get all reviews endpoint returns only first 30 reviews #13

Open
panpan291265 opened this issue Jun 26, 2018 · 5 comments
Open

Get all reviews endpoint returns only first 30 reviews #13

panpan291265 opened this issue Jun 26, 2018 · 5 comments

Comments

@panpan291265
Copy link

Sails server application comes with a default db containing 10 restaurants and 30 reviews (3 per restaurant).
If you add some more reviews, the get all reviews endpoint (http://localhost:1337/reviews/) returns only the first 30 reviews. If you use the get all reviews for a restaurant endpoint (http://localhost:1337/reviews/?restaurant_id=<restaurant_id>) then the server returns correctlly all the requested restaurant reviews.

@hallya
Copy link

hallya commented Jul 16, 2018

@panpan291265 You have to go to folder config => blueprint.js => scroll to bottom then uncomment defaultLimit and set it to any number greater than 30.
It should work

@SundusAshar
Copy link

Are we allowed to make changes in the blueprint.js file?

@hallya
Copy link

hallya commented Jul 23, 2018

@SundusAshar my guess is that you are not supposed because there may be some intentional mistakes that we should handle in front but if you want to be able to know if the review you just posted has been correctly added to the server then you have to, there's no other choice.

@bambooka
Copy link

bambooka commented Aug 8, 2018

In fact, we dont't have to modify the blueprints as it is not necessary to fetch all the reviews at once. The API allows us to fetch restaurant-specific reviews this way:
http://localhost:1337/reviews/?restaurant_id=<restaurant_id>

Just keep in mind that the same limit applies, thus you can not fetch more than 30 reviews for a single restaurant ID. Which should not be a problem for a small project like this one since nobody is going to add more than 30 reviews per restaurant anyway.

@anthumchris
Copy link

anthumchris commented Sep 30, 2018

You can specify URL param limit with REST queries. For example, "-1" returns all results, or "20" limits to 20. This overrides the defaultLimit value in blueprint.js

http://localhost:1337/reviews?limit=-1

I'll submit a pull request to have this fixed, because I wasted a lot of time because of it.

mejarc referenced this issue in mejarc/mws-restaurant-stage-3 Oct 23, 2018
* add breakpoints for size beyond phone portrait width
* add grid and flex layouts for content blocks beyond assumed default of
  vertical stacking

Resolves: #13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants