And once we have validate test in place, now let's set up some constants.
You see, when we were creating a job model, we hardcoded these values for the job status as well as
the job type.
But I want to set them up as constants and I actually want to set them up as objects.
And that way we can nicely reuse it all throughout our project.
So once we'll have the constants in place, we'll use it here in the job model.
And also when we set up the validation and also when we'll need those values on the front end.
So let's try it out.
I'm going to navigate to my route.
I want to create utils function and here.
Let's go with constants.
JS Like I said, I'll save them essentially as objects.
So how is that going to look like?
I'm going to go with export const.
Job underscore status.
That is equal to an object.
And essentially I'll set up key value pairs.
So I'm going to go here with pending and that is equal to a pending value.
Then we also have two more.
So the first one is going to be interview.
And the value will be interview.
And then the last one.
It's going to be declined.
And of course, the value also here is going to be declined.
Let's save it.
Let me just showcase how we're going to use it and then I'll set up the other two.
So now once I'm exporting this from my constants, we want to navigate to a job model.
We're looking for import and we want to go here with job status and notice here.
At the moment I have the array.
So in JavaScript how we can get the values from the object?
Well, we have object.
Dot values.
So that's the method.
And essentially we want to pass here the job status object.
So the end result is the same.
We still get back this array of only the values, only the pending interview and the client.
However, the entire thing is sitting in one place.
So again, I can nicely reuse it all throughout my project and you'll definitely see the benefit in
the following video when we set up our validation.
And as far as the default one, well, since it's an object, we can go here nicely with job status
and then we're looking for the pending one.
And effectively you want to repeat this for job type and I'll also right away set up for job sort,
which essentially we will use it a little bit later.
So let me navigate back to constants.
We want to go with export, then const job underscore type.
So that is equal to my object.
First value full time is equal to full time.
Then comma, Then we want to go with part time.
So part time, then we want to set up the value.
And then lastly, we're looking for internship.
Of course, this value also will be the same.
Let's save it.
Same deal back in the job model.
We just want to get the job type.
Also use the object values.
And we'll pass here the job type one.
Now, when it comes to default one.
Let's go with job type and then dot and we're looking for the full time.
Let's save this.
And then last one we'll set up is job sort by and again, this is something we're going to use a little
bit later when we refactor, get all jobs and make it more complex.
So first let's go with the name and I'm going to set it up as job underscore sort underscore by.
So that's equal to my object.
And we have newest first, oldest, first ascending and descending.
So newest underscore first same value.
In this case, you know what?
I'm just going to go with newest.
Then we have oldest.
Underscore first.
So set it equal to oldest.
Then we have ascending.
That one is equal to A to Z, and then the last value is going to be descending.
And we'll set it Z to A.
Let's save it.
And once we have this one in place, now we can set up validation for job input.