1
00:00:00,210 --> 00:00:05,790
All right, and once we have the Front-End functionality in place, basically once we have the placeholder

2
00:00:06,150 --> 00:00:11,370
for any job, the first thing that we want to set up is the functionality on the backend.

3
00:00:11,850 --> 00:00:16,230
So we want to set up our update job or at a job or you want to call it.

4
00:00:17,030 --> 00:00:21,980
And let me take a look at the jobs controller if I have that job, sir, that is correct.

5
00:00:22,370 --> 00:00:25,010
And just like with the lead.

6
00:00:25,370 --> 00:00:27,380
Remember, we're looking for that, perhaps.

7
00:00:27,710 --> 00:00:34,520
So if I'll take a look at the roots, the job growth, more specifically, you'll notice that eventually

8
00:00:34,520 --> 00:00:35,540
there's going to be the start.

9
00:00:35,930 --> 00:00:38,810
But then we also have this colon and I do.

10
00:00:39,440 --> 00:00:45,980
So we know that we have our primes and we'll use them in order to delete and update the job.

11
00:00:46,370 --> 00:00:51,920
That's why, if we take a look to read me, you'll notice the first thing that I'm grabbing is the Iraqi

12
00:00:51,930 --> 00:00:54,510
branch, and I want to get that idea.

13
00:00:55,000 --> 00:00:58,840
Whatever it's going to be, and I'll right away give it an hour of Javadi.

14
00:00:59,120 --> 00:01:03,110
Like I mentioned, it's just easier for me to set up some kind of alias.

15
00:01:03,110 --> 00:01:07,340
Otherwise it's just a decided or even more one is the underscore.

16
00:01:07,520 --> 00:01:09,320
It is now next.

17
00:01:09,890 --> 00:01:13,490
This is optional, but I'll still check for company in position.

18
00:01:13,730 --> 00:01:15,620
This is going to be more for a postman.

19
00:01:15,860 --> 00:01:21,770
And this is something we need to understand that when we have our working front end, like over here,

20
00:01:22,070 --> 00:01:28,760
remember, we are doing already a bunch of steps that prevent to send those empty hours notice all the

21
00:01:28,760 --> 00:01:30,170
defaults that we have over here.

22
00:01:30,470 --> 00:01:32,840
Notice the fact that we're checking for empty values.

23
00:01:33,140 --> 00:01:35,030
And hopefully you see where I'm going with this.

24
00:01:35,300 --> 00:01:42,230
But yes, it's nice to set up extra precaution mechanisms, but if you really don't want to, you don't

25
00:01:42,230 --> 00:01:42,650
have to.

26
00:01:43,130 --> 00:01:48,650
And technically, I can look for all the properties coming from that body and check with our empty.

27
00:01:48,860 --> 00:01:53,750
But in my case, I'm just going to look for company and position and remember that at the end of the

28
00:01:53,750 --> 00:01:59,060
day, when we are on our find one and update most still around the validators.

29
00:01:59,450 --> 00:02:05,000
So if there is some missing property, we'll definitely check that with our arrow handler.

30
00:02:05,660 --> 00:02:13,370
So if one of them is missing, we send back bad request and then we get the job based on that I.D. So

31
00:02:13,370 --> 00:02:16,820
get me the job where the I.D. matches the job.

32
00:02:17,510 --> 00:02:21,260
Now, if job doesn't exist, we go with four or four.

33
00:02:21,590 --> 00:02:26,720
So there's no job, and eventually we'll have a separate video where we'll check the permissions.

34
00:02:26,750 --> 00:02:27,860
But that is coming up.

35
00:02:28,100 --> 00:02:35,450
So if everything is correct, we go with a job, find one and update, and then I'm going to be looking

36
00:02:35,450 --> 00:02:39,380
for a guy in the job who's I.D. matches the job ready.

37
00:02:39,830 --> 00:02:41,900
Then I'll pass in the that body.

38
00:02:42,140 --> 00:02:47,840
And yes, I'll showcase the alternative approach in the following videos as well where essentially,

39
00:02:47,840 --> 00:02:51,590
instead of running, find one and update, we can go with that same.

40
00:02:51,800 --> 00:02:52,940
So that is coming up.

41
00:02:53,150 --> 00:02:57,260
But back to this one, we're going to find one an update and go with record body.

42
00:02:58,010 --> 00:03:04,610
So basically, we pass in whatever we get back from the request and we set up new True.

43
00:03:04,760 --> 00:03:06,230
So that will return a new one.

44
00:03:06,500 --> 00:03:08,390
And we go run validators.

45
00:03:08,390 --> 00:03:08,690
True.

46
00:03:09,110 --> 00:03:16,430
And this is the case where again, technically front end is not looking for this one because we update

47
00:03:16,430 --> 00:03:16,970
the job.

48
00:03:17,660 --> 00:03:21,860
But in order to see all of them, we need to go back to all jobs anyway.

49
00:03:21,980 --> 00:03:24,180
Remember, that's the functionality we have.

50
00:03:24,560 --> 00:03:30,990
But just so we can see in a postman whether everything works, yes, I'll send back the update job.

51
00:03:31,100 --> 00:03:33,170
So essentially the job that we just updated.

52
00:03:33,620 --> 00:03:36,710
So let me go right now to the jobs controller.

53
00:03:37,640 --> 00:03:38,780
And let's do that.

54
00:03:39,230 --> 00:03:44,630
I'm going to go over here first with Minority, which is going to be coming from prompts like I said,

55
00:03:44,630 --> 00:03:46,370
I'm going to give it right away on Alias.

56
00:03:46,700 --> 00:03:52,430
I don't look for rec doc bribes when we want to grab the company in position.

57
00:03:52,820 --> 00:03:53,930
And I already covered that.

58
00:03:54,050 --> 00:03:57,260
Yes, of course, you can pull out more of ours if you want.

59
00:03:57,530 --> 00:04:00,110
And remember the way our front is set up.

60
00:04:00,360 --> 00:04:02,360
Yes, there will be all coming in.

61
00:04:02,750 --> 00:04:04,730
So I'm going to go with that body here.

62
00:04:05,090 --> 00:04:10,910
And then let's just say that if one of them is missing, then we want to throw the broader question.

63
00:04:11,270 --> 00:04:15,020
So in this case, I'll just bring this up a little bit and I'll grab this one.

64
00:04:15,290 --> 00:04:20,120
If there's no position, if there's no company, then I'll say, please provide all of ours.

65
00:04:20,540 --> 00:04:21,649
Then let's get the job.

66
00:04:21,980 --> 00:04:25,130
And that will be equal to await that job.

67
00:04:25,130 --> 00:04:27,860
And then we're looking for find one in this case.

68
00:04:28,250 --> 00:04:33,680
And I just say, get me the job whose idea matches the job ready.

69
00:04:33,800 --> 00:04:38,990
Now there might be some weird bug where the job doesn't exist, and we definitely want to handle that.

70
00:04:39,350 --> 00:04:41,210
Where I'll say, if there is no job.

71
00:04:42,170 --> 00:04:44,120
Then I want to go with throw.

72
00:04:44,120 --> 00:04:47,420
And then you and I, we're looking for not found there.

73
00:04:47,780 --> 00:04:50,300
So we're going to go with not found error.

74
00:04:50,750 --> 00:04:51,860
Hopefully already important.

75
00:04:51,860 --> 00:04:52,250
Not one.

76
00:04:53,180 --> 00:04:53,990
Doesn't look like that.

77
00:04:54,020 --> 00:05:01,010
So let me go here with a not found error of me out of karma, and I don't remember if we're going to

78
00:05:01,010 --> 00:05:01,730
be using this one.

79
00:05:01,740 --> 00:05:05,210
So for now, I'll just leave it and eventually we can always remove it.

80
00:05:05,600 --> 00:05:06,890
So let's keep on scrolling.

81
00:05:06,900 --> 00:05:09,780
Let's see if the server is still running.

82
00:05:09,800 --> 00:05:10,850
So all of that is good.

83
00:05:11,120 --> 00:05:12,950
We're going to go with a not found error.

84
00:05:13,370 --> 00:05:14,990
And let's just go with templates, terms.

85
00:05:14,990 --> 00:05:18,170
No job with ID.

86
00:05:18,440 --> 00:05:19,910
And let's set up the value here.

87
00:05:20,540 --> 00:05:22,400
Let's say the job +1 one.

88
00:05:23,240 --> 00:05:26,930
And once we have this check in place now, let's update the job now.

89
00:05:26,930 --> 00:05:32,090
Eventually, we'll check for permissions as well, and I'll span the entire video on that.

90
00:05:32,090 --> 00:05:38,660
So therefore, in here, I'm going to go with check permissions and then let's get that updated job

91
00:05:38,780 --> 00:05:42,890
so updated and then job and that is equal to await.

92
00:05:43,310 --> 00:05:43,750
Let's go.

93
00:05:43,940 --> 00:05:46,880
Job and then find one and update.

94
00:05:47,330 --> 00:05:48,620
So find one and update.

95
00:05:48,890 --> 00:05:54,950
And as a side note, if this picture back this find by adding an update, technically the way we'll

96
00:05:54,950 --> 00:05:57,530
set up the functionality that is going to work as well.

97
00:05:57,830 --> 00:06:02,780
So here, let's just go again with underscore it is equal to a job, Heidi.

98
00:06:03,020 --> 00:06:05,450
And we want to go with comma or a dead body.

99
00:06:05,750 --> 00:06:09,410
So these are all the values that we're going to be updating.

100
00:06:09,680 --> 00:06:11,600
And then let's set up those options here.

101
00:06:12,020 --> 00:06:17,960
Let's say that neutral, which is going to return that updated job, not the old one, because that

102
00:06:17,960 --> 00:06:18,920
would be a default one.

103
00:06:19,070 --> 00:06:21,800
And then we want to go and run validators and.

104
00:06:22,340 --> 00:06:28,280
And just to jog your memory when it comes to run validators, the way their work is found, if the property

105
00:06:28,280 --> 00:06:31,100
is not there, then there's going to be no complaint.

106
00:06:31,460 --> 00:06:39,410
Meaning if I'm updating a job and let's say I don't pass in that specific property now, if I do pass

107
00:06:39,410 --> 00:06:46,250
it in, but it's a empty value or maybe doesn't match the value that I require on a database, then

108
00:06:46,250 --> 00:06:47,500
this will spin back there.

109
00:06:47,710 --> 00:06:53,000
Matt is important distinction where, yes, all the buyers will be coming in from the frontend.

110
00:06:53,360 --> 00:06:59,540
But when it comes to these run validators, they will only run on what you provide over here in the

111
00:06:59,900 --> 00:07:00,230
body.

112
00:07:00,590 --> 00:07:06,560
So if the property is not provided all together, then you're just going to pass the check.

113
00:07:06,800 --> 00:07:11,300
Hopefully, that makes sense and let's go here with that status.

114
00:07:11,660 --> 00:07:15,080
We want to go with a status code after one.

115
00:07:15,470 --> 00:07:21,350
So let's pass in the status and then code, then set up our constant.

116
00:07:21,620 --> 00:07:23,710
OK, and then let's go with Jason.

117
00:07:23,720 --> 00:07:30,220
Like I said, let's send back that updated drum just so we can test that out in the man.

118
00:07:30,560 --> 00:07:34,130
And while we're at it, let's also right away test that out in the postman.

119
00:07:34,790 --> 00:07:36,680
So with me, log in as John.

120
00:07:37,650 --> 00:07:41,400
Just so I have the token, then I want to take a look at all my jobs.

121
00:07:41,850 --> 00:07:47,010
So admission here and I can see that I have six jobs, I believe.

122
00:07:47,400 --> 00:07:51,750
And then I want to add the first one, then it doesn't really matter which one you pick.

123
00:07:52,180 --> 00:07:53,820
So I'm just going to go with the first one.

124
00:07:54,060 --> 00:07:58,200
Now over here, I have company position and status as pending.

125
00:07:58,530 --> 00:08:01,590
So let's test it out where we want to go to update job.

126
00:08:02,040 --> 00:08:05,030
We actually want to pass in the job ready.

127
00:08:05,400 --> 00:08:07,610
So we go with jobs and then job.

128
00:08:07,610 --> 00:08:10,710
By then we want to look for a job on.

129
00:08:11,730 --> 00:08:17,820
And that in order to speed this up a little bit, I'm going to go back to get our jobs.

130
00:08:18,170 --> 00:08:24,930
Let me grab here company position and I'll pass in the states as well just so I can show you something.

131
00:08:25,290 --> 00:08:26,670
So let me take all of them.

132
00:08:27,030 --> 00:08:32,880
Let me go back to the job, you know, and here I'm just going to add, Google added, I worry.

133
00:08:32,880 --> 00:08:35,250
We know that we're editing the data.

134
00:08:35,669 --> 00:08:38,940
So what mission that everything seems to be working?

135
00:08:39,299 --> 00:08:44,039
So if I go back to get all jobs now, I have, Google added.

136
00:08:44,370 --> 00:08:50,820
And now let me stress something again, where if we don't provide status altogether, everything is

137
00:08:50,820 --> 00:08:51,420
going to work.

138
00:08:51,840 --> 00:08:58,800
So I sent here and let me remove the added and we should get back the error, the job and we're not

139
00:08:58,800 --> 00:08:59,190
in here.

140
00:08:59,430 --> 00:09:04,260
Let's change around a backhand so that we way for sure now that everything is working.

141
00:09:04,680 --> 00:09:08,070
So if I don't provide that properly, everything's fine.

142
00:09:08,070 --> 00:09:10,440
But if I'm going to go here with the status.

143
00:09:11,380 --> 00:09:13,630
And then remember, we are using enum correct.

144
00:09:14,020 --> 00:09:18,580
So in here, let's just assume something around them, something that is not in our way.

145
00:09:18,910 --> 00:09:24,580
You'll notice that we right away get random is not a valid enum value.

146
00:09:25,030 --> 00:09:32,890
And again, this just underscores the fact that when we go here with find one and update and we pass

147
00:09:32,890 --> 00:09:36,370
in the rock that body, our validators still run.

148
00:09:36,730 --> 00:09:42,780
But they will only run on properties that we provide if we don't provide those properties altogether

149
00:09:43,060 --> 00:09:45,910
than what validators are we going to run?

150
00:09:46,920 --> 00:09:51,450
Hopefully this makes sense, and now we can move on to the next topic.

