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.

feat: add job source search functionality to job listing

Khuram Niazd5c0b5b7879c
diff --git a/__tests__/job.actions.spec.ts b/__tests__/job.actions.spec.ts
index 9a3dbf5..1912ba0 100644
--- a/__tests__/job.actions.spec.ts
+++ b/__tests__/job.actions.spec.ts
@@ -199,6 +199,7 @@ describe("jobActions", () => {
{ JobTitle: { label: { contains: "Amazon" } } },
{ Company: { label: { contains: "Amazon" } } },
{ Location: { label: { contains: "Amazon" } } },
+ { JobSource: { label: { contains: "Amazon" } } },
{ description: { contains: "Amazon" } },
],
}),
@@ -211,6 +212,7 @@ describe("jobActions", () => {
{ JobTitle: { label: { contains: "Amazon" } } },
{ Company: { label: { contains: "Amazon" } } },
{ Location: { label: { contains: "Amazon" } } },
+ { JobSource: { label: { contains: "Amazon" } } },
{ description: { contains: "Amazon" } },
],
}),
@@ -257,6 +259,42 @@ describe("jobActions", () => {
});
});
+ it("should search across job source", async () => {
+ (getCurrentUser as any).mockResolvedValue(mockUser);
+ (prisma.job.findMany as any).mockResolvedValue([]);
+ (prisma.job.count as any).mockResolvedValue(0);
+
+ await getJobsList(1, 10, undefined, "LinkedIn");
+
+ const findManyCall = (prisma.job.findMany as any).mock.calls[0][0];
+ expect(findManyCall.where.OR).toContainEqual({
+ JobSource: { label: { contains: "LinkedIn" } },
+ });
+ });
+
+ it("should exclude JobSource from search OR when sourceValue is set", async () => {
+ (getCurrentUser as any).mockResolvedValue(mockUser);
+ (prisma.job.findMany as any).mockResolvedValue([]);
+ (prisma.job.count as any).mockResolvedValue(0);
+
+ await getJobsList(
+ 1,
+ 10,
+ undefined,
+ "LinkedIn",
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ "linkedin",
+ );
+
+ const findManyCall = (prisma.job.findMany as any).mock.calls[0][0];
+ expect(findManyCall.where.OR).not.toContainEqual({
+ JobSource: { label: { contains: "LinkedIn" } },
+ });
+ });
+
it("should search across description", async () => {
(getCurrentUser as any).mockResolvedValue(mockUser);
(prisma.job.findMany as any).mockResolvedValue([]);
@@ -385,6 +423,7 @@ describe("jobActions", () => {
expect(findManyCall.where.OR).toEqual([
{ JobTitle: { label: { contains: "Developer" } } },
{ Location: { label: { contains: "Developer" } } },
+ { JobSource: { label: { contains: "Developer" } } },
{ description: { contains: "Developer" } },
]);
expect(findManyCall.where.OR).not.toContainEqual({
diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.ts
index 79babc3..2df8630 100644
--- a/src/actions/job.actions.ts
+++ b/src/actions/job.actions.ts
@@ -118,6 +118,9 @@ export const getJobsList = async (
if (!locationValue) {
searchConditions.push({ Location: { label: { contains: search } } });
}
+ if (!sourceValue) {
+ searchConditions.push({ JobSource: { label: { contains: search } } });
+ }
searchConditions.push(
{ description: { contains: search } },
);