Excellent, and once we have the job in place, not start working in jobs, comptroller and the first
comptroller I want to work on is the create job one.
And before we can do anything, we'll have to look for a job model than the status codes since of course,
we'll be sending back some responses and also some errors.
In this case, we have bad requests one as well as the not from one.
Remember that when it comes to authentication, we already have everything in place, so we are out
of the middle there.
So that's why we're only looking for the suckers that were here.
And as far as creating job, I look for position and a company again.
I will set up some kind of check in the comptroller effectively for these two properties.
They both will be in the body.
And I'll say, if one of them is missing, then we go with please provide all of ours.
And I know you're probably sick of hearing this, but the reason why we're setting this up this way
is because we already have here those select inputs, so these powers will be provided.
And also, when it comes to front end, first of all, will pass in the user's location.
That's the whole point why we're setting this up as far as the frontend functionality.
The second?
Remember, we already have some d-4th for the location, so now will be equal to that MyCiti.
Hopefully, that makes sense.
And then since I need the user remember, where does the user sit?
Well, it is sitting in right that user.
More specifically, I'm looking for two years already.
And what is the property that I want to set up?
I want to set up created by?
Let's take a look at the job market.
This is the creative bar.
So here's what I'm going to do.
I'm going to attach on rack that body on the whole object, the property by the name.
Created by and I'll set it equal to my user I.D. and then I can simply pass the rock that body into
a job creation.
And at the very end, I just want to send back the job.
And once we know what we're going to be working on, let's go to a jobs controller and then one by one,
let's get everything.
First, we want to get the job from.
And we're looking in the models first and then we want to get the job done.
Then we also want to get the status code.
So this is going to be the status code and then that one is equal to our library.
Of course, the ATP status codes one.
And lastly, we want to get the bar request and not found and you're not sure.
So a little bit this up.
Surely I should have done this way.
My apologies should have just copy this one and then change the batteries.
Let me copy and paste here, so I'm looking for the same things.
I mean, they're sitting in the same folder, so there should be no issues over here.
And let's start working on create job.
Again, we have record rise, and first we want to grab the position and the company from the request
that body.
So let's say here position, then comma company and let's right away check for them in that body and
then if one of them is missing.
So if there is no position or if there is no company, then we want to throw the error.
So, company, I want to throw the error, and in this case, we're going to go with battle request
one, so throw and the new and no bad request error.
And as far as the message, well, let's just say please provide all of ours online if everything is
correct.
Let's attach that user because again, I know I just said it, but let's double check.
So in the server, what do we have over here?
We have authenticate user.
That's the middleware.
And what is the middleware doing?
Well, let's find it.
Where is our middleware?
Now that's the frontend.
Sorry.
In here in the off, we're attaching this user object with user ID property.
So not in the job controller.
I simply want to create a property on record that body since I'll pass in the whole thing.
And I want to set it equal to my user I.D. So rec body and then dot created.
And then by and then that one is equal to rec user and then user ID.
And then once I have all of this in place now, I just want to go with job create.
I want to set it equal to the job.
So let's go await job and then create and let's part in the rec and body.
And as far as the response, let's go Ra's status.
Let's set up the proper status code.
In this case, I'm going to call it status codes and then created announced code Dot, Jason and Sandy
job back.
Let's save it.
And now let's go to the post, man.
But it looks like I have an.
So let me go check.
And yes, of course, the famous Josh is missing.
So let me say it.
Let me check the console.
I mean, looks about right.
So let me send it one more time in here.
And yes, I'm getting back the token, which is awesome.
So now it's set up the create job one.
So we want to go to create job.
Remember, we already set up all the authentication, so I'm going to go over that one one more time
because then definitely some people turn off the video and start yelling at the screen.
So let me go here with Jason on two things that we want to pass and we want to pass in the company as
well as the position famous Google, I think is going to work.
And as far as the position, well, let's set up over here the quotation marks, and I'm going to go
with frontend frontend developer sandbox and let's see and reduce.
It looks like we have successful response where I get back my job.
Combining Google position as frontend than the job type is full time.
The status is pending and the job location at the moment is my city.
And then we have two ideas.
One is going to be for the user, so that is going to be John's idea.
And second one will be the Javadi.
And like I said, since we're using timestamps, we have created out and updated.
My apologies.
I think I might have said, modify that.
Yep, the property name is updated app.
And now let's quickly test whether everything works as far as the validation.
So let me remove the position, but essentially try to send the empty value and we should get back 400
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
next step.