import { db, jobs, companies, applications, students } from '@workspace/db'; import { eq } from '@workspace/db/drizzle'; import { notFound } from 'next/navigation'; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@workspace/ui/components/card'; import { Table, TableBody, TableHead, TableHeader, TableRow, TableCell } from '@workspace/ui/components/table'; import { Badge } from '@workspace/ui/components/badge'; import { Button } from '@workspace/ui/components/button'; import { ArrowLeft, MapPin, DollarSign, Calendar, GraduationCap, Building2, ExternalLink, Users, FileText, Clock } from 'lucide-react'; import Link from 'next/link'; import StatusSelect from './StatusSelect'; export const dynamic = 'force-dynamic'; export default async function JobDetailPage({ params }: { params: Promise<{ jobId: string }> }) { const { jobId: jobIdParam } = await params; const jobId = Number(jobIdParam); if (isNaN(jobId)) notFound(); const jobRes = await db.select().from(jobs).where(eq(jobs.id, jobId)).limit(1); if (jobRes.length === 0 || !jobRes[0]) notFound(); const job = jobRes[0]; const companyRes = await db .select() .from(companies) .where(eq(companies.id, job.companyId)) .limit(1); const company = companyRes[0]; const applicants = await db .select({ applicationId: applications.id, status: applications.status, firstName: students.firstName, lastName: students.lastName, email: students.email, studentId: students.id, }) .from(applications) .leftJoin(students, eq(applications.studentId, students.id)) .where(eq(applications.jobId, jobId)); return (
View and manage job information
Location
{job.location}
Salary
{job.salary}
Application Deadline
{job.applicationDeadline.toLocaleDateString()}
Applications
{applicants.length} students
{job.description}
{job.minCGPA}
Minimum CGPA
{job.minSSC}%
Minimum SSC
{job.minHSC}%
Minimum HSC
{company?.name}
{company?.email}
{company.description}
)}Students will appear here once they apply for this job.