1
00:00:00,180 --> 00:00:00,550
Awesome.

2
00:00:00,870 --> 00:00:07,950
And up next, we have a day job and essentially, I can tell you right away that a lot of the stuff

3
00:00:07,950 --> 00:00:11,130
that we already wrote in a good job will repeat over here.

4
00:00:11,250 --> 00:00:16,560
So therefore, in order to speed this up a little, but of course, I will do some copy and paste thing

5
00:00:16,560 --> 00:00:17,480
here as well.

6
00:00:17,910 --> 00:00:22,680
And in order to test it out, I'm just going to navigate again back to the postman.

7
00:00:22,690 --> 00:00:23,760
This is where I'll start.

8
00:00:24,000 --> 00:00:27,120
I'll save this one first, the single job one.

9
00:00:27,390 --> 00:00:36,600
So get a single job, single job, and then let's create one for patch, meaning one for update.

10
00:00:36,600 --> 00:00:42,420
But of course the method will be patch and I'll leave get all jobs since I want to keep using those

11
00:00:42,420 --> 00:00:43,200
ideas, of course.

12
00:00:43,620 --> 00:00:50,370
And I think I can close the logging one for now because we already have logged in Azana and then let's

13
00:00:50,370 --> 00:00:54,660
look for the patch method and I'm a single digit single job.

14
00:00:54,690 --> 00:00:55,350
My apologies.

15
00:00:55,630 --> 00:00:57,030
So let me open up the new one.

16
00:00:57,860 --> 00:01:03,710
And I'm going to go with Patch we're looking for to you are all one and again will be looking for the

17
00:01:03,710 --> 00:01:09,070
jobs and then we want to go with that route parameter.

18
00:01:09,530 --> 00:01:11,750
And, of course, this is going to be that job.

19
00:01:11,750 --> 00:01:11,890
Right.

20
00:01:12,260 --> 00:01:14,030
So let me get all the jobs.

21
00:01:14,030 --> 00:01:14,720
And you know what?

22
00:01:15,050 --> 00:01:18,130
I will work with that last one since we have repeating rumors.

23
00:01:18,560 --> 00:01:26,540
So let me grab here this idea and then pass it here and remember authorization to go with their token.

24
00:01:26,750 --> 00:01:28,090
And we have access token.

25
00:01:28,400 --> 00:01:34,660
And if I send and if I get that job, then of course, we know that we can start setting up functionality.

26
00:01:35,060 --> 00:01:41,270
And as far as the logic, like I already said, I mean, most of it is going to be exactly the same

27
00:01:41,600 --> 00:01:47,810
difference, of course, is the Mongo's method we're going to use and the fact that I'll check for both,

28
00:01:48,050 --> 00:01:54,410
I'll check for company as well as the position and I'll check whether they are not empty and you'll

29
00:01:54,410 --> 00:01:55,100
see what I mean.

30
00:01:55,130 --> 00:01:59,960
And second, so where I have the update job, let's just start working on first.

31
00:02:00,260 --> 00:02:01,010
Same deal.

32
00:02:01,350 --> 00:02:04,550
I'm going to be looking for the user as well as the parents.

33
00:02:04,760 --> 00:02:11,060
So that won't change because remember, in the routes, I mean, all of them are looking for a route

34
00:02:11,060 --> 00:02:11,540
parameter.

35
00:02:11,630 --> 00:02:12,140
Correct.

36
00:02:12,440 --> 00:02:13,670
So let's take this one.

37
00:02:14,480 --> 00:02:17,630
There's really no point to repeat ourselves in this case.

38
00:02:17,900 --> 00:02:18,980
So it's copy and paste.

39
00:02:18,980 --> 00:02:25,400
However, the difference is that in this case, since we're updating also in the body, will provide

40
00:02:25,400 --> 00:02:26,030
some info.

41
00:02:26,420 --> 00:02:28,610
And in my case, I'm going to be looking for both.

42
00:02:29,120 --> 00:02:32,030
I want to get the company as well as the position.

43
00:02:32,540 --> 00:02:36,170
So let's go here with RA and we'll go with Jason here.

44
00:02:36,470 --> 00:02:41,540
And if you want to speed this up, you can actually go to create job and just take these values.

45
00:02:41,870 --> 00:02:45,050
So that's going to be a patch one copy and paste.

46
00:02:45,410 --> 00:02:48,200
And we just need to remember the Curley's here.

47
00:02:48,830 --> 00:02:54,080
And as far as the values, well, let's come up with some kind of company and I'll call this around

48
00:02:54,080 --> 00:02:54,320
them.

49
00:02:54,740 --> 00:02:57,140
And it's not going to be a back end developer.

50
00:02:57,590 --> 00:02:59,120
So it's going to be a full stack.

51
00:03:00,130 --> 00:03:08,560
And then back in my controller, we also want to add it over here, so I'm still structuring the request

52
00:03:08,560 --> 00:03:09,430
object, correct.

53
00:03:09,700 --> 00:03:16,690
And in there I have BRAMS, I have the user now as well as the body, because remember in here, we're

54
00:03:16,690 --> 00:03:17,960
sending that in the body.

55
00:03:18,280 --> 00:03:27,010
So let's go back and let's say body and in the body will be looking for company, company and position.

56
00:03:27,770 --> 00:03:31,810
Don't forget to add the comma and right after we structure everything.

57
00:03:32,230 --> 00:03:37,420
I also want to check whether the company or the position is empty.

58
00:03:37,690 --> 00:03:41,180
And if that's the case, I want to send back the back request.

59
00:03:41,550 --> 00:03:48,630
So say here, company is equal to an empty strength or position is equal to an empty string.

60
00:03:48,880 --> 00:03:55,150
And if that is the case, I'm going to go with Throw New and we're looking for bad request.

61
00:03:55,150 --> 00:03:59,080
Of course, it's a bad request error and say company.

62
00:04:00,100 --> 00:04:00,580
Or.

63
00:04:02,360 --> 00:04:11,150
Position fields cannot be empty, let's say, right here, and then, of course, we want to use our

64
00:04:11,360 --> 00:04:13,400
find one an update.

65
00:04:13,880 --> 00:04:19,430
And remember, we need to basically pass in three things we want to pass and what we want to update.

66
00:04:20,320 --> 00:04:26,410
We want to pass in which job we're looking for, and then, of course, we also have options where I

67
00:04:26,410 --> 00:04:31,060
want to get back the updated version as well as I want to run the validators.

68
00:04:31,450 --> 00:04:32,440
So let's do that.

69
00:04:32,710 --> 00:04:37,750
However, there is a tiny bug over here and essentially I'll come back to this one.

70
00:04:37,990 --> 00:04:38,380
Why?

71
00:04:38,380 --> 00:04:44,230
I prefer setting up the check in the controller once we start talking about the Mangoush errors.

72
00:04:44,630 --> 00:04:52,770
And let's just go with current job and set it equal to await that job, because that's the model.

73
00:04:53,050 --> 00:04:54,670
Fine one, an update.

74
00:04:55,270 --> 00:04:58,170
And then, like I said, first, we want to pass in.

75
00:04:58,420 --> 00:05:01,030
Well, which job are we going to update?

76
00:05:01,330 --> 00:05:07,300
And the set up is going to be exactly the same where I want to look for on the security as well as who

77
00:05:07,300 --> 00:05:07,960
created it.

78
00:05:08,440 --> 00:05:09,400
So let's go here.

79
00:05:09,520 --> 00:05:13,210
Let's say underscore it is equal to my job idea.

80
00:05:13,210 --> 00:05:13,630
Of course.

81
00:05:14,050 --> 00:05:15,460
Job ready, Van.

82
00:05:15,470 --> 00:05:18,970
We want to pass in the comma and we'll go with created.

83
00:05:19,450 --> 00:05:22,560
And then by now that is equal to my user idea.

84
00:05:23,080 --> 00:05:26,320
And then of course, we want to pass in what we want to update.

85
00:05:26,680 --> 00:05:33,200
So let's just go here with rack and body and then we want to pass in the options and I'm going to go

86
00:05:33,220 --> 00:05:34,060
to neutral.

87
00:05:34,150 --> 00:05:36,490
So we'll be getting back that updated job.

88
00:05:36,820 --> 00:05:40,150
And then I also want to write a way around my validators.

89
00:05:40,300 --> 00:05:46,700
And of course, the property for that is Aronne Valadares and I'll set it equal to zero.

90
00:05:47,110 --> 00:05:49,930
Now, if the job doesn't exist, we already know what we can do.

91
00:05:50,320 --> 00:05:53,140
We can simply throw a nut founder.

92
00:05:53,440 --> 00:05:56,670
And if everything is correct and of course we return the job.

93
00:05:56,980 --> 00:06:04,600
So let's scroll down, copy and paste and our functionality should be working where if everything is

94
00:06:04,600 --> 00:06:06,940
correct, I'll get back the updated job.

95
00:06:06,940 --> 00:06:09,610
If not, then of course I'll get back there.

96
00:06:09,910 --> 00:06:12,430
So let's start out right now in the post, man.

97
00:06:12,760 --> 00:06:15,040
So I'm going to go with full stack developer.

98
00:06:15,370 --> 00:06:22,990
And, you know, before we send the correct request, why don't we remove that last value in the Senate

99
00:06:22,990 --> 00:06:24,010
here and now?

100
00:06:24,010 --> 00:06:28,480
Of course, we're getting back that massive mongoose that we'll work on a little bit later.

101
00:06:28,780 --> 00:06:32,890
And then if I just change it around to four, then of course I'll get back.

102
00:06:32,890 --> 00:06:35,370
No job with ideas such and such.

103
00:06:35,650 --> 00:06:37,390
So let me change it back to three.

104
00:06:37,390 --> 00:06:38,770
I think that was the correct one.

105
00:06:38,950 --> 00:06:45,850
And now once I send now, of course, I am the company and the position is for stock developer.

106
00:06:46,180 --> 00:06:51,100
And with this in place, we only need to worry about remove job functionality.

