Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/(candidate)/candidate/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { auth } from '@clerk/nextjs/server'
import { db } from '@/lib/db'
import { prisma as db } from '@/lib/prisma'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
import { CalendarIcon, BriefcaseIcon, MapPinIcon } from 'lucide-react'
Expand All @@ -16,6 +16,7 @@ export default async function CandidateDashboard() {
const candidate = await db.candidate.findUnique({
where: { userId },
include: {
user: true,
applications: {
include: {
position: true,
Expand Down Expand Up @@ -44,7 +45,7 @@ export default async function CandidateDashboard() {
return (
<div className="space-y-8">
<div>
<h2 className="text-3xl font-bold tracking-tight">Welcome, {candidate.name.split(' ')[0]}</h2>
<h2 className="text-3xl font-bold tracking-tight">Welcome, {candidate.user?.name.split(' ')[0]}</h2>
<p className="text-muted-foreground">Here is the status of your recent applications.</p>
</div>

Expand Down
9 changes: 5 additions & 4 deletions app/(candidate)/candidate/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { auth } from '@clerk/nextjs/server'
import { db } from '@/lib/db'
import { prisma as db } from '@/lib/prisma'
import { redirect } from 'next/navigation'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
Expand All @@ -13,7 +13,8 @@ export default async function CandidateProfilePage() {
}

const candidate = await db.candidate.findFirst({
where: { userId }
where: { userId },
include: { user: true }
})

if (!candidate) {
Expand Down Expand Up @@ -45,7 +46,7 @@ export default async function CandidateProfilePage() {
</div>
<div>
<p className="text-sm font-medium leading-none">Email Address</p>
<p className="text-sm text-muted-foreground mt-1">{candidate.email}</p>
<p className="text-sm text-muted-foreground mt-1">{candidate.user?.email}</p>
</div>
</div>
<div className="flex items-center gap-3">
Expand All @@ -54,7 +55,7 @@ export default async function CandidateProfilePage() {
</div>
<div>
<p className="text-sm font-medium leading-none">Phone Number</p>
<p className="text-sm text-muted-foreground mt-1">{candidate.phone || 'Not provided'}</p>
<p className="text-sm text-muted-foreground mt-1">{candidate.user?.phone || 'Not provided'}</p>
</div>
</div>
</CardContent>
Expand Down
2 changes: 1 addition & 1 deletion app/(candidate)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { redirect } from 'next/navigation'
import { auth } from '@clerk/nextjs/server'
import { db } from '@/lib/db'
import { prisma as db } from '@/lib/prisma'
import { CandidateClientLayout } from './client-layout'

export default async function CandidateLayout({
Expand Down
289 changes: 0 additions & 289 deletions app/(dashboard)/admin/contacts/page.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion app/(dashboard)/dashboard/getUser.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { currentUser } from "@clerk/nextjs/server";
import { db } from "@/lib/db";
import { prisma as db } from "@/lib/prisma";

export async function getUser() {
const authUser = await currentUser();
Expand Down
2 changes: 1 addition & 1 deletion app/(dashboard)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TopCandidates } from "@/components/dashboard/top-candidates";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import { currentUser } from "@clerk/nextjs/server";
import { db } from "@/lib/db";
import { prisma as db } from "@/lib/prisma";

export default async function DashboardPage() {
const authUser = await currentUser();
Expand Down
6 changes: 3 additions & 3 deletions app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { redirect } from 'next/navigation'
import { auth } from '@clerk/nextjs/server'
import { db } from '@/lib/db'
import { prisma as db } from '@/lib/prisma'
import { ClientLayout } from './client-layout'

export default async function DashboardLayout({
Expand All @@ -20,9 +20,9 @@ export default async function DashboardLayout({
select: { role: true }
})

// If user is not found or is not an HR, redirect to candidate portal
// If user is not found or is not an HR/ADMIN, redirect to candidate portal
// (In case the webhook hasn't fired yet, they might not be found, but they are a user)
if (!user || user.role !== 'HR') {
if (!user || (user.role !== 'HR' && user.role !== 'ADMIN')) {
redirect('/candidate')
}

Expand Down
Loading