---------------------------------------------------------------------------------- In this video, we start building the Apply Job feature for our Full Stack Job Portal Application using Next.js, MySQL, Drizzle ORM, and TypeScript.
So far in the project, the applicant can log in, browse job listings, and open a single job page. Now the next step is allowing users to apply for a job.
Instead of building the entire flow in one video, we are breaking it into 3 structured parts.
In Part 1, we will prepare all the necessary data required for the Apply Job Modal.
What you will learn in this video:
• How to get the jobId from params • Fetch complete job details • Check if the user has already applied for the job • Create the hasApplied logic to disable the Apply button • Fetch user resumes to show in the modal • Prepare and pass props to the ApplyJobModal component
At the end of this video, we will have all the required data ready to open the Apply Job Modal in the next part.
In the upcoming videos: Part 2 → Building the Apply Job Modal UI Part 3 → Submitting the application and saving data to the database
This project is perfect for developers who want to learn how real-world job portals work using Next.js App Router, Drizzle ORM, MySQL, and TypeScript. ------------------------------------------------------------------------------------ 🔗 Useful Playlists
⌛TIMELINE⏳ 0:00 Applicant Apply Job Flow – Overview 0:12 What We Have Built So Far 1:25 Apply Job Feature Structure (3 Parts Explained) 1:48 Support the Channel ❤️ 2:12 Understanding the Single Job Page Logic 3:20 Preparing Data for ApplyModal Component 4:10 Checking if Applicant Already Applied 7:10 Fetching User Resume Data 9:10 Props Required for ApplyModal Component 9:40 What We Will Build in the Next Video
AI Generated·May contain errors
Hello what's up everyone
Welcome everyone to the Nextgest and MySQL presented job portal application
Today is day number 86
and whenever we
click on this "apply now"
button a dialogue box will ope
By default we'll
retain the resume
the user previously selected in
their profile form after that guys
you can make changes right here
You can see
your cover letter
here for any job you apply to
You can write over here and then click
on Apply Now when you click Apply
Now guys check this out—your application
has been submitted successfully
Just a little while ago the
button were clicking right now
was active but now it's disabled
and I can't click it anymore
because I know tha
Maybe I won't remember
but if we show it
to me now obviously I'll clearly see it
and don't worry after that we'll also
check which jobs we've applied for
we'll show you right here how it works
applying it will make it clear
that's something for later
but right now this one's already applied
and whatever data were filling out if I were to take it
over here to the database that's what it would be
here you can see it gets
stored in our database
so this part guys is what we need to
If you want to complete the teen bhaagon today's
part 1 will cover this
where we'll go through our
The user interface—here's how
we created it
and I'll explain to you step by step starting with this Apply Now button
Whenever we click the dialogue
that was open before ours appears
The setup is such that whatever needs to be completed we've
finished it all today—just watch
in this video so don't worry
een video and more and then you'll see this whole thing after
that we'll look at the
applied one meaning it'll be awesome right
Alright guys we're jumping straight into the video without any
delay but before that here's what's left from the previous part
If the video isn't playing please
it's your device's issue not ours
If you enjoyed the video please like it and share widely with friends
and don’t forget to subscribe to the channel if you haven’t already
No please do it because your
like share and subscribe really
motivate me to keep uploading videos completely for free
The NSO score is completely free so there's absolutely nothing to worry about—just
take a look I'm Siddha myself
I'm using the VS Code editor here and you can see
this is our page
and one thing you should realize
and that is here
the information
you need—basically the
job overview salary your
remote work type and your title
location on what day you applied for this—everything
has already been reviewed by
us—our main concern was tha
The button here was something we had to address so
to handle that button we had
to go through a lot of steps
You'll need to listen carefully—it's very simple if you
understand it well then you'll
see what GoHar means Take care
So yeah this is our page
where we retrieve the job ID
obviously from here and you can
see the URL—we have the job ID
We simply retrieved our
parameter from there the job ID
is correct if the job ID
exists otherwise it's not found
and then we got the job by ID
so basically we ran this query to find out
the job ID was obtained now this job
I need all the details about the ID that was given
look at how much information there is
—its title its name everything
What was his salary What was his job
type What was the label We have obtained
all this information here We have
already reviewed this up to this point
So today's new part we have is this one here
the one you're seeing right now this part
This is all so new to us
Now let me tell you why we did this
Just like Philal right now this is
It's done I'm focusing one task now
I'm going back to my resume not a resume job application
I'll delete this record
That's fine as long as it stays this way otherwise I won't
be able to apply here anymore
it's okay now but I need it back
Apply now when I click on it you
should carefully check what's here
The data I have is the same
data I previously applied in the
resume section on our settings
page so it's showing up here for me
ow is it being handled
and how do we know whether
the user has already applied or not because if
If the user has already applied there's no need to show them
again so there's no point in displaying all those things we used to show
You need to be careful here that's
exactly what matters—look closely right
here—before you click the button we need to pay attention to these things
It will be checked whether the user exists or not and first of all whether
the current user is indeed ours—
this has already been handled simply
We still need it here why
Because I know you user
you'll get us and whoever the current user was
Then we created a new variable
has applied
because based on this we'll determine
yes brother if the value of has applied is
Disable the button if not
needed otherwise leave it as is
Okay then let's create another
variable named userResumes
user resumes we basically
define the
type here okay
Where were told that this variable
of mine will contain an array of
objects—what happens then An array
of objects and inside it as well—
we have an ID AUR a file
name will be an array
of an object targeting it and within it our
The ID and the name of our file will be
defined this way so the
user gets it correctly
and to this variable we've just looked here
like this target
now we need to check whether the user already
whether the user has already filled
out our application or not that 's
the key point—yes exactly that'
s why we need to check this now
It's going on because he has applied but how will we know whether he applied
or not How will we know
we're doing this for
him so that whenever
a user is present it's straightforward
and that is ki db select from our job applications ka table from our
job applications
matlab iski baat ho
rahi hai and right now yaha pe zero
because I just deleted it I'm deleting it right
now that's why we're
searching in the same table
where we are using an AND operator and
inside it we have used
two equality operators
That means it must be true and at
the same time that must also be true
Both of them must be true
absolutely everything must be true
If any condition turns out to be false your WHERE
clause will fail entirely
and essentially return false
and the equality
operator
must match the job ID
in your job applications
table with our job ID
You should check that the job ID here
matches the one in your application which is the applicant ID and confirm
whether this user
is currently present
The ID should also match if it does we've
already set a limit by
default so no problem
The match has been made—both parties
are matched That means the guy has
already applied which is why the match
happened And if he hadn't applied
If it's already been done
we're basically talking about the length of
existing applications that are using
select which will return an array to you
f it is greater than zero meaning
the bond has already been applied
then the value of has applied if the
condition is satisfied returns true
otherwise false here true here false
going there I'm setting it to him
then this variable's
The value has now been assigned to me—what about our user
Where can I get the value of his resume
Look here now
We can easily obtain the user's resume
I can do it because I
just need some kind of
value that would allow me to use it somehow
I can run smoothly—just take a look I'm not stressed
at all because the user's resume
is right here with me
To obtain the value of the user resume we're saying
that the user resume will
be an array of objects
and us object ke indar bhi do property hogi
that is your id and then filename
toh db select ye dekho
an object id
id basically kya hoga resume ka table
What will be the id
filename for that same file
What is the table file name Basically resume
Check your resume look
at the file name and
its ID—simple just the
ID followed by the file
name from your resume
table then the applicant
ID from the resume and
finally the user ID
The applicant ID in the resume
must match the user ID if they
match what does the user have
access to regarding the resume
an array containing an object ID and filename
with a value of true or false indicating
whether it has been applied which we
will receive next now we proceed downward
If you click on it here we basically just call a
separate component and then
it appears at the bottom
Look here
this is your main
if the user is present
then apply the job model
basically show this button
Show this button if not available with the text "
Login to apply " meaning
any person in this situatio
He reaches this far but then
he doesn’t even see it clearly
If the user isn't logged in show
them the login option to apply
here instead of "apply now"—if you
could do that it would be great
and this is your
applied job model
here you can see the job ID is
the job title is
the job ID was obtained from where is not know
He received the job offer through a connection the job title came from the job
table and the job itself came from
there which is why we're getting it here
and yes it has been applied—abhi just created if an existing one exists
then false otherwise true resume
has also just been created by abhi
So guys whatever you're
seeing here this part is what
we're aiming for so go ahead and create this section
what you're seeing here
so this part guys we'll examine it closely
in tomorrow's video where by default
How this dialogue appears to you and whenever anyone
clicks on it the default resume that is displayed
will be the one that is already there
Here's how it appears to you and here's the "Apply Now" button for the cover letter — all of this and
by the way take a look right here
if you look at it aren't they the same yet there's actually a
lot more inside it too
you'll be part of our journey in part 2 which we'll be exploring in tomorrow's
video and don't worry tomorrow's video will
I'll add a morning hello so you can
comfortably watch him just one day two videos
It'll be sent soon so you don't face more delays
so guys this is it for today's video
I hope you really enjoy the video
If anyone has any doubts please leave a comment
and let me know
If you enjoy the video please give it a like
How to share it with friends
If you haven't subscribed yet do it now
See you in the next video till then guys thank you
so much Take care