1
00:00:00,270 --> 00:00:00,660
Beautiful.

2
00:00:00,930 --> 00:00:08,550
And once we're done, we check permissions functionality before we rush over to the front end and start

3
00:00:08,550 --> 00:00:09,360
implementing it.

4
00:00:09,750 --> 00:00:13,740
Why don't we complete everything here in the jobs controller?

5
00:00:13,920 --> 00:00:19,260
Meaning why don't we also complete the delete job functionality?

6
00:00:19,440 --> 00:00:23,820
Since that way, we can set up both of them right away in the frontend.

7
00:00:24,270 --> 00:00:27,720
So I'm like going back and front and back and front.

8
00:00:27,720 --> 00:00:31,470
And in this case, why don't we complete the delayed job functionality as well?

9
00:00:31,800 --> 00:00:35,130
And then we'll implement both of them on the front end.

10
00:00:35,500 --> 00:00:42,690
It just seems like less of a switching, and essentially it's going to be extremely, extremely, extremely

11
00:00:42,690 --> 00:00:45,840
similar to that of the added jump.

12
00:00:46,290 --> 00:00:50,490
In this case, we just don't need to check for company position.

13
00:00:50,730 --> 00:00:57,750
We'll still check for Javadi, which is going to be in the params will still look for a job based on

14
00:00:57,750 --> 00:00:58,110
the ID.

15
00:00:58,650 --> 00:01:02,280
If the job doesn't exist, then we throw the error.

16
00:01:02,680 --> 00:01:05,790
And then, of course, again, we want to check for the permissions.

17
00:01:06,830 --> 00:01:12,350
And then instead of find one and remove, I'm just going to go with a weight and job.

18
00:01:13,190 --> 00:01:15,620
So this is another instance method that we can use.

19
00:01:16,070 --> 00:01:23,390
So previously I showed you a job that say unless there's job job there and we just invoke it online.

20
00:01:23,840 --> 00:01:27,080
Essentially, front end is not going to be looking for any kind of data.

21
00:01:27,440 --> 00:01:31,790
We simply want to send back some kind of message for the postman.

22
00:01:32,000 --> 00:01:36,650
As far as the front end, it will right away, no, whether we were successful or not.

23
00:01:36,980 --> 00:01:39,410
So let's start working on that.

24
00:01:39,410 --> 00:01:42,590
And I mean, just navigate to delete.

25
00:01:43,570 --> 00:01:44,500
Job over here.

26
00:01:44,980 --> 00:01:46,390
And you know what?

27
00:01:46,720 --> 00:01:50,500
In order to speed things up, I will grab some things from the job.

28
00:01:50,500 --> 00:01:53,470
I really don't see the point of reusing them.

29
00:01:53,890 --> 00:01:56,050
So let's go over here where we have the lead job.

30
00:01:56,380 --> 00:01:58,330
Let's grab the parameter first.

31
00:01:59,320 --> 00:02:04,150
Then, like I said, we're not looking for position, company or job location for that matter.

32
00:02:04,480 --> 00:02:07,120
And you're not may actually remove it from here as well.

33
00:02:07,810 --> 00:02:13,360
I just want to grab the job and if the job doesn't exist, then I want to throw the error.

34
00:02:13,780 --> 00:02:15,850
I actually want to remove these consumer logs.

35
00:02:17,110 --> 00:02:18,490
We're not going to need them anymore.

36
00:02:19,030 --> 00:02:24,580
So let's scroll where we have the lead job and also we can ride away, check the permission.

37
00:02:25,640 --> 00:02:27,050
So check the permissions.

38
00:02:27,290 --> 00:02:28,250
That's the cool thing.

39
00:02:28,550 --> 00:02:34,220
If you set it up as a function and you can just invoke the function, both things are going to be exactly

40
00:02:34,220 --> 00:02:41,300
the same redirect that the user as well as job created by and then as far as the response.

41
00:02:42,260 --> 00:02:45,440
Well, before we can do anything, we want to remove the job.

42
00:02:46,100 --> 00:02:53,900
So if everything is correct, we go with job and then Darth Remove, we invoke that and then let's send

43
00:02:53,900 --> 00:02:55,760
the rats that status.

44
00:02:56,140 --> 00:02:59,420
So that is going to be status code and not OK.

45
00:02:59,810 --> 00:03:02,880
And then, like I said, just for the postman purposes.

46
00:03:03,170 --> 00:03:04,400
We're going to go, Jason.

47
00:03:04,760 --> 00:03:06,740
And let's pass in the message.

48
00:03:07,310 --> 00:03:11,120
And here we're looking for the success.

49
00:03:12,080 --> 00:03:13,600
And let's go with Jobberman.

50
00:03:14,090 --> 00:03:18,460
Again, it's not going to show up anywhere on the front end job and.

51
00:03:19,680 --> 00:03:20,830
Let's save us.

52
00:03:21,170 --> 00:03:23,230
Let's remove the rats, not stand.

53
00:03:24,100 --> 00:03:28,210
Now, of course, we can test that out and navigate back to the post, man.

54
00:03:28,600 --> 00:03:33,100
I'll leave this one the way it is, and let's try to do that with the beta.

55
00:03:33,370 --> 00:03:36,340
Remember, we are logged in as beta, while at least I am.

56
00:03:36,700 --> 00:03:44,650
So let me go to the lead job, and if everything is correct, I shouldn't be successful because the

57
00:03:44,650 --> 00:03:49,990
job does not belong to Peter and I can clearly see my 401, which is just awesome.

58
00:03:50,290 --> 00:03:53,860
So now let me go back to the logging and logging as John.

59
00:03:54,860 --> 00:03:56,500
Let's send it here.

60
00:03:57,140 --> 00:04:00,890
Get back to response, and now when it comes to the leading job.

61
00:04:01,400 --> 00:04:06,410
Let me first double check, so it's definitely the case, so I'm going to get all my jobs.

62
00:04:06,770 --> 00:04:07,960
And let's go with this one.

63
00:04:08,330 --> 00:04:16,160
While this works and let's see whether I am successful, the job and if everything is correct, I should

64
00:04:16,160 --> 00:04:17,450
see the success message.

65
00:04:18,019 --> 00:04:20,690
Copy and paste and you have jobs removed.

66
00:04:21,570 --> 00:04:25,770
Now, if I go back to all my jobs now, I should have only five.

67
00:04:26,280 --> 00:04:33,450
And with this in place now I can implement both the edit one as well as delete one on the frontend.

