1
00:00:00,120 --> 00:00:07,170
Excellent, and once we have the job in place, not start working in jobs, comptroller and the first

2
00:00:07,290 --> 00:00:10,560
comptroller I want to work on is the create job one.

3
00:00:11,280 --> 00:00:18,090
And before we can do anything, we'll have to look for a job model than the status codes since of course,

4
00:00:18,090 --> 00:00:23,130
we'll be sending back some responses and also some errors.

5
00:00:23,460 --> 00:00:27,810
In this case, we have bad requests one as well as the not from one.

6
00:00:28,110 --> 00:00:34,800
Remember that when it comes to authentication, we already have everything in place, so we are out

7
00:00:34,800 --> 00:00:35,640
of the middle there.

8
00:00:36,450 --> 00:00:39,510
So that's why we're only looking for the suckers that were here.

9
00:00:39,990 --> 00:00:44,160
And as far as creating job, I look for position and a company again.

10
00:00:44,160 --> 00:00:50,370
I will set up some kind of check in the comptroller effectively for these two properties.

11
00:00:50,580 --> 00:00:52,290
They both will be in the body.

12
00:00:52,590 --> 00:00:56,550
And I'll say, if one of them is missing, then we go with please provide all of ours.

13
00:00:56,790 --> 00:01:01,590
And I know you're probably sick of hearing this, but the reason why we're setting this up this way

14
00:01:02,100 --> 00:01:06,780
is because we already have here those select inputs, so these powers will be provided.

15
00:01:07,230 --> 00:01:12,780
And also, when it comes to front end, first of all, will pass in the user's location.

16
00:01:13,200 --> 00:01:17,490
That's the whole point why we're setting this up as far as the frontend functionality.

17
00:01:17,940 --> 00:01:18,360
The second?

18
00:01:18,600 --> 00:01:25,060
Remember, we already have some d-4th for the location, so now will be equal to that MyCiti.

19
00:01:25,320 --> 00:01:26,310
Hopefully, that makes sense.

20
00:01:26,640 --> 00:01:31,050
And then since I need the user remember, where does the user sit?

21
00:01:31,860 --> 00:01:34,620
Well, it is sitting in right that user.

22
00:01:34,680 --> 00:01:37,290
More specifically, I'm looking for two years already.

23
00:01:38,010 --> 00:01:41,400
And what is the property that I want to set up?

24
00:01:41,940 --> 00:01:43,350
I want to set up created by?

25
00:01:43,590 --> 00:01:45,040
Let's take a look at the job market.

26
00:01:45,330 --> 00:01:46,650
This is the creative bar.

27
00:01:46,950 --> 00:01:48,180
So here's what I'm going to do.

28
00:01:48,690 --> 00:01:54,440
I'm going to attach on rack that body on the whole object, the property by the name.

29
00:01:54,810 --> 00:02:03,000
Created by and I'll set it equal to my user I.D. and then I can simply pass the rock that body into

30
00:02:03,000 --> 00:02:03,900
a job creation.

31
00:02:04,500 --> 00:02:08,130
And at the very end, I just want to send back the job.

32
00:02:08,490 --> 00:02:15,000
And once we know what we're going to be working on, let's go to a jobs controller and then one by one,

33
00:02:15,000 --> 00:02:16,080
let's get everything.

34
00:02:16,290 --> 00:02:19,200
First, we want to get the job from.

35
00:02:19,770 --> 00:02:24,090
And we're looking in the models first and then we want to get the job done.

36
00:02:24,480 --> 00:02:26,770
Then we also want to get the status code.

37
00:02:27,360 --> 00:02:34,500
So this is going to be the status code and then that one is equal to our library.

38
00:02:34,530 --> 00:02:37,380
Of course, the ATP status codes one.

39
00:02:37,740 --> 00:02:42,160
And lastly, we want to get the bar request and not found and you're not sure.

40
00:02:42,180 --> 00:02:43,950
So a little bit this up.

41
00:02:44,650 --> 00:02:45,870
Surely I should have done this way.

42
00:02:45,930 --> 00:02:50,640
My apologies should have just copy this one and then change the batteries.

43
00:02:51,030 --> 00:02:54,130
Let me copy and paste here, so I'm looking for the same things.

44
00:02:54,150 --> 00:02:58,260
I mean, they're sitting in the same folder, so there should be no issues over here.

45
00:02:58,690 --> 00:03:00,720
And let's start working on create job.

46
00:03:01,470 --> 00:03:07,980
Again, we have record rise, and first we want to grab the position and the company from the request

47
00:03:07,980 --> 00:03:08,490
that body.

48
00:03:08,970 --> 00:03:17,550
So let's say here position, then comma company and let's right away check for them in that body and

49
00:03:17,550 --> 00:03:19,070
then if one of them is missing.

50
00:03:19,170 --> 00:03:26,340
So if there is no position or if there is no company, then we want to throw the error.

51
00:03:27,190 --> 00:03:32,440
So, company, I want to throw the error, and in this case, we're going to go with battle request

52
00:03:32,440 --> 00:03:36,910
one, so throw and the new and no bad request error.

53
00:03:37,240 --> 00:03:45,580
And as far as the message, well, let's just say please provide all of ours online if everything is

54
00:03:45,580 --> 00:03:46,000
correct.

55
00:03:46,260 --> 00:03:51,790
Let's attach that user because again, I know I just said it, but let's double check.

56
00:03:52,240 --> 00:03:54,970
So in the server, what do we have over here?

57
00:03:55,540 --> 00:03:57,340
We have authenticate user.

58
00:03:58,230 --> 00:03:59,220
That's the middleware.

59
00:03:59,520 --> 00:04:00,690
And what is the middleware doing?

60
00:04:01,050 --> 00:04:02,010
Well, let's find it.

61
00:04:02,460 --> 00:04:03,480
Where is our middleware?

62
00:04:03,510 --> 00:04:04,560
Now that's the frontend.

63
00:04:04,710 --> 00:04:05,160
Sorry.

64
00:04:05,580 --> 00:04:11,340
In here in the off, we're attaching this user object with user ID property.

65
00:04:11,490 --> 00:04:12,990
So not in the job controller.

66
00:04:13,260 --> 00:04:19,800
I simply want to create a property on record that body since I'll pass in the whole thing.

67
00:04:19,890 --> 00:04:26,250
And I want to set it equal to my user I.D. So rec body and then dot created.

68
00:04:26,880 --> 00:04:33,210
And then by and then that one is equal to rec user and then user ID.

69
00:04:33,960 --> 00:04:38,940
And then once I have all of this in place now, I just want to go with job create.

70
00:04:39,300 --> 00:04:40,880
I want to set it equal to the job.

71
00:04:40,930 --> 00:04:47,640
So let's go await job and then create and let's part in the rec and body.

72
00:04:47,760 --> 00:04:51,230
And as far as the response, let's go Ra's status.

73
00:04:51,310 --> 00:04:53,490
Let's set up the proper status code.

74
00:04:53,860 --> 00:05:02,100
In this case, I'm going to call it status codes and then created announced code Dot, Jason and Sandy

75
00:05:02,100 --> 00:05:02,670
job back.

76
00:05:02,790 --> 00:05:03,410
Let's save it.

77
00:05:03,600 --> 00:05:05,190
And now let's go to the post, man.

78
00:05:05,310 --> 00:05:06,720
But it looks like I have an.

79
00:05:06,960 --> 00:05:08,010
So let me go check.

80
00:05:08,310 --> 00:05:11,940
And yes, of course, the famous Josh is missing.

81
00:05:11,970 --> 00:05:12,840
So let me say it.

82
00:05:12,840 --> 00:05:14,160
Let me check the console.

83
00:05:14,700 --> 00:05:16,290
I mean, looks about right.

84
00:05:16,290 --> 00:05:18,090
So let me send it one more time in here.

85
00:05:18,420 --> 00:05:21,780
And yes, I'm getting back the token, which is awesome.

86
00:05:22,200 --> 00:05:25,080
So now it's set up the create job one.

87
00:05:25,530 --> 00:05:26,790
So we want to go to create job.

88
00:05:26,790 --> 00:05:31,350
Remember, we already set up all the authentication, so I'm going to go over that one one more time

89
00:05:31,350 --> 00:05:36,720
because then definitely some people turn off the video and start yelling at the screen.

90
00:05:37,170 --> 00:05:43,740
So let me go here with Jason on two things that we want to pass and we want to pass in the company as

91
00:05:43,740 --> 00:05:46,990
well as the position famous Google, I think is going to work.

92
00:05:47,010 --> 00:05:53,220
And as far as the position, well, let's set up over here the quotation marks, and I'm going to go

93
00:05:53,220 --> 00:05:59,930
with frontend frontend developer sandbox and let's see and reduce.

94
00:05:59,940 --> 00:06:03,960
It looks like we have successful response where I get back my job.

95
00:06:04,710 --> 00:06:09,690
Combining Google position as frontend than the job type is full time.

96
00:06:10,200 --> 00:06:15,300
The status is pending and the job location at the moment is my city.

97
00:06:15,750 --> 00:06:17,160
And then we have two ideas.

98
00:06:17,490 --> 00:06:20,150
One is going to be for the user, so that is going to be John's idea.

99
00:06:20,470 --> 00:06:22,590
And second one will be the Javadi.

100
00:06:22,890 --> 00:06:27,870
And like I said, since we're using timestamps, we have created out and updated.

101
00:06:28,470 --> 00:06:29,070
My apologies.

102
00:06:29,070 --> 00:06:31,700
I think I might have said, modify that.

103
00:06:32,190 --> 00:06:34,920
Yep, the property name is updated app.

104
00:06:35,280 --> 00:06:41,070
And now let's quickly test whether everything works as far as the validation.

105
00:06:41,370 --> 00:06:49,110
So let me remove the position, but essentially try to send the empty value and we should get back 400

106
00:06:49,890 --> 00:06:56,880
if we do that and we can fix it back up to some kind of correct value and now we can move on to the

107
00:06:56,880 --> 00:06:57,510
next step.

