-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Backend] added: function add dummy data #84
base: main
Are you sure you want to change the base?
Conversation
let insertUsers = await new Promise((resolve, reject) => { | ||
con.query(queryString, function (err, res) { | ||
if (err) { | ||
reject("Error insert into users"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the error message, not a generic message.
if (err) { reject(err);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although returning the error might give you a better idea of what failed, you still need to return where the error failed as well. Perhaps turning the existing reject to a console.log
and adding the reject(err)
would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the changes please review again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! @alkhatibmahmoud
let insertListing = await new Promise((resolve, reject) => { | ||
con.query(queryString, function (err, res) { | ||
if (err) { | ||
reject("Error insert into listings"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, please do that for all of them. Thanks!
I think we may have to wait and modify the script once we have image upload Table |
}); | ||
}); | ||
|
||
const addListingsQueries = [`INSERT INTO Listing (ListingID, UserID, ListingName, Description, Cost, Quantity, Category, ItemCondition, PostedTimestamp, IsActiveListing) VALUES (1, 1, "listing1", "listing1 description", 10.50, 5, "category1", "used", "2023-03-01 12:00:00", true)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make sure that this data actually matches what is expected, and have proper listing names, descriptions, prices, etc. Categories can be https://github.com/CPSC319-2022/AmazonianPrime/blob/main/frontend/src/components/common/Categories.ts, condition will be https://github.com/CPSC319-2022/AmazonianPrime/pull/74/files#diff-562650c992ad334fbfdb3162f4407dc3b4a0036d21a884e2b634dc591b313264R33
Overview
Added new function add-dummy-data
API: api/user/dummy
Checklist
yarn format
completed for BACKEND and FRONTEND.yarn verify
completed.yarn
should be used) - frontend only.samconfig.toml
is left out - backend only.References