1
00:00:00,050 --> 00:00:00,500
All right.

2
00:00:00,680 --> 00:00:05,270
Up next, we have job status as well as the job type.

3
00:00:05,390 --> 00:00:09,380
And the setup is going to be extremely similar to the search.

4
00:00:09,410 --> 00:00:13,820
Now, of course, we're not going to use regex, but the main idea is going to be the same.

5
00:00:13,970 --> 00:00:21,200
Again, we want to pull out those parameters out of the req dot query and we want to inject both of

6
00:00:21,200 --> 00:00:23,960
them in our filter object.

7
00:00:23,960 --> 00:00:30,530
But please keep in mind that for job status and job type, we can have the value of all.

8
00:00:30,890 --> 00:00:38,480
Essentially I'm saying, hey, listen, get me all of the jobs regardless of the job status and job

9
00:00:38,480 --> 00:00:38,900
type.

10
00:00:38,900 --> 00:00:45,080
But if we'll search for the jobs where the job status is equal to all, we'll see that again.

11
00:00:45,080 --> 00:00:46,990
We get back empty array.

12
00:00:47,000 --> 00:00:48,440
So let's try it out.

13
00:00:48,500 --> 00:00:52,340
For starters, let's just navigate to our Thunder client.

14
00:00:52,370 --> 00:00:57,080
Let's write job status and we're going to go here with pending.

15
00:00:57,080 --> 00:00:58,400
So that should work.

16
00:00:58,430 --> 00:01:00,780
Then back in the job controller.

17
00:01:01,390 --> 00:01:02,890
We wanted the structure.

18
00:01:02,890 --> 00:01:04,840
So say here job status.

19
00:01:04,840 --> 00:01:08,770
And yes, we'll set up the condition in the second, but.

20
00:01:09,440 --> 00:01:11,490
Let's just see what we get back.

21
00:01:11,510 --> 00:01:16,640
If I just hardcode, I'll say job status is equal to the job status.

22
00:01:16,640 --> 00:01:20,300
And actually, since the names are the same, I can just do it this way.

23
00:01:20,660 --> 00:01:21,650
Let me send.

24
00:01:21,650 --> 00:01:27,620
And if I take a look, I'll get back all the jobs where the status is pending.

25
00:01:27,620 --> 00:01:32,330
And you can probably already guess that the same deal is going to be for the client and interview.

26
00:01:32,420 --> 00:01:34,450
But here's the kicker again.

27
00:01:34,460 --> 00:01:39,830
If we go here with all there are no jobs where the status is equal to all.

28
00:01:40,190 --> 00:01:45,800
So for both of them, for job status and job type, we want to set up two conditions.

29
00:01:45,800 --> 00:01:48,260
So let's go over here with job type.

30
00:01:48,260 --> 00:01:50,870
And for now, also let's provide all.

31
00:01:51,700 --> 00:01:54,370
Then let's navigate back to job controller.

32
00:01:54,400 --> 00:01:56,300
Let's destructure it.

33
00:01:56,320 --> 00:01:58,180
So I'm going to go with job type.

34
00:01:58,180 --> 00:02:06,070
And instead of hard coding and setting it right away in the query object, we'll set up two conditions.

35
00:02:06,310 --> 00:02:13,540
So we'll say if there is some kind of value and if it's not equal to all, then add it to an object.

36
00:02:13,540 --> 00:02:20,950
So again, we want to do it above the find since this is where we are using those values and it doesn't

37
00:02:20,950 --> 00:02:26,680
really matter whether you place it before or after the search, but in my case, I'll do it after and

38
00:02:26,680 --> 00:02:30,190
I'll say if and then we're looking for job status.

39
00:02:30,190 --> 00:02:35,110
So if it exists, maybe for some reason I'm getting an empty value.

40
00:02:35,110 --> 00:02:40,450
And if it's not equal to all only then I want to add it.

41
00:02:40,450 --> 00:02:47,680
So right over here, my condition, and then I'm going to look for my query object and I'll set my job.

42
00:02:47,680 --> 00:02:50,940
Status is equal to a job status.

43
00:02:50,950 --> 00:02:51,680
Now.

44
00:02:51,680 --> 00:02:54,560
Now I want to do the same thing for the job type.

45
00:02:54,560 --> 00:02:55,640
So let me.

46
00:02:56,410 --> 00:03:01,270
Select all of them over here and let me type job type as well.

47
00:03:01,520 --> 00:03:04,190
And now let's navigate back to all jobs.

48
00:03:04,210 --> 00:03:08,920
If we send basically, we'll get back all of the jobs.

49
00:03:09,650 --> 00:03:15,920
But if, for example, I'm going to go here with declined, of course now I'll have these values as

50
00:03:15,920 --> 00:03:17,240
far as job status.

51
00:03:17,300 --> 00:03:19,430
Now I can also change this one.

52
00:03:19,430 --> 00:03:23,380
The job type, I can set it equal to full time, for example.

53
00:03:23,390 --> 00:03:30,230
So now we'll get back jobs where status is declined and job type is full time.

54
00:03:30,230 --> 00:03:36,920
Now if we change any of them or both of them to all, then basically we'll get back jobs regardless

55
00:03:36,920 --> 00:03:39,830
of one or both of those values.

56
00:03:39,860 --> 00:03:41,180
Hopefully that is clear.

57
00:03:41,180 --> 00:03:45,320
And up next, we're going to work on the Sort functionality.

