All right, and once we have the Front-End functionality in place, basically once we have the placeholder
for any job, the first thing that we want to set up is the functionality on the backend.
So we want to set up our update job or at a job or you want to call it.
And let me take a look at the jobs controller if I have that job, sir, that is correct.
And just like with the lead.
Remember, we're looking for that, perhaps.
So if I'll take a look at the roots, the job growth, more specifically, you'll notice that eventually
there's going to be the start.
But then we also have this colon and I do.
So we know that we have our primes and we'll use them in order to delete and update the job.
That's why, if we take a look to read me, you'll notice the first thing that I'm grabbing is the Iraqi
branch, and I want to get that idea.
Whatever it's going to be, and I'll right away give it an hour of Javadi.
Like I mentioned, it's just easier for me to set up some kind of alias.
Otherwise it's just a decided or even more one is the underscore.
It is now next.
This is optional, but I'll still check for company in position.
This is going to be more for a postman.
And this is something we need to understand that when we have our working front end, like over here,
remember, we are doing already a bunch of steps that prevent to send those empty hours notice all the
defaults that we have over here.
Notice the fact that we're checking for empty values.
And hopefully you see where I'm going with this.
But yes, it's nice to set up extra precaution mechanisms, but if you really don't want to, you don't
have to.
And technically, I can look for all the properties coming from that body and check with our empty.
But in my case, I'm just going to look for company and position and remember that at the end of the
day, when we are on our find one and update most still around the validators.
So if there is some missing property, we'll definitely check that with our arrow handler.
So if one of them is missing, we send back bad request and then we get the job based on that I.D. So
get me the job where the I.D. matches the job.
Now, if job doesn't exist, we go with four or four.
So there's no job, and eventually we'll have a separate video where we'll check the permissions.
But that is coming up.
So if everything is correct, we go with a job, find one and update, and then I'm going to be looking
for a guy in the job who's I.D. matches the job ready.
Then I'll pass in the that body.
And yes, I'll showcase the alternative approach in the following videos as well where essentially,
instead of running, find one and update, we can go with that same.
So that is coming up.
But back to this one, we're going to find one an update and go with record body.
So basically, we pass in whatever we get back from the request and we set up new True.
So that will return a new one.
And we go run validators.
True.
And this is the case where again, technically front end is not looking for this one because we update
the job.
But in order to see all of them, we need to go back to all jobs anyway.
Remember, that's the functionality we have.
But just so we can see in a postman whether everything works, yes, I'll send back the update job.
So essentially the job that we just updated.
So let me go right now to the jobs controller.
And let's do that.
I'm going to go over here first with Minority, which is going to be coming from prompts like I said,
I'm going to give it right away on Alias.
I don't look for rec doc bribes when we want to grab the company in position.
And I already covered that.
Yes, of course, you can pull out more of ours if you want.
And remember the way our front is set up.
Yes, there will be all coming in.
So I'm going to go with that body here.
And then let's just say that if one of them is missing, then we want to throw the broader question.
So in this case, I'll just bring this up a little bit and I'll grab this one.
If there's no position, if there's no company, then I'll say, please provide all of ours.
Then let's get the job.
And that will be equal to await that job.
And then we're looking for find one in this case.
And I just say, get me the job whose idea matches the job ready.
Now there might be some weird bug where the job doesn't exist, and we definitely want to handle that.
Where I'll say, if there is no job.
Then I want to go with throw.
And then you and I, we're looking for not found there.
So we're going to go with not found error.
Hopefully already important.
Not one.
Doesn't look like that.
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
be using this one.
So for now, I'll just leave it and eventually we can always remove it.
So let's keep on scrolling.
Let's see if the server is still running.
So all of that is good.
We're going to go with a not found error.
And let's just go with templates, terms.
No job with ID.
And let's set up the value here.
Let's say the job +1 one.
And once we have this check in place now, let's update the job now.
Eventually, we'll check for permissions as well, and I'll span the entire video on that.
So therefore, in here, I'm going to go with check permissions and then let's get that updated job
so updated and then job and that is equal to await.
Let's go.
Job and then find one and update.
So find one and update.
And as a side note, if this picture back this find by adding an update, technically the way we'll
set up the functionality that is going to work as well.
So here, let's just go again with underscore it is equal to a job, Heidi.
And we want to go with comma or a dead body.
So these are all the values that we're going to be updating.
And then let's set up those options here.
Let's say that neutral, which is going to return that updated job, not the old one, because that
would be a default one.
And then we want to go and run validators and.
And just to jog your memory when it comes to run validators, the way their work is found, if the property
is not there, then there's going to be no complaint.
Meaning if I'm updating a job and let's say I don't pass in that specific property now, if I do pass
it in, but it's a empty value or maybe doesn't match the value that I require on a database, then
this will spin back there.
Matt is important distinction where, yes, all the buyers will be coming in from the frontend.
But when it comes to these run validators, they will only run on what you provide over here in the
body.
So if the property is not provided all together, then you're just going to pass the check.
Hopefully, that makes sense and let's go here with that status.
We want to go with a status code after one.
So let's pass in the status and then code, then set up our constant.
OK, and then let's go with Jason.
Like I said, let's send back that updated drum just so we can test that out in the man.
And while we're at it, let's also right away test that out in the postman.
So with me, log in as John.
Just so I have the token, then I want to take a look at all my jobs.
So admission here and I can see that I have six jobs, I believe.
And then I want to add the first one, then it doesn't really matter which one you pick.
So I'm just going to go with the first one.
Now over here, I have company position and status as pending.
So let's test it out where we want to go to update job.
We actually want to pass in the job ready.
So we go with jobs and then job.
By then we want to look for a job on.
And that in order to speed this up a little bit, I'm going to go back to get our jobs.
Let me grab here company position and I'll pass in the states as well just so I can show you something.
So let me take all of them.
Let me go back to the job, you know, and here I'm just going to add, Google added, I worry.
We know that we're editing the data.
So what mission that everything seems to be working?
So if I go back to get all jobs now, I have, Google added.
And now let me stress something again, where if we don't provide status altogether, everything is
going to work.
So I sent here and let me remove the added and we should get back the error, the job and we're not
in here.
Let's change around a backhand so that we way for sure now that everything is working.
So if I don't provide that properly, everything's fine.
But if I'm going to go here with the status.
And then remember, we are using enum correct.
So in here, let's just assume something around them, something that is not in our way.
You'll notice that we right away get random is not a valid enum value.
And again, this just underscores the fact that when we go here with find one and update and we pass
in the rock that body, our validators still run.
But they will only run on properties that we provide if we don't provide those properties altogether
than what validators are we going to run?
Hopefully this makes sense, and now we can move on to the next topic.