------------------------------------------------------------------------------------ In Video #70 of our Job Portal Application Series, we focus on the backend logic of fetching job details by ID using Next.js dynamic routes, TypeScript, MySQL, and Drizzle ORM.
In this video, we are working on the Applicant Dashboard. When an applicant clicks on a job card, we navigate to a dynamic route and extract the job ID from the URL using Next.js params. With that ID, we fetch job details from multiple tables using Drizzle ORM joins and proper query conditions.
This video is UI-independent and purely focused on:
Backend thinking
Query design
Folder structure
Data fetching using ID
Validations using SQL conditions
📌 Must-watch if you want to build real-world applications using Next.js App Router + Drizzle ORM. 🔗 Useful Playlists
⌛TIMELINE⏳ 0:00 – Fetching job data using ID (overview) 1:30 – How we are getting ID from dynamic route 2:28 – Must watch & support the channel ❤️ 2:40 – Understanding folder structure 3:20 – How Next.js reaches the dynamic page 4:20 – What happens if wrong ID is passed 5:30 – Folder structure for getJobById query 6:24 – Thinking before writing database queries 8:50 – getJobById() function explained 11:50 – Verifying fetched data in console 13:10 – Next video update
AI Generated·May contain errors
Hello what's up everyone
Welcome everyone to Nextgest and MySQL's Present Job Portal Application
Today is day number 70
And today let's see how to retrieve job details using its ID
Yes guys you can now see how
When applicants log in all of our employees'
cards are displayed to
them in the same manner
But when we come here I can 't
seem to get the details
I obviously want to take the time to thoroughly examine this
You know I want to
I want to see what details are inside it
How much salary even for a
job and what kind of job is
it what company
is it what can I visit do you understand
All these things you're seeing right now guys we'll be looking at in this video
By the way this part here
We'll see the next video but today I want to show you something
This card that you're seeing right now
is here to demonstrate
When I click it shows—let me look closely
now it says "Kailika Month Stack" here
Main akar click karta ho so we have this month stack
You can also view the image differently
But when I click on it then
The image is different where is this one coming from If you understand how
is this data being fetched
Am I writing a separate
code for each one What am I doing here
Today in this video I'll
clarify that whenever you click
on it all your details will be pulled from the database
How you can get this special ID
Today we'll show you in this video In this video you'll learn how to jo
You'll see how to retrieve data from multiple tables
I'll show you the type of
method you can use to get it
Keep these few
important things in mind
First and foremost guys
We had already been working on something earlier
and that was when you were creating dynamic routes
for our applicant dashboard
For job details I was
explaining how to use parameters
You can easily retrieve the ID
If I show you here
we have this 9 number
9 means this is my job ID
I go back I click on it
When I click on it you can see
here that the number has changed
And what about yours right now
You're currently at 8 which means
the ID is with me so through
this ID whatever data I have
in my database will be accessed
Here I go now that this ID is based on it in our database
these are the fields: the
jobs table the employers table
Employers applicants users—among all these I
need to extract some
data and display it here
It would have been much easier if there was just one
table but I actually need data from two or three tables
How we can get trust we'll show you everything in
this video today Alright
guys without any further delay
We're starting the video now but first if you haven't checked
out the previous one yet make sure to do so right away
It's extremely important
And if you haven't already subscribed to my awesome channel Thapa Technical
please do so right away
It's quite simple if you look closely
This is your folder structure
Which I've already explained to you
If you look here
So in our applicant
Dashboard folder we created a jobs folder
and inside that we've
set up a dynamic route
Here we can see for many people
This is our dynamic route
Inside it there is a page where if you look closely
This is your page tsx
Everything we have inside it
Complete details of our job
Individual job will be shown to you
So right now
I'm on
this specific page
What do we see here today
We see
When I was there yesterday
If you remember
This is our page
When the user was clicking here
If you look closely here
We had implemented a loop here
You have a job card
If anyone clicks on any card in the job card
Then we show them this specific route
You were moving forward
look here now after the jobs
this is your ID remember
when I first started with you
No 9 which No 8 showed is from here
meaning that's the
number in question
You're passing 8 9 and
what exactly do you
mean by passing here Showing it in the URL
And if you want me to show you the URL I've
already shown it to you
— we can easily obtain it
With the help of
these parameters
we've already determined
its value and parsed it
as an integer: Params jobid
Here we have this job ID
We've parsed it into an integer
And I've obtained the value
For some reason though it didn't work out as a number
For some reason the user
entered 8 instead of 8 here
Even if A B C D are just random letters typed for
no reason you can still see them appearing right on that same page
But if this
were a completely
non-existent page we'd
show you a 404 error saying
this page doesn't exist
But we're parsing the integer
Got it
That's the scene you'referring to
If that number isn't it then we've shown you already
The page not found thing is why you were coming here Now that you've found what you were
looking for your job is done
If you need to retrieve data from the database
Then what should we do for that We're making a function call here
Its name is getjobbyid
Now this getjobbyid
Inside which I'm
passing an argument
And that argument is your jobid
Anyway I need a job
ID so I can fetch the
data It's either 8 or
9 If you look closely
We have this jobs kaa table
And here we have this id
Here it's 8
It's either 9 or 8
You won't see the rest of it
Your token has already expired
It'll be easy if I get 8 then I'll retrieve the data
I reached the job by that time I had
already left by then
Now look at Ziyar
See what I've done to it
Our humble request is that you kindly look into this matter
So what's the issue here
The lions of Jabal are our guides
The gods of beginning are ours for the server
You might have thought it was necessary
but really there was no such need
While we've kept it firmly established within employers themselves
The server has these queries inside it
jobs queries ts
You must come here as you can see for yourself
Simple didn't you notice the folder structure
Here you can see
That I've left a comment added
So it becomes easy for you to use IgDAM
Because I'm sharing the source code completely free of charge
So it's to your advantage
So guys if you haven't liked it yet please do so now
Because everything is free
So many hard-working videos just waiting to be watched
Check them out
We can define function very easily
This has been done in the usual manner
so get the job ID
You've passed the job ID here
and it's just a number
So we've defined its type number
then your curly braces
What's worth pondering here is
at when you're creating a function in this manner
basically when you perform the
query you should check this
I'm creating a dynamic
page for an individual card
So what does the applicant need
It might be helpful to consider what the applicant would want to see
So he fully understands
Yeah bro a vacancy has
just opened up for a Nek Jes DepLepar
which is a remote job based in Pokhara Nepal
Four days ago this was the type of good-paying job
Work type: This is what is required
Education: This is how much is needed
As for the company it's good
—about the company he can go
Then here about the role
responsibilities what all are
requirements nice to have remotes
And at the end how we can apply it
and the second skills and technology
What he needs and here finally we have this applied now
We'll see about that later
What I meant was that you need to think about it
What an applicant
might be charged
You now know that I have so many of these
The details shown here are what interest me
If it's due you now need to check this
at so many details you're about
to experience could this be
You have only one table in your system
So if you're looking
we have the jobs
Are all those fields available within the jobs
What feels strange to me here is
something you'll need to consider
In the jobs field's table do
we have this company's logo
What is the company's
name in the field of jobs
So none of this is obvious is it
So you'll have to think about it yourself
I need data from the employers table too
I need data not just from the users table but also from elsewhere
I need the data from the jobs table as well
You need the data from that table all together
Here you might wonder how to trigger your awakening with this
We've already seen Aladi
It's not that kind of situation
First-time users get the Thuru data via the Ryot portal
We've seen this before
— exactly the same way
These facts we've mentioned earlier regarding our card
When the card that comes before this one
He has seen her go there where she went
What will happen due to the joins
These are the data for multiples which you can access simultaneously
You can bring it into a jar
You are receiving your job table as
Minimum Maximum Salary Currency Salary Period
Now this is somewhat important
The location that will be used in your side war has been set
Job type work type label minimum
Now it's your turn to time stamp—look here at Gauhar
We're getting a data point from the users table
We’re getting a fill from the users’ table
at's your avatar URL
and employers' table from
I'm seeing four pieces of data
that's the company name
company description website URL
and then the locatio
He's there even in the middle of a jab data
on jobs users and employers
I think I've already explained it
The data I've provided here is exactly what I need
now from where
from the jobs table
we're going to use the join send
I only need this much data
Besides this nothing else is needed right Nothing further required after this
Neither left nor right jo
As much as you need just that much here
As many matches as there are that's all
It's easy if you look closely
Afterward therefore he will join the Joyandray
With AP users
The ID belonging to my employer is the
same as the ID in the employers table
and if the ID in the users table matches the
value in both cases then
proceed to the next step
That's all it takes after that people will come knocking at your door asking for your wear clause
Alright it's time
Our join is equal now we check the condition
What is the condition
Alright job ID—finally the job ID we passed has arrived
If you recall here's the job ID
The job ID is what matters most
And if we're limiting the job ID
In which we have written one
Meaning look here ma'am this ID will be the same anyway
But in this case we don't have the ID to confirm whether more than one has emerged
So we only need one output set the limit to one
When IDs are being verified the first item related to the job that we need is
Then if we do just that
And here we are defining the type
I'll tell you about it tomorrow during the meeting
But that's fine if we do it this way now
This function gets a job by ID
Then I'll just head back right here
I've left it here on the console
In this case if we don't get the job then
Again that same 404 page we 'll
just render it for them
But if everything is correc
So the job that we'll show you is this one
You've finally realized just how important this is
The data consists of multiple fields essentially
I'm joining the table data through joints
I can do it this way—it works out well like this
What are you saying
I'm walking here
I come here and just click on it
So now if you look the data has arrived here
Look here I'll zoom in—look at this
This data coming to you means
What happened is that my job is currently running
job id 9 title description
It's done this way isn't it
Alright whatever it is you'll know tomorrow
minimum tax salary—
everything all yours
My data has finally arrived
I knew the data I needed was there
Once I get hold of him my task will be done
That's all for this video
So how did he find me in this manner
Fine it's settled—see you in tomorrow's video
You can take it on as a challenge if you'd like
and that is the data which you now have the data is
How can you render this way now
When viewed side by side isn 't
the UI just as important
Here is the sidebar in this manner
This kind of sidebar you could
say it looks something like this
The icon is being used here for the entire side scene
Use the side scene if you're using us
To maintain consistency
Alright
But this as shown in yesterday's video
That's all for today's video—thank you for watching
Hope you enjoy the video guys
Please definitely let us know if you have any questions or need assistance by leaving a comment
I'll help you and if you like the video then