Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Increase recent number of job/activities to 7

Khuram Niazecbaf3bdb5b8
diff --git a/__tests__/dashboard.actions.spec.ts b/__tests__/dashboard.actions.spec.ts
index 4b17623..6763047 100644
--- a/__tests__/dashboard.actions.spec.ts
+++ b/__tests__/dashboard.actions.spec.ts
@@ -5,6 +5,7 @@ import {
getJobsActivityForPeriod,
getActivityCalendarData,
} from "@/actions/dashboard.actions";
+import { APP_CONSTANTS } from "@/lib/constants";
import { getCurrentUser } from "@/utils/user.utils";
import { PrismaClient } from "@prisma/client";
@@ -52,7 +53,7 @@ describe("Dashboard Actions", () => {
(getCurrentUser as jest.Mock).mockResolvedValue(null);
await expect(getJobsAppliedForPeriod(7)).rejects.toThrow(
- "Not authenticated"
+ "Not authenticated",
);
});
@@ -68,11 +69,11 @@ describe("Dashboard Actions", () => {
it("should handle database errors", async () => {
(getCurrentUser as jest.Mock).mockResolvedValue(mockUser);
(prisma.$transaction as jest.Mock).mockRejectedValue(
- new Error("Database error")
+ new Error("Database error"),
);
await expect(getJobsAppliedForPeriod(7)).rejects.toThrow(
- "Failed to calculate job count"
+ "Failed to calculate job count",
);
});
});
@@ -114,7 +115,7 @@ describe("Dashboard Actions", () => {
orderBy: {
appliedDate: "desc",
},
- take: 6,
+ take: APP_CONSTANTS.RECENT_NUM_JOBS_ACTIVITIES,
});
});
@@ -122,18 +123,18 @@ describe("Dashboard Actions", () => {
(getCurrentUser as jest.Mock).mockResolvedValue(null);
await expect(getRecentJobs()).rejects.toThrow(
- "Failed to fetch jobs list. "
+ "Failed to fetch jobs list. ",
);
});
it("should handle database errors", async () => {
(getCurrentUser as jest.Mock).mockResolvedValue(mockUser);
(prisma.job.findMany as jest.Mock).mockRejectedValue(
- new Error("Database error")
+ new Error("Database error"),
);
await expect(getRecentJobs()).rejects.toThrow(
- "Failed to fetch jobs list. "
+ "Failed to fetch jobs list. ",
);
});
@@ -176,18 +177,18 @@ describe("Dashboard Actions", () => {
(getCurrentUser as jest.Mock).mockResolvedValue(null);
await expect(getActivityDataForPeriod()).rejects.toThrow(
- "Failed to fetch activities data."
+ "Failed to fetch activities data.",
);
});
it("should handle database errors", async () => {
(getCurrentUser as jest.Mock).mockResolvedValue(mockUser);
(prisma.activity.findMany as jest.Mock).mockRejectedValue(
- new Error("Database error")
+ new Error("Database error"),
);
await expect(getActivityDataForPeriod()).rejects.toThrow(
- "Failed to fetch activities data."
+ "Failed to fetch activities data.",
);
});
@@ -251,18 +252,18 @@ describe("Dashboard Actions", () => {
(getCurrentUser as jest.Mock).mockResolvedValue(null);
await expect(getJobsActivityForPeriod()).rejects.toThrow(
- "Failed to fetch jobs list. "
+ "Failed to fetch jobs list. ",
);
});
it("should handle database errors", async () => {
(getCurrentUser as jest.Mock).mockResolvedValue(mockUser);
(prisma.job.groupBy as jest.Mock).mockRejectedValue(
- new Error("Database error")
+ new Error("Database error"),
);
await expect(getJobsActivityForPeriod()).rejects.toThrow(
- "Failed to fetch jobs list. "
+ "Failed to fetch jobs list. ",
);
});
@@ -308,18 +309,18 @@ describe("Dashboard Actions", () => {
(getCurrentUser as jest.Mock).mockResolvedValue(null);
await expect(getActivityCalendarData()).rejects.toThrow(
- "Failed to fetch jobs list. "
+ "Failed to fetch jobs list. ",
);
});
it("should handle database errors", async () => {
(getCurrentUser as jest.Mock).mockResolvedValue(mockUser);
(prisma.job.groupBy as jest.Mock).mockRejectedValue(
- new Error("Database error")
+ new Error("Database error"),
);
await expect(getActivityCalendarData()).rejects.toThrow(
- "Failed to fetch jobs list. "
+ "Failed to fetch jobs list. ",
);
});
diff --git a/src/actions/dashboard.actions.ts b/src/actions/dashboard.actions.ts
index 5a6060d..ff3007c 100644
--- a/src/actions/dashboard.actions.ts
+++ b/src/actions/dashboard.actions.ts
@@ -1,3 +1,4 @@
+import { APP_CONSTANTS } from "@/lib/constants";
import prisma from "@/lib/db";
import { calculatePercentageDifference, getLast7Days } from "@/lib/utils";
import { getCurrentUser } from "@/utils/user.utils";
@@ -64,7 +65,7 @@ export const getRecentJobs = async (): Promise<any | undefined> => {
orderBy: {
appliedDate: "desc",
},
- take: 6,
+ take: APP_CONSTANTS.RECENT_NUM_JOBS_ACTIVITIES,
});
return list;
} catch (error) {
@@ -312,7 +313,7 @@ export const getRecentActivities = async () => {
orderBy: {
endTime: "desc",
},
- take: 6,
+ take: APP_CONSTANTS.RECENT_NUM_JOBS_ACTIVITIES,
});
return list;
} catch (error) {
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 9494d8f..52ab5e5 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -14,6 +14,7 @@ export const APP_CONSTANTS = {
RECORDS_PER_PAGE_OPTIONS: [25, 50, 100],
ACTIVITY_MAX_DURATION_MINUTES: 8 * 60, // 8 Hours
ACTIVITY_MAX_DURATION_MS: 8 * 60 * 60 * 1000, // 8 hours in milliseconds
+ RECENT_NUM_JOBS_ACTIVITIES: 7,
} as const;
export const SCHEDULER_CONSTANTS = {