You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @fhkahin! I'm new here. I tested your work with Postman, and it's impressive. I have a few suggestions:
I don't understand why the .env file is not included in the .gitignore list.
The .env.example file uses DB_USERNAME and DB_DATABASE, but in your code, you use DB_NAME and DB_USER instead.
In R.2, you only provide the product ID when running the query:
SELECT product_name FROM products WHERE product_name ILIKE '%Ball%';
I suggest using a join, similar to R.1, and adding restrictions with an AND operation to get more detailed information:
SELECT p.product_name, pa.unit_price, s.supplier_name FROM products p INNER JOIN product_availability pa ON (p.id = pa.prod_id AND product_name ILIKE '%Ball%') INNER JOIN suppliers s ON (s.id = pa.supp_id)
This way, you can view the properties of the searched product (e.g., unit price and supplier name) instead of just the product name, which is not very informative.
Why not use req.query['name'] in R.2 and req.query['customerId'] in R.3? This would allow us to use the URLs localhost:3030/products?name=Ball and localhost:3030/customers?customerId=1. If you choose this approach, remember to change line 24:
ILIKE '%$1%'
to
ILIKE '%' || $1 || '%'
and remove :name from line 21 and :customerId from line 33.
I am Carlo. Please let me know if you need any clarification on my review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.