Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Jeremy Kracy #89

wants to merge 1 commit into from

Conversation

RawToaster
Copy link

Submitting all 3 challenges

Submitting all 3 challenges
'Cell_Phone varchar(10),\n'
'Work_Phone varchar(10),\n'
'Address varchar(50),\n'
'PRIMARY KEY (Email)\n'

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)?

Copy link
Author

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) => {

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.

Copy link
Author

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({

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?

Copy link
Author

@RawToaster RawToaster Apr 12, 2021

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.

@FaisalAlnahhas
Copy link

Hi,
This is Faisal from Headstorm. Good work with the PR. I left you a few questions to better understand your thought process.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants