Skip to content

Commit

Permalink
fix:minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
Paribesh01 committed Nov 3, 2024
1 parent d6ca270 commit abfd631
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/actions/job.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,19 @@ export const getRecommendedJobs = withServerActionAsyncCatcher<
const { id } = result;

const job = await prisma.job.findUnique({
where: { id }, // Ensure params.id is available
where: { id },
select: {
id: true,
category: true,
// Add any other fields you need from the job
},
});

if (!job) {
throw new Error('Job not found');
}

// Use the category from the fetched job
const { category } = job;

// Fetch the latest three jobs excluding the current job and in the same category
const jobs = await prisma.job.findMany({
where: {
category: category,
Expand Down Expand Up @@ -252,7 +249,7 @@ export const getRecommendedJobs = withServerActionAsyncCatcher<
orderBy: {
postedAt: 'desc',
},
take: 3, // Fallback to showing latest 3 jobs from other categories
take: 3,
select: {
id: true,
type: true,
Expand Down
4 changes: 0 additions & 4 deletions src/components/RecentJobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import { useQuery } from '@tanstack/react-query';
import { useSession } from 'next-auth/react';

export default function RecentJobs() {
// const [recentJobs, getUserBookmarks] = await Promise.all([
// await getRecentJobs(),
// await GetUserBookmarksId(),
// ]);
const session = useSession();

const { data } = useQuery({
Expand Down

0 comments on commit abfd631

Please sign in to comment.