-
Notifications
You must be signed in to change notification settings - Fork 112
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
Jeremy Kracy #89
base: master
Are you sure you want to change the base?
Jeremy Kracy #89
Conversation
Submitting all 3 challenges
'Cell_Phone varchar(10),\n' | ||
'Work_Phone varchar(10),\n' | ||
'Address varchar(50),\n' | ||
'PRIMARY KEY (Email)\n' |
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.
What was your thought process in deciding what primary key to use for Customer_Information table? And what kind of relationship do you anticipate between the two tables (Customer_Information and Order_Information)?
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 decided to use the customer's email as the primary key in the Customer_Information table, because it seemed to be the best characteristic to use as an identifier. I think of other account based services that will reject accounts if the email used is already taken by a different account. That was the idea I was going for with that. I anticipate a one-to-many relationship for Customer_Information and Order_Information. This would allow 1 customer to have multiple orders, while ensuring each order only corresponds to one customer.
|
||
}); | ||
|
||
router.patch('/:dataId', (req, res, next) => { |
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 you tell me how did you decide to use patch here? As in what purpose does it serve given the context of the problem you're solving.
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.
My intention with the use of patch was to allow a user to update any given array in the database with new information without having to create an entirely new object in the database. I imagine a user would use a get request to attain the available array IDs, and use this information in a patch call to update the desired array.
console.log(result); | ||
console.log(result.data.length); | ||
|
||
res.status(201).json({ |
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.
How did you decide on 201 here?
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 used the 201 status code to verify that a new object was created in the database using that POST request. This is in line with my understanding of the "201 Created" code.
Hi, Thanks! |
Submitting all 3 challenges