Skip to content

Commit

Permalink
update code style
Browse files Browse the repository at this point in the history
Relates #21
  • Loading branch information
Osama-you committed Feb 10, 2021
1 parent 89c75b2 commit e7c9815
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
18 changes: 9 additions & 9 deletions server/controllers/kindergartens/kindergartenSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@ const kindergartenSearch = async (req, res, next) => {
abortEarly: false,
});

if (!q && (!minPrice || !maxPrice) && !locationId) {
next(
boomify(
400,
'Validation Error',
'At least one of these (q, minPrice & maxPrice,locationId) values is required'
)
);
} else {
if (q || (minPrice && maxPrice) || locationId) {
const { rows: data } = await getKindergartenSearch({
q,
minPrice,
Expand All @@ -33,6 +25,14 @@ const kindergartenSearch = async (req, res, next) => {
StatusCode: 200,
data,
});
} else {
next(
boomify(
400,
'Validation Error',
'At least one of these (q, minPrice & maxPrice,locationId) values is required'
)
);
}
} catch (error) {
next(
Expand Down
1 change: 0 additions & 1 deletion test/search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ describe('search endPoint', () => {
}));

test('Route /search?minPrice=500&maxPrice=1000, status 200, json header, data = testData', (done) => {
// still something TODO
const testData = {
id: 6,
kindergarten_name: 'روضة الزهراء النموذجية الخاصة',
Expand Down

0 comments on commit e7c9815

Please sign in to comment.