1
00:00:00,050 --> 00:00:04,490
And once we have validate test in place, now let's set up some constants.

2
00:00:04,610 --> 00:00:12,500
You see, when we were creating a job model, we hardcoded these values for the job status as well as

3
00:00:12,500 --> 00:00:13,700
the job type.

4
00:00:13,790 --> 00:00:19,580
But I want to set them up as constants and I actually want to set them up as objects.

5
00:00:19,580 --> 00:00:23,650
And that way we can nicely reuse it all throughout our project.

6
00:00:23,660 --> 00:00:29,030
So once we'll have the constants in place, we'll use it here in the job model.

7
00:00:29,150 --> 00:00:36,380
And also when we set up the validation and also when we'll need those values on the front end.

8
00:00:36,380 --> 00:00:37,370
So let's try it out.

9
00:00:37,370 --> 00:00:38,930
I'm going to navigate to my route.

10
00:00:39,560 --> 00:00:42,920
I want to create utils function and here.

11
00:00:43,740 --> 00:00:45,660
Let's go with constants.

12
00:00:46,240 --> 00:00:50,430
JS Like I said, I'll save them essentially as objects.

13
00:00:50,430 --> 00:00:51,710
So how is that going to look like?

14
00:00:51,720 --> 00:00:54,540
I'm going to go with export const.

15
00:00:55,500 --> 00:00:58,380
Job underscore status.

16
00:00:59,280 --> 00:01:00,780
That is equal to an object.

17
00:01:00,780 --> 00:01:03,070
And essentially I'll set up key value pairs.

18
00:01:03,090 --> 00:01:08,010
So I'm going to go here with pending and that is equal to a pending value.

19
00:01:08,460 --> 00:01:11,130
Then we also have two more.

20
00:01:11,920 --> 00:01:14,260
So the first one is going to be interview.

21
00:01:15,550 --> 00:01:17,340
And the value will be interview.

22
00:01:19,100 --> 00:01:20,720
And then the last one.

23
00:01:21,740 --> 00:01:23,090
It's going to be declined.

24
00:01:25,070 --> 00:01:28,430
And of course, the value also here is going to be declined.

25
00:01:28,460 --> 00:01:29,210
Let's save it.

26
00:01:29,210 --> 00:01:33,500
Let me just showcase how we're going to use it and then I'll set up the other two.

27
00:01:33,530 --> 00:01:39,500
So now once I'm exporting this from my constants, we want to navigate to a job model.

28
00:01:40,010 --> 00:01:46,340
We're looking for import and we want to go here with job status and notice here.

29
00:01:47,120 --> 00:01:48,740
At the moment I have the array.

30
00:01:49,070 --> 00:01:54,530
So in JavaScript how we can get the values from the object?

31
00:01:54,560 --> 00:01:57,050
Well, we have object.

32
00:01:58,180 --> 00:01:59,470
Dot values.

33
00:01:59,470 --> 00:02:00,600
So that's the method.

34
00:02:00,610 --> 00:02:04,660
And essentially we want to pass here the job status object.

35
00:02:04,660 --> 00:02:06,970
So the end result is the same.

36
00:02:06,970 --> 00:02:13,480
We still get back this array of only the values, only the pending interview and the client.

37
00:02:13,480 --> 00:02:17,710
However, the entire thing is sitting in one place.

38
00:02:17,710 --> 00:02:24,040
So again, I can nicely reuse it all throughout my project and you'll definitely see the benefit in

39
00:02:24,040 --> 00:02:28,090
the following video when we set up our validation.

40
00:02:28,180 --> 00:02:34,120
And as far as the default one, well, since it's an object, we can go here nicely with job status

41
00:02:34,210 --> 00:02:36,400
and then we're looking for the pending one.

42
00:02:36,400 --> 00:02:44,620
And effectively you want to repeat this for job type and I'll also right away set up for job sort,

43
00:02:44,650 --> 00:02:48,160
which essentially we will use it a little bit later.

44
00:02:48,160 --> 00:02:51,370
So let me navigate back to constants.

45
00:02:51,700 --> 00:02:56,830
We want to go with export, then const job underscore type.

46
00:02:57,690 --> 00:03:00,870
So that is equal to my object.

47
00:03:01,330 --> 00:03:05,150
First value full time is equal to full time.

48
00:03:05,170 --> 00:03:08,110
Then comma, Then we want to go with part time.

49
00:03:09,680 --> 00:03:14,210
So part time, then we want to set up the value.

50
00:03:15,550 --> 00:03:19,000
And then lastly, we're looking for internship.

51
00:03:21,880 --> 00:03:24,730
Of course, this value also will be the same.

52
00:03:27,690 --> 00:03:28,650
Let's save it.

53
00:03:29,130 --> 00:03:31,800
Same deal back in the job model.

54
00:03:32,790 --> 00:03:34,890
We just want to get the job type.

55
00:03:36,210 --> 00:03:39,380
Also use the object values.

56
00:03:42,430 --> 00:03:45,340
And we'll pass here the job type one.

57
00:03:45,370 --> 00:03:47,560
Now, when it comes to default one.

58
00:03:48,510 --> 00:03:54,750
Let's go with job type and then dot and we're looking for the full time.

59
00:03:55,200 --> 00:03:56,130
Let's save this.

60
00:03:56,130 --> 00:04:03,330
And then last one we'll set up is job sort by and again, this is something we're going to use a little

61
00:04:03,330 --> 00:04:09,270
bit later when we refactor, get all jobs and make it more complex.

62
00:04:09,270 --> 00:04:15,810
So first let's go with the name and I'm going to set it up as job underscore sort underscore by.

63
00:04:16,980 --> 00:04:19,200
So that's equal to my object.

64
00:04:19,200 --> 00:04:24,600
And we have newest first, oldest, first ascending and descending.

65
00:04:24,690 --> 00:04:29,370
So newest underscore first same value.

66
00:04:29,640 --> 00:04:30,680
In this case, you know what?

67
00:04:30,690 --> 00:04:32,070
I'm just going to go with newest.

68
00:04:32,820 --> 00:04:34,230
Then we have oldest.

69
00:04:35,450 --> 00:04:36,770
Underscore first.

70
00:04:37,410 --> 00:04:39,630
So set it equal to oldest.

71
00:04:39,750 --> 00:04:41,580
Then we have ascending.

72
00:04:43,500 --> 00:04:49,890
That one is equal to A to Z, and then the last value is going to be descending.

73
00:04:51,410 --> 00:04:54,200
And we'll set it Z to A.

74
00:04:54,810 --> 00:04:55,800
Let's save it.

75
00:04:55,800 --> 00:05:01,800
And once we have this one in place, now we can set up validation for job input.

