1
00:00:00,300 --> 00:00:07,290
Wonderful, once we have the general structure in place so effectively, once we have the empty object

2
00:00:07,560 --> 00:00:14,730
and then we check for the properties that correspond to whatever we have in the model, now, of course,

3
00:00:14,730 --> 00:00:18,390
we can continue and add more functionality to our API.

4
00:00:18,600 --> 00:00:19,090
Correct.

5
00:00:19,410 --> 00:00:27,870
So we want our user to search based on name, maybe also based on price, as well as writing and company

6
00:00:28,080 --> 00:00:28,950
and all that.

7
00:00:29,340 --> 00:00:34,380
Now, I can tell you right away that we will purposely work on the number of hours.

8
00:00:34,380 --> 00:00:40,710
So the price and writing and all that a little later, because probably that's going to be the most

9
00:00:40,710 --> 00:00:43,390
complex logic of this project.

10
00:00:43,710 --> 00:00:46,620
For now, I want to work on a name and company.

11
00:00:46,890 --> 00:00:51,780
Now, company should be somewhat straightforward where we're going to check for the company.

12
00:00:52,110 --> 00:00:56,720
So say, hey, is the company property on my right that query?

13
00:00:57,090 --> 00:01:01,100
And of course, then we'll set up the value in the object.

14
00:01:01,500 --> 00:01:05,250
And if of course we can find something, then we're in good shape.

15
00:01:05,489 --> 00:01:08,280
If not and of course we return nothing.

16
00:01:08,580 --> 00:01:09,600
So let's go back.

17
00:01:09,780 --> 00:01:13,830
And the first thing that I want to do is, of course, pass it from my postman.

18
00:01:14,130 --> 00:01:15,690
So on here I remove the page.

19
00:01:15,690 --> 00:01:21,030
Hopefully it is clear what happens with the properties that are actually not on our model.

20
00:01:21,810 --> 00:01:23,340
And then let's set up a new one.

21
00:01:23,730 --> 00:01:25,710
And here I'll say company.

22
00:01:26,560 --> 00:01:29,120
Company as far as the values.

23
00:01:29,140 --> 00:01:34,840
Well, let me check, since it's going to be faster, so let's say I'm going to go with this one copy

24
00:01:34,840 --> 00:01:37,210
and paste and now I'm going to look for both.

25
00:01:37,570 --> 00:01:43,130
I'll say, hey, get me where the feature is false and company is this one.

26
00:01:43,150 --> 00:01:44,290
So let me send it here.

27
00:01:44,620 --> 00:01:50,530
And now what you should see is only the product that matches company.

28
00:01:50,660 --> 00:01:54,550
Now, of course, not yet, but that is the eventual goal.

29
00:01:54,820 --> 00:01:57,040
So let me navigate back and notice again.

30
00:01:57,250 --> 00:01:58,780
We only get the feature.

31
00:01:58,870 --> 00:01:59,290
Why?

32
00:01:59,470 --> 00:02:00,990
Because that's my logic.

33
00:02:01,240 --> 00:02:05,950
So let's go back over here and let's say that we're also going to be looking for the company again,

34
00:02:05,950 --> 00:02:12,430
not to be redundant because this company corresponds to something we have already in the model.

35
00:02:12,860 --> 00:02:17,410
Otherwise, we'll have that mass where Mongo's is going to be like, hey, listen, what's happening?

36
00:02:17,620 --> 00:02:18,720
I cannot find anything.

37
00:02:18,970 --> 00:02:20,950
Then, of course, we want to set up the logic.

38
00:02:21,250 --> 00:02:26,950
And this is going to be as straightforward as it gets when essentially I'm going to say if the company

39
00:02:26,950 --> 00:02:32,230
exists, then of course, I just want to set up my property on a query object.

40
00:02:32,800 --> 00:02:39,190
The name, of course, will be company, and I'll set it equal to my company, the one that I'm pulling

41
00:02:39,190 --> 00:02:39,850
out of here.

42
00:02:40,090 --> 00:02:45,780
So once I save and once we try one more time, we should get different amount of values.

43
00:02:46,030 --> 00:02:48,790
And of course, in this case, we get only six.

44
00:02:49,090 --> 00:02:54,930
So now we get featured falls and company is equal to IKEA.

45
00:02:55,420 --> 00:03:00,130
Now, if I'm going to pass in some kind of gibberish from one said that I'm looking for a company,

46
00:03:00,130 --> 00:03:04,550
BBB Porche, I'm going to get zero results, but that's what we expected.

47
00:03:04,990 --> 00:03:10,480
So if we're looking for something that doesn't make sense, there's of course, the user is not going

48
00:03:10,480 --> 00:03:11,230
to be successful.

49
00:03:11,680 --> 00:03:17,380
But if the user provides correct company value, then of course we send back the list of products that

50
00:03:17,380 --> 00:03:18,690
correspond to that value.

51
00:03:18,970 --> 00:03:23,420
And if you're wondering, well, where the user is going to know that info.

52
00:03:23,500 --> 00:03:25,930
Well, that's why we have documentation.

53
00:03:26,350 --> 00:03:33,640
So if you go back to this API, you can see how that clearly explain what are our options and essentially

54
00:03:33,760 --> 00:03:35,780
how we can work with the API.

55
00:03:36,040 --> 00:03:38,800
So now, of course, in our API, we handle two things.

56
00:03:39,010 --> 00:03:42,370
We handle feature and we also handle the company.

