WEBVTT

00:03.940 --> 00:05.350
Hey there, everyone that I share.

00:05.380 --> 00:09.280
And now let's go ahead and can kind of have a discussion about the orders.

00:09.280 --> 00:14.800
So orders is going to be kind of a separate table or rather accurately a document itself.

00:14.800 --> 00:19.690
So we'll be creating a model for the products, the order that user is placing.

00:19.780 --> 00:25.090
So before you go ahead and do that, try to imagine that how the order is being placed and what information

00:25.090 --> 00:26.170
it is going to be required.

00:26.360 --> 00:31.510
If I place order on your website, what kind of information is going to be required for your site?

00:31.510 --> 00:33.280
So please watch after that.

00:33.280 --> 00:36.520
So have a pause and try to imagine that one a little bit.

00:36.790 --> 00:37.050
Okay.

00:37.090 --> 00:38.710
So let's go ahead and add a one here.

00:38.710 --> 00:43.210
So we're going to say, hey, please give me this and we're going to be creating orders up here.

00:43.630 --> 00:44.800
Orders?

00:44.800 --> 00:45.940
Yeah, order is fine.

00:46.360 --> 00:51.790
Okay, let's go ahead and move this one up here because this is how this is going to further roll down.

00:53.700 --> 00:55.830
Let's have a sticky note this time.

00:55.830 --> 00:57.000
We'll be going with.

00:58.440 --> 00:59.670
Yeah, the skylight is fine.

01:00.750 --> 01:01.290
Too big.

01:01.320 --> 01:06.100
Now, the standard thing about this is we are going to need a shipping info.

01:06.150 --> 01:11.370
Now what the shipping info actually uses, it's a kind of a standard object in case you look around

01:11.370 --> 01:11.940
up here.

01:11.970 --> 01:15.370
The first information that you grab all the time is phone number.

01:15.390 --> 01:17.400
Then we get simply address.

01:17.400 --> 01:19.730
Sometimes it can be address line one, address, line two.

01:19.740 --> 01:20.790
That's up to you.

01:21.120 --> 01:23.320
We also go ahead and grab the city.

01:23.340 --> 01:28.260
We also go ahead and grab a postal postal code.

01:28.920 --> 01:34.050
And we also go ahead and grab the country in case you are looking for that or always can give an idea

01:34.050 --> 01:36.710
of having an address as country as India.

01:36.720 --> 01:41.430
So again, it depends on how you are crafting your application, but since this is too much of going

01:41.430 --> 01:46.380
on, I will add these fields again because this will actually ruin that how these sticky notes actually

01:46.380 --> 01:46.780
work.

01:46.800 --> 01:48.810
So you get the idea how this is going to be there.

01:48.810 --> 01:51.390
We'll be adding more field into this one as we go through.

01:51.390 --> 01:55.590
So right now, I'm going to go ahead and just create it like this that, hey, this is a shipping info.

01:55.620 --> 01:56.070
That's it.

01:56.070 --> 01:59.070
We know that there will be more fields coming in into the shipping info.

01:59.100 --> 01:59.790
That's all.

01:59.880 --> 02:01.920
We are also going to add the user.

02:01.920 --> 02:07.530
So whoever the user is, this guy, whoever is logged in who has placed the order, we need all the

02:07.530 --> 02:10.020
information about him or at least an ID of him.

02:10.020 --> 02:12.570
So we're going to be injecting that model as well.

02:12.600 --> 02:15.900
Right now, we have no idea how to do that, but eventually we will grab that.

02:15.930 --> 02:16.470
Okay.

02:16.890 --> 02:21.000
Now after that, we're going to have some of the payment information as well.

02:21.000 --> 02:25.170
And it all depends on you that how much complex you want to make this payment information.

02:25.170 --> 02:26.220
It can be an object.

02:26.220 --> 02:32.160
You can have the order ID, you can have the the success ID and can be mode information can be pulled

02:32.160 --> 02:37.380
up from that stripe and Razorpay both gives you a complex object and you can add more as you like,

02:37.380 --> 02:39.330
just like we saw in the previous section.

02:39.690 --> 02:41.820
And we're going to call this one as payment info.

02:41.850 --> 02:43.440
Usually that's what we do.

02:43.950 --> 02:48.210
Okay, so now we have shipping information, we have payment information, we have the user information,

02:48.210 --> 02:51.120
but we need to add a little bit of the mode information.

02:51.120 --> 02:53.610
For example, we will be also getting the tax.

02:53.610 --> 02:59.100
So we'll be having the text amount that also needs to be calculated because right now on the t shirts,

02:59.100 --> 03:01.140
it's going to be 5% GST only.

03:01.140 --> 03:05.370
So we'll be always sending that from the front end and we'll be storing that information in the back

03:05.370 --> 03:05.700
end.

03:05.700 --> 03:07.470
But it can be different for the different one.

03:07.470 --> 03:09.810
That's why I'm going to be keeping it up as text amount.

03:10.380 --> 03:15.030
There can be a shipping amount as well because maybe t shirts are going up far away.

03:15.030 --> 03:21.060
So we need to have a shipping amount and yes, we can craft something on the front end that if the amount

03:21.060 --> 03:25.770
is or somebody is ordering five t shirts or something more than certain amount, then we can make it

03:25.770 --> 03:26.490
free or all of that.

03:26.490 --> 03:28.860
But this information needs to come to us.

03:28.860 --> 03:32.550
So shipping amount, tax amount and of course, total amount.

03:32.550 --> 03:37.980
So these are two a couple of information we need to go ahead and grab every single time and order is

03:37.980 --> 03:38.670
being placed.

03:38.700 --> 03:39.750
Is it too much?

03:39.750 --> 03:40.490
Probably.

03:40.500 --> 03:46.290
Can I create a simple amount as an object and add all these information in that object 100%?

03:46.290 --> 03:47.490
This is all your model.

03:47.490 --> 03:50.850
You can always go ahead and design that once the course is finished.

03:50.880 --> 03:51.420
Okay.

03:51.540 --> 03:56.460
Now after that, we're going to have a simple order status as well because these are not digital product,

03:56.460 --> 03:58.500
so they will not be automatically processed.

03:58.500 --> 04:04.140
Somebody needs to ship those t shirts and everything, so somebody will be having a process received

04:04.140 --> 04:07.830
the order delivered the order under review or something like that.

04:07.830 --> 04:09.330
So we'll be having order status.

04:09.330 --> 04:10.410
We'll vary on that.

04:10.410 --> 04:14.100
Now also, we will need to keep a check on when it was delivered.

04:14.100 --> 04:18.450
So we're going to be calling it as delivered ADD.

04:18.450 --> 04:22.770
So we'll be adding just a date field up here and simply we'll have a created ADD.

04:23.790 --> 04:27.900
So these are the basics, but I'm pretty sure you might have already guessed what we are missing up

04:27.900 --> 04:29.310
here in this order.

04:29.310 --> 04:33.780
We are not having any information about what kind of order items actually came to us.

04:33.780 --> 04:36.690
So it obviously needs to be a big object.

04:36.690 --> 04:41.190
The reason why I'm keeping it at the very end, I wouldn't be keeping it end in the model itself because

04:41.190 --> 04:42.390
I wanted to have a discussion.

04:42.390 --> 04:47.420
And this sticky note is really, really kind of a a little bit hard to work on with legacy.

04:47.430 --> 04:51.570
So I'm going to be just putting a dashes up here so that you understand that, yes, this needs to go

04:51.570 --> 04:55.050
there, but I'm writing it at the end, so we'll be having order items.

04:55.050 --> 04:58.080
Now, this itself is not going to be object.

04:58.080 --> 05:03.420
This needs to be an array because obviously you will need to iterate over these items maybe to display

05:03.420 --> 05:04.980
on the front end or anyhow.

05:04.990 --> 05:07.860
So this is an important decision that you make up here.

05:07.860 --> 05:12.090
So this is going to be an array, but what are the fields that you're going to add into this one?

05:12.090 --> 05:13.950
So this is inside this one.

05:13.950 --> 05:16.260
Obviously, we're going to be injecting objects.

05:16.260 --> 05:21.300
So just like this and what are the fields that will be there for this order item?

05:21.570 --> 05:26.460
We'll obviously have the name of whatever the product may be, t shirt you are calling it as classic

05:26.580 --> 05:30.810
write code, t shirt or fancy coder t shirt, whatever that is.

05:30.810 --> 05:32.370
So we need to grab the name.

05:32.370 --> 05:38.190
We also need to grab the quantity of how many t shirts you have ordered, one, five or ten, whatever

05:38.190 --> 05:40.350
you are having, just for fun.

05:40.350 --> 05:42.180
We are going to be heading image as well.

05:42.180 --> 05:46.500
And you might be wondering, hey, in the product we have added an array of images.

05:46.500 --> 05:48.270
So are we bringing all the images?

05:48.270 --> 05:49.290
Probably not.

05:49.290 --> 05:53.460
So it's better actually to write it just for understanding here that we'll be injecting the very first

05:53.460 --> 05:54.600
image of that.

05:54.600 --> 05:55.290
That's it.

05:55.320 --> 05:56.790
You can add more images.

05:56.790 --> 05:57.390
It's up to you.

05:57.390 --> 05:59.100
But I'll be adding just the one here.

05:59.830 --> 06:00.240
Okay.

06:00.310 --> 06:04.030
So after that, we obviously need to add up the price of that.

06:04.300 --> 06:05.920
How much is it going to cost?

06:05.920 --> 06:08.260
So let's go ahead and keep that price as well.

06:08.440 --> 06:13.660
And we will also 100% going to need the product, whatever the product is coming in that we need to

06:13.660 --> 06:14.290
inject.

06:14.320 --> 06:17.650
Now, this product is the entire model that we are.

06:17.770 --> 06:20.890
We are we have designed here, so we'll be injecting that up here.

06:20.890 --> 06:24.340
So this is basically how our model is going to look like.

06:24.340 --> 06:29.650
Let me add a simple dashes up here so that it's easier for you to understand that how we are actually

06:29.650 --> 06:30.610
doing that.

06:31.980 --> 06:33.840
There we go, a simple dash.

06:34.470 --> 06:36.040
And there we go at the end.

06:36.060 --> 06:37.140
DASH There we go.

06:38.310 --> 06:39.710
So this is all the basics.

06:39.720 --> 06:43.470
In case you need more of that, you can absolutely go ahead and add this.

06:43.470 --> 06:46.620
I'm going to shrink it up a little bit so that it's there.

06:47.310 --> 06:48.050
Okay.

06:48.060 --> 06:50.820
So as I told you, this is all the brainstorming session.

06:50.820 --> 06:54.720
Now we know how the user is going to be there, how the product is going to be there, how the order

06:54.720 --> 06:55.650
is going to be there.

06:55.740 --> 06:59.370
It sometimes takes so much of the time to just design this model.

06:59.370 --> 07:04.200
And once the model is being accurately designed and you have thoughtfully placed all the things which

07:04.200 --> 07:08.640
needs to be an array which needs to be numbered, which needs to be string, which needs to be an object.

07:08.670 --> 07:11.160
The half of the job is already all done.

07:11.160 --> 07:13.350
So we're going to be just keeping it that simple.

07:13.350 --> 07:14.480
We'll be designing the model.

07:14.490 --> 07:18.870
But before that, I would also like to come back onto this user model.

07:18.870 --> 07:23.840
So in the next video, we're going to be discussing a little bit more things on the user model.

07:23.850 --> 07:28.350
Again, I know this is too much of theory, but this theory will help you to design the products so

07:28.350 --> 07:28.970
much speedily.

07:28.980 --> 07:33.900
And actually this is how things are designed, not only the code, a lot of discussion and brainstorming

07:33.900 --> 07:34.440
session.

07:34.440 --> 07:36.540
Let's go ahead and catch up in the next video.
