Hey there, everyone that I share.
And now let's go ahead and can kind of have a discussion about the orders.
So orders is going to be kind of a separate table or rather accurately a document itself.
So we'll be creating a model for the products, the order that user is placing.
So before you go ahead and do that, try to imagine that how the order is being placed and what information
it is going to be required.
If I place order on your website, what kind of information is going to be required for your site?
So please watch after that.
So have a pause and try to imagine that one a little bit.
Okay.
So let's go ahead and add a one here.
So we're going to say, hey, please give me this and we're going to be creating orders up here.
Orders?
Yeah, order is fine.
Okay, let's go ahead and move this one up here because this is how this is going to further roll down.
Let's have a sticky note this time.
We'll be going with.
Yeah, the skylight is fine.
Too big.
Now, the standard thing about this is we are going to need a shipping info.
Now what the shipping info actually uses, it's a kind of a standard object in case you look around
up here.
The first information that you grab all the time is phone number.
Then we get simply address.
Sometimes it can be address line one, address, line two.
That's up to you.
We also go ahead and grab the city.
We also go ahead and grab a postal postal code.
And we also go ahead and grab the country in case you are looking for that or always can give an idea
of having an address as country as India.
So again, it depends on how you are crafting your application, but since this is too much of going
on, I will add these fields again because this will actually ruin that how these sticky notes actually
work.
So you get the idea how this is going to be there.
We'll be adding more field into this one as we go through.
So right now, I'm going to go ahead and just create it like this that, hey, this is a shipping info.
That's it.
We know that there will be more fields coming in into the shipping info.
That's all.
We are also going to add the user.
So whoever the user is, this guy, whoever is logged in who has placed the order, we need all the
information about him or at least an ID of him.
So we're going to be injecting that model as well.
Right now, we have no idea how to do that, but eventually we will grab that.
Okay.
Now after that, we're going to have some of the payment information as well.
And it all depends on you that how much complex you want to make this payment information.
It can be an object.
You can have the order ID, you can have the the success ID and can be mode information can be pulled
up from that stripe and Razorpay both gives you a complex object and you can add more as you like,
just like we saw in the previous section.
And we're going to call this one as payment info.
Usually that's what we do.
Okay, so now we have shipping information, we have payment information, we have the user information,
but we need to add a little bit of the mode information.
For example, we will be also getting the tax.
So we'll be having the text amount that also needs to be calculated because right now on the t shirts,
it's going to be 5% GST only.
So we'll be always sending that from the front end and we'll be storing that information in the back
end.
But it can be different for the different one.
That's why I'm going to be keeping it up as text amount.
There can be a shipping amount as well because maybe t shirts are going up far away.
So we need to have a shipping amount and yes, we can craft something on the front end that if the amount
is or somebody is ordering five t shirts or something more than certain amount, then we can make it
free or all of that.
But this information needs to come to us.
So shipping amount, tax amount and of course, total amount.
So these are two a couple of information we need to go ahead and grab every single time and order is
being placed.
Is it too much?
Probably.
Can I create a simple amount as an object and add all these information in that object 100%?
This is all your model.
You can always go ahead and design that once the course is finished.
Okay.
Now after that, we're going to have a simple order status as well because these are not digital product,
so they will not be automatically processed.
Somebody needs to ship those t shirts and everything, so somebody will be having a process received
the order delivered the order under review or something like that.
So we'll be having order status.
We'll vary on that.
Now also, we will need to keep a check on when it was delivered.
So we're going to be calling it as delivered ADD.
So we'll be adding just a date field up here and simply we'll have a created ADD.
So these are the basics, but I'm pretty sure you might have already guessed what we are missing up
here in this order.
We are not having any information about what kind of order items actually came to us.
So it obviously needs to be a big object.
The reason why I'm keeping it at the very end, I wouldn't be keeping it end in the model itself because
I wanted to have a discussion.
And this sticky note is really, really kind of a a little bit hard to work on with legacy.
So I'm going to be just putting a dashes up here so that you understand that, yes, this needs to go
there, but I'm writing it at the end, so we'll be having order items.
Now, this itself is not going to be object.
This needs to be an array because obviously you will need to iterate over these items maybe to display
on the front end or anyhow.
So this is an important decision that you make up here.
So this is going to be an array, but what are the fields that you're going to add into this one?
So this is inside this one.
Obviously, we're going to be injecting objects.
So just like this and what are the fields that will be there for this order item?
We'll obviously have the name of whatever the product may be, t shirt you are calling it as classic
write code, t shirt or fancy coder t shirt, whatever that is.
So we need to grab the name.
We also need to grab the quantity of how many t shirts you have ordered, one, five or ten, whatever
you are having, just for fun.
We are going to be heading image as well.
And you might be wondering, hey, in the product we have added an array of images.
So are we bringing all the images?
Probably not.
So it's better actually to write it just for understanding here that we'll be injecting the very first
image of that.
That's it.
You can add more images.
It's up to you.
But I'll be adding just the one here.
Okay.
So after that, we obviously need to add up the price of that.
How much is it going to cost?
So let's go ahead and keep that price as well.
And we will also 100% going to need the product, whatever the product is coming in that we need to
inject.
Now, this product is the entire model that we are.
We are we have designed here, so we'll be injecting that up here.
So this is basically how our model is going to look like.
Let me add a simple dashes up here so that it's easier for you to understand that how we are actually
doing that.
There we go, a simple dash.
And there we go at the end.
DASH There we go.
So this is all the basics.
In case you need more of that, you can absolutely go ahead and add this.
I'm going to shrink it up a little bit so that it's there.
Okay.
So as I told you, this is all the brainstorming session.
Now we know how the user is going to be there, how the product is going to be there, how the order
is going to be there.
It sometimes takes so much of the time to just design this model.
And once the model is being accurately designed and you have thoughtfully placed all the things which
needs to be an array which needs to be numbered, which needs to be string, which needs to be an object.
The half of the job is already all done.
So we're going to be just keeping it that simple.
We'll be designing the model.
But before that, I would also like to come back onto this user model.
So in the next video, we're going to be discussing a little bit more things on the user model.
Again, I know this is too much of theory, but this theory will help you to design the products so
much speedily.
And actually this is how things are designed, not only the code, a lot of discussion and brainstorming
session.
Let's go ahead and catch up in the next video.