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.

refactor: extract shared helpers and remove dead code

Khuram Niaza11a047fdd31
diff --git a/package-lock.json b/package-lock.json
index c5b6b51..033200c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,14 +11,12 @@
"@ai-sdk/deepseek": "^2.0.4",
"@ai-sdk/google": "^3.0.53",
"@ai-sdk/openai": "^3.0.2",
- "@ai-sdk/react": "^3.0.5",
"@hookform/resolvers": "^5.2.2",
"@modelcontextprotocol/sdk": "^1.26.0",
"@nivo/bar": "^0.99.0",
"@nivo/calendar": "^0.99.0",
"@nivo/core": "^0.99.0",
"@prisma/client": "^6.19.0",
- "@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "^1.1.3",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-collapsible": "^1.1.12",
@@ -51,7 +49,6 @@
"lucide-react": "^0.469.0",
"mammoth": "^1.12.0",
"markdown-it": "^14.1.0",
- "mcp-handler": "^1.1.0",
"next": "^15.5.18",
"next-auth": "^5.0.0-beta.30",
"next-themes": "^0.4.4",
@@ -256,24 +253,6 @@
"zod": "^3.25.76 || ^4.1.8"
}
},
- "node_modules/@ai-sdk/react": {
- "version": "3.0.5",
- "resolved": "https://registry.npmjs.org/@ai-sdk/react/-/react-3.0.5.tgz",
- "integrity": "sha512-0J9YKeeouG2tg84hEu2p9W6zcv4TRrl0BQq0HmUjqn/Y6arXeX1LNTTG1WhO4y2oPLVGrhzurJIUmMgzJl41yQ==",
- "license": "Apache-2.0",
- "dependencies": {
- "@ai-sdk/provider-utils": "4.0.2",
- "ai": "6.0.5",
- "swr": "^2.2.5",
- "throttleit": "2.1.0"
- },
- "engines": {
- "node": ">=18"
- },
- "peerDependencies": {
- "react": "^18 || ~19.0.1 || ~19.1.2 || ^19.2.1"
- }
- },
"node_modules/@ai-zen/node-fetch-event-source": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@ai-zen/node-fetch-event-source/-/node-fetch-event-source-2.1.4.tgz",
@@ -5346,37 +5325,6 @@
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
"license": "MIT"
},
- "node_modules/@radix-ui/react-accordion": {
- "version": "1.2.12",
- "resolved": "https://registry.npmjs.org/@radix-ui/react-accordion/-/react-accordion-1.2.12.tgz",
- "integrity": "sha512-T4nygeh9YE9dLRPhAHSeOZi7HBXo+0kYIPJXayZfvWOWA0+n3dESrZbjfDPUABkUNym6Hd+f2IR113To8D2GPA==",
- "license": "MIT",
- "dependencies": {
- "@radix-ui/primitive": "1.1.3",
- "@radix-ui/react-collapsible": "1.1.12",
- "@radix-ui/react-collection": "1.1.7",
- "@radix-ui/react-compose-refs": "1.1.2",
- "@radix-ui/react-context": "1.1.2",
- "@radix-ui/react-direction": "1.1.1",
- "@radix-ui/react-id": "1.1.1",
- "@radix-ui/react-primitive": "2.1.3",
- "@radix-ui/react-use-controllable-state": "1.2.2"
- },
- "peerDependencies": {
- "@types/react": "*",
- "@types/react-dom": "*",
- "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
- "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
- },
- "peerDependenciesMeta": {
- "@types/react": {
- "optional": true
- },
- "@types/react-dom": {
- "optional": true
- }
- }
- },
"node_modules/@radix-ui/react-alert-dialog": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/@radix-ui/react-alert-dialog/-/react-alert-dialog-1.1.15.tgz",
@@ -10678,7 +10626,9 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz",
"integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==",
+ "dev": true,
"license": "Apache-2.0",
+ "optional": true,
"engines": {
"node": ">=0.10.0"
}
@@ -11482,6 +11432,7 @@
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
@@ -13537,15 +13488,6 @@
"node": ">= 0.4"
}
},
- "node_modules/generic-pool": {
- "version": "3.9.0",
- "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz",
- "integrity": "sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==",
- "license": "MIT",
- "engines": {
- "node": ">= 4"
- }
- },
"node_modules/get-east-asian-width": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
@@ -16347,131 +16289,6 @@
"node": ">= 18"
}
},
- "node_modules/mcp-handler": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/mcp-handler/-/mcp-handler-1.1.0.tgz",
- "integrity": "sha512-MVCES7g18gcoZy+R/3v5nadkUMzMAWdos8jRl6DyljOKvd2/ZKDmwlCjL6zp4vo+7FeCXOYL1uWinHWlkKAAUg==",
- "license": "Apache-2.0",
- "dependencies": {
- "chalk": "^5.3.0",
- "commander": "^11.1.0",
- "redis": "^4.6.0"
- },
- "bin": {
- "create-mcp-route": "dist/cli/index.js",
- "mcp-adapter": "dist/cli/index.js",
- "mcp-handler": "dist/cli/index.js"
- },
- "peerDependencies": {
- "@modelcontextprotocol/sdk": "1.26.0",
- "next": ">=13.0.0"
- },
- "peerDependenciesMeta": {
- "@modelcontextprotocol/sdk": {
- "optional": false
- },
- "next": {
- "optional": true
- }
- }
- },
- "node_modules/mcp-handler/node_modules/@redis/bloom": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.2.0.tgz",
- "integrity": "sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==",
- "license": "MIT",
- "peerDependencies": {
- "@redis/client": "^1.0.0"
- }
- },
- "node_modules/mcp-handler/node_modules/@redis/client": {
- "version": "1.6.1",
- "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.6.1.tgz",
- "integrity": "sha512-/KCsg3xSlR+nCK8/8ZYSknYxvXHwubJrU82F3Lm1Fp6789VQ0/3RJKfsmRXjqfaTA++23CvC3hqmqe/2GEt6Kw==",
- "license": "MIT",
- "dependencies": {
- "cluster-key-slot": "1.1.2",
- "generic-pool": "3.9.0",
- "yallist": "4.0.0"
- },
- "engines": {
- "node": ">=14"
- }
- },
- "node_modules/mcp-handler/node_modules/@redis/graph": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.1.1.tgz",
- "integrity": "sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw==",
- "license": "MIT",
- "peerDependencies": {
- "@redis/client": "^1.0.0"
- }
- },
- "node_modules/mcp-handler/node_modules/@redis/json": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.7.tgz",
- "integrity": "sha512-6UyXfjVaTBTJtKNG4/9Z8PSpKE6XgSyEb8iwaqDcy+uKrd/DGYHTWkUdnQDyzm727V7p21WUMhsqz5oy65kPcQ==",
- "license": "MIT",
- "peerDependencies": {
- "@redis/client": "^1.0.0"
- }
- },
- "node_modules/mcp-handler/node_modules/@redis/search": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.2.0.tgz",
- "integrity": "sha512-tYoDBbtqOVigEDMAcTGsRlMycIIjwMCgD8eR2t0NANeQmgK/lvxNAvYyb6bZDD4frHRhIHkJu2TBRvB0ERkOmw==",
- "license": "MIT",
- "peerDependencies": {
- "@redis/client": "^1.0.0"
- }
- },
- "node_modules/mcp-handler/node_modules/@redis/time-series": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.1.0.tgz",
- "integrity": "sha512-c1Q99M5ljsIuc4YdaCwfUEXsofakb9c8+Zse2qxTadu8TalLXuAESzLvFAvNVbkmSlvlzIQOLpBCmWI9wTOt+g==",
- "license": "MIT",
- "peerDependencies": {
- "@redis/client": "^1.0.0"
- }
- },
- "node_modules/mcp-handler/node_modules/chalk": {
- "version": "5.6.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
- "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
- "license": "MIT",
- "engines": {
- "node": "^12.17.0 || ^14.13 || >=16.0.0"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "node_modules/mcp-handler/node_modules/commander": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
- "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
- "license": "MIT",
- "engines": {
- "node": ">=16"
- }
- },
- "node_modules/mcp-handler/node_modules/redis": {
- "version": "4.7.1",
- "resolved": "https://registry.npmjs.org/redis/-/redis-4.7.1.tgz",
- "integrity": "sha512-S1bJDnqLftzHXHP8JsT5II/CtHWQrASX5K96REjWjlmWKrviSOLWmM7QnRLstAWsu1VBBV1ffV6DzCvxNP0UJQ==",
- "license": "MIT",
- "workspaces": [
- "./packages/*"
- ],
- "dependencies": {
- "@redis/bloom": "1.2.0",
- "@redis/client": "1.6.1",
- "@redis/graph": "1.1.1",
- "@redis/json": "1.0.7",
- "@redis/search": "1.2.0",
- "@redis/time-series": "1.1.0"
- }
- },
"node_modules/md5": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
@@ -22179,19 +21996,6 @@
"integrity": "sha512-djbJ/vZKZO+gPoSDThGNpKDO+o+bAeA4XQKovvkNCqnIS2t+S4qnLAGQhyyrulhCFRl1WWzAp0wUDV8PpTVU3g==",
"license": "ISC"
},
- "node_modules/swr": {
- "version": "2.3.8",
- "resolved": "https://registry.npmjs.org/swr/-/swr-2.3.8.tgz",
- "integrity": "sha512-gaCPRVoMq8WGDcWj9p4YWzCMPHzE0WNl6W8ADIx9c3JBEIdMkJGMzW+uzXvxHMltwcYACr9jP+32H8/hgwMR7w==",
- "license": "MIT",
- "dependencies": {
- "dequal": "^2.0.3",
- "use-sync-external-store": "^1.6.0"
- },
- "peerDependencies": {
- "react": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
- }
- },
"node_modules/sylvester": {
"version": "0.0.21",
"resolved": "https://registry.npmjs.org/sylvester/-/sylvester-0.0.21.tgz",
@@ -22409,18 +22213,6 @@
"node": ">=0.8"
}
},
- "node_modules/throttleit": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-2.1.0.tgz",
- "integrity": "sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
@@ -23896,12 +23688,6 @@
"node": ">=0.4"
}
},
- "node_modules/yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "license": "ISC"
- },
"node_modules/yaml": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
diff --git a/package.json b/package.json
index 3526141..0eadd34 100644
--- a/package.json
+++ b/package.json
@@ -21,14 +21,12 @@
"@ai-sdk/deepseek": "^2.0.4",
"@ai-sdk/google": "^3.0.53",
"@ai-sdk/openai": "^3.0.2",
- "@ai-sdk/react": "^3.0.5",
"@hookform/resolvers": "^5.2.2",
"@modelcontextprotocol/sdk": "^1.26.0",
"@nivo/bar": "^0.99.0",
"@nivo/calendar": "^0.99.0",
"@nivo/core": "^0.99.0",
"@prisma/client": "^6.19.0",
- "@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "^1.1.3",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-collapsible": "^1.1.12",
@@ -61,7 +59,6 @@
"lucide-react": "^0.469.0",
"mammoth": "^1.12.0",
"markdown-it": "^14.1.0",
- "mcp-handler": "^1.1.0",
"next": "^15.5.18",
"next-auth": "^5.0.0-beta.30",
"next-themes": "^0.4.4",
diff --git a/src/actions/automation.actions.ts b/src/actions/automation.actions.ts
index 1259a1d..916510c 100644
--- a/src/actions/automation.actions.ts
+++ b/src/actions/automation.actions.ts
@@ -528,7 +528,10 @@ export async function getDiscoveredJobById(id: string): Promise<{
}
}
-export async function dismissDiscoveredJob(id: string): Promise<{
+async function setDiscoveredJobStatus(
+ id: string,
+ status: "accepted" | "dismissed",
+): Promise<{
success: boolean;
data?: DiscoveredJob;
message?: string;
@@ -553,7 +556,7 @@ export async function dismissDiscoveredJob(id: string): Promise<{
const updated = await db.job.update({
where: { id },
- data: { discoveryStatus: "dismissed" },
+ data: { discoveryStatus: status },
include: {
automation: {
select: { id: true, name: true },
@@ -569,10 +572,21 @@ export async function dismissDiscoveredJob(id: string): Promise<{
data: updated as unknown as DiscoveredJob,
};
} catch (error) {
- return formatError(error, "Failed to dismiss discovered job");
+ return formatError(
+ error,
+ `Failed to ${status === "accepted" ? "accept" : "dismiss"} discovered job`,
+ );
}
}
+export async function dismissDiscoveredJob(id: string): Promise<{
+ success: boolean;
+ data?: DiscoveredJob;
+ message?: string;
+}> {
+ return setDiscoveredJobStatus(id, "dismissed");
+}
+
// Bulk-deletes discovered jobs for one automation. Always keeps accepted jobs
// (they're tracked) and deletes dismissed ones; includeNew also clears the
// unreviewed "new" pile.
@@ -610,44 +624,7 @@ export async function acceptDiscoveredJob(id: string): Promise<{
data?: DiscoveredJob;
message?: string;
}> {
- try {
- const user = await getCurrentUser();
- if (!user) {
- return { success: false, message: "Not authenticated" };
- }
-
- const job = await db.job.findFirst({
- where: {
- id,
- userId: user.id,
- automationId: { not: null },
- },
- });
-
- if (!job) {
- return { success: false, message: "Discovered job not found" };
- }
-
- const updated = await db.job.update({
- where: { id },
- data: { discoveryStatus: "accepted" },
- include: {
- automation: {
- select: { id: true, name: true },
- },
- JobTitle: { select: { label: true } },
- Company: { select: { label: true } },
- Location: { select: { label: true } },
- },
- });
-
- return {
- success: true,
- data: updated as unknown as DiscoveredJob,
- };
- } catch (error) {
- return formatError(error, "Failed to accept discovered job");
- }
+ return setDiscoveredJobStatus(id, "accepted");
}
// Runs an on-demand LLM match for an un-analyzed discovered job using the
diff --git a/src/actions/dashboard.actions.ts b/src/actions/dashboard.actions.ts
index 9cd4c6f..6af39e9 100644
--- a/src/actions/dashboard.actions.ts
+++ b/src/actions/dashboard.actions.ts
@@ -5,6 +5,30 @@ import { getCurrentUser } from "@/utils/user.utils";
import { Prisma } from "@prisma/client";
import { format, parseISO, subDays } from "date-fns";
+// Local-time day range: start at 00:00 daysBack days ago, end today 23:59:59.999
+const getLocalDayRange = (daysBack: number): { start: Date; end: Date } => {
+ const now = new Date();
+ const end = new Date(
+ now.getFullYear(),
+ now.getMonth(),
+ now.getDate(),
+ 23,
+ 59,
+ 59,
+ 999,
+ );
+ const start = new Date(
+ now.getFullYear(),
+ now.getMonth(),
+ now.getDate() - daysBack,
+ 0,
+ 0,
+ 0,
+ 0,
+ );
+ return { start, end };
+};
+
export const getJobsAppliedForPeriod = async (
daysAgo: number,
): Promise<any | undefined> => {
@@ -82,26 +106,8 @@ export const getActivityDataForPeriod = async (): Promise<any | undefined> => {
if (!user) {
throw new Error("Not authenticated");
}
- const now = new Date();
// Use local time for date range to match grouping and getLast7Days
- const today = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate(),
- 23,
- 59,
- 59,
- 999,
- );
- const sevenDaysAgo = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - 6,
- 0,
- 0,
- 0,
- 0,
- );
+ const { start: sevenDaysAgo, end: today } = getLocalDayRange(6);
const activities = await prisma.activity.findMany({
where: {
userId: user.id,
@@ -159,26 +165,8 @@ export const getJobsActivityForPeriod = async (): Promise<any | undefined> => {
if (!user) {
throw new Error("Not authenticated");
}
- const now = new Date();
// Use local time for date range to match grouping and getLast7Days
- const today = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate(),
- 23,
- 59,
- 59,
- 999,
- );
- const sevenDaysAgo = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - 6,
- 0,
- 0,
- 0,
- 0,
- );
+ const { start: sevenDaysAgo, end: today } = getLocalDayRange(6);
const jobData = await prisma.job.groupBy({
by: "appliedDate",
_count: {
@@ -234,25 +222,7 @@ export const getTopActivityTypesByDuration = async (
}
try {
- const now = new Date();
- const today = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate(),
- 23,
- 59,
- 59,
- 999,
- );
- const startDate = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - daysAgo + 1,
- 0,
- 0,
- 0,
- 0,
- );
+ const { start: startDate, end: today } = getLocalDayRange(daysAgo - 1);
const activities = await prisma.activity.findMany({
where: {
@@ -330,26 +300,8 @@ export const getActivityCalendarData = async (): Promise<any | undefined> => {
if (!user) {
throw new Error("Not authenticated");
}
- const now = new Date();
// Use local time for date range to match grouping
- const today = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate(),
- 23,
- 59,
- 59,
- 999,
- );
- const daysAgo = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate() - 365,
- 0,
- 0,
- 0,
- 0,
- );
+ const { start: daysAgo, end: today } = getLocalDayRange(365);
const jobData = await prisma.job.groupBy({
by: "appliedDate",
_count: {
diff --git a/src/actions/profile.actions.ts b/src/actions/profile.actions.ts
index 206890c..7b92cf5 100644
--- a/src/actions/profile.actions.ts
+++ b/src/actions/profile.actions.ts
@@ -25,6 +25,15 @@ import path from "path";
import fs from "fs";
import { writeFile } from "fs/promises";
+// Canonical IDOR guard for actions that only need to confirm resume ownership
+const assertResumeOwnership = async (resumeId: string, userId: string) => {
+ const owned = await prisma.resume.findUnique({
+ where: { id: resumeId, profile: { userId } },
+ select: { id: true },
+ });
+ if (!owned) throw new Error("Resume not found or access denied");
+};
+
const resumeListSelect = {
id: true,
profileId: true,
@@ -553,11 +562,7 @@ export const addResumeSummary = async (
throw new Error("Not authenticated");
}
- const owned = await prisma.resume.findUnique({
- where: { id: data.resumeId!, profile: { userId: user.id } },
- select: { id: true },
- });
- if (!owned) throw new Error("Resume not found or access denied");
+ await assertResumeOwnership(data.resumeId!, user.id);
const res = await prisma.resumeSection.create({
data: {
@@ -637,11 +642,7 @@ export const addExperience = async (
throw new Error("Not authenticated");
}
- const owned = await prisma.resume.findUnique({
- where: { id: data.resumeId!, profile: { userId: user.id } },
- select: { id: true },
- });
- if (!owned) throw new Error("Resume not found or access denied");
+ await assertResumeOwnership(data.resumeId!, user.id);
if (!data.sectionId && !data.sectionTitle) {
throw new Error("SectionTitle is required.");
@@ -732,11 +733,7 @@ export const addEducation = async (
throw new Error("Not authenticated");
}
- const owned = await prisma.resume.findUnique({
- where: { id: data.resumeId!, profile: { userId: user.id } },
- select: { id: true },
- });
- if (!owned) throw new Error("Resume not found or access denied");
+ await assertResumeOwnership(data.resumeId!, user.id);
const section = !data.sectionId
? await prisma.resumeSection.create({
@@ -825,11 +822,7 @@ export const addCertification = async (
throw new Error("Not authenticated");
}
- const owned = await prisma.resume.findUnique({
- where: { id: data.resumeId!, profile: { userId: user.id } },
- select: { id: true },
- });
- if (!owned) throw new Error("Resume not found or access denied");
+ await assertResumeOwnership(data.resumeId!, user.id);
const section = !data.sectionId
? await prisma.resumeSection.create({
@@ -903,11 +896,7 @@ export const addSkillsSection = async (
const user = await getCurrentUser();
if (!user) throw new Error("Not authenticated");
- const owned = await prisma.resume.findUnique({
- where: { id: data.resumeId, profile: { userId: user.id } },
- select: { id: true },
- });
- if (!owned) throw new Error("Resume not found or access denied");
+ await assertResumeOwnership(data.resumeId, user.id);
const section = await prisma.resumeSection.create({
data: {
diff --git a/src/app/api/company/route.example.ts b/src/app/api/company/route.example.ts
deleted file mode 100644
index a0f3155..0000000
--- a/src/app/api/company/route.example.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-// createCompany SERVER ACTION in job.actions.ts has replaced the need of following route handler
-// NOTE: code is kept here for an example use case
-// ============================================
-// import "server-only";
-// import prisma from "@/lib/db";
-// import { NextResponse } from "next/server";
-// import { auth } from "@/auth";
-
-// export const POST = async (req: any) => {
-// const session = await auth();
-// console.log("SESSION: ", session);
-// const userId = session?.accessToken.sub;
-// /* SESSION: {
-// user: { name: 'Admin', email: '[email protected]' },
-// expires: '2024-07-04T06:16:33.616Z',
-// accessToken: {
-// name: 'Admin',
-// email: '[email protected]',
-// sub: '24c84c85-b6a9-40ea-bccb-1b883bcc64cd',
-// iat: 1717481780,
-// exp: 1720073780,
-// jti: '4b5bbd8a-aa0e-4552-b19c-82e2c2dbf130'
-// }
-// } */
-// if (!session || !session.user) {
-// return new NextResponse(JSON.stringify({ message: "Not Authenticated" }), {
-// status: 401,
-// });
-// }
-
-// const { label, value } = await req.json();
-// if (!value) {
-// return NextResponse.json(
-// { message: "Company name is required" },
-// { status: 400 }
-// );
-// }
-
-// try {
-// // Upsert the name (create if it does not exist, update if it exists)
-// const upsertedName = await prisma.company.upsert({
-// where: { value },
-// update: { label },
-// create: { label, value, createdBy: userId },
-// });
-
-// return NextResponse.json(upsertedName, { status: 201 });
-// } catch (error) {
-// console.error("Error upserting name:", error);
-// return NextResponse.json(
-// { message: "Internal server error" },
-// { status: 500 }
-// );
-// }
-// };
diff --git a/src/components/FormDialogFooter.tsx b/src/components/FormDialogFooter.tsx
new file mode 100644
index 0000000..5552bdc
--- /dev/null
+++ b/src/components/FormDialogFooter.tsx
@@ -0,0 +1,37 @@
+import { DialogFooter } from "./ui/dialog";
+import { Button } from "./ui/button";
+import { Loader } from "lucide-react";
+
+type FormDialogFooterProps = {
+ onCancel: () => void;
+ isPending: boolean;
+ saveDisabled: boolean;
+};
+
+// Shared Cancel/Save footer for form dialogs laid out as a 2-col grid form
+export function FormDialogFooter({
+ onCancel,
+ isPending,
+ saveDisabled,
+}: FormDialogFooterProps) {
+ return (
+ <div className="md:col-span-2 mt-4">
+ <DialogFooter>
+ <div>
+ <Button
+ type="reset"
+ variant="outline"
+ className="mt-2 md:mt-0 w-full"
+ onClick={onCancel}
+ >
+ Cancel
+ </Button>
+ </div>
+ <Button type="submit" disabled={saveDisabled}>
+ Save
+ {isPending && <Loader className="h-4 w-4 shrink-0 spinner" />}
+ </Button>
+ </DialogFooter>
+ </div>
+ );
+}
diff --git a/src/components/profile/AddCertification.tsx b/src/components/profile/AddCertification.tsx
index e620879..89e7818 100644
--- a/src/components/profile/AddCertification.tsx
+++ b/src/components/profile/AddCertification.tsx
@@ -7,10 +7,10 @@ import { zodResolver } from "@hookform/resolvers/zod";
import {
Dialog,
DialogContent,
- DialogFooter,
DialogHeader,
DialogTitle,
} from "../ui/dialog";
+import { FormDialogFooter } from "../FormDialogFooter";
import {
Form,
FormControl,
@@ -22,10 +22,8 @@ import {
import { Input } from "../ui/input";
import { DatePicker } from "../DatePicker";
import { Switch } from "../ui/switch";
-import { Button } from "../ui/button";
import { useEffect, useTransition } from "react";
import { toast } from "../ui/use-toast";
-import { Loader } from "lucide-react";
import {
addCertification,
updateCertification,
@@ -287,24 +285,11 @@ function AddCertification({
/>
</div>
- <div className="md:col-span-2 mt-4">
- <DialogFooter>
- <div>
- <Button
- type="reset"
- variant="outline"
- className="mt-2 md:mt-0 w-full"
- onClick={closeDialog}
- >
- Cancel
- </Button>
- </div>
- <Button type="submit" disabled={!formState.isDirty}>
- Save
- {isPending && <Loader className="h-4 w-4 shrink-0 spinner" />}
- </Button>
- </DialogFooter>
- </div>
+ <FormDialogFooter
+ onCancel={closeDialog}
+ isPending={isPending}
+ saveDisabled={!formState.isDirty}
+ />
</form>
</Form>
</DialogContent>
diff --git a/src/components/profile/AddContactInfo.tsx b/src/components/profile/AddContactInfo.tsx
index 92dd1d7..8520b39 100644
--- a/src/components/profile/AddContactInfo.tsx
+++ b/src/components/profile/AddContactInfo.tsx
@@ -1,13 +1,13 @@
"use client";
-import { Loader, X } from "lucide-react";
+import { X } from "lucide-react";
import { Button } from "../ui/button";
import {
Dialog,
DialogContent,
- DialogFooter,
DialogHeader,
DialogTitle,
} from "../ui/dialog";
+import { FormDialogFooter } from "../FormDialogFooter";
import {
Form,
FormControl,
@@ -329,24 +329,11 @@ function AddContactInfo({
</div>
)}
- <div className="md:col-span-2 mt-4">
- <DialogFooter>
- <div>
- <Button
- type="reset"
- variant="outline"
- className="mt-2 md:mt-0 w-full"
- onClick={closeDialog}
- >
- Cancel
- </Button>
- </div>
- <Button type="submit" disabled={!formState.isDirty}>
- Save
- {isPending && <Loader className="h-4 w-4 shrink-0 spinner" />}
- </Button>
- </DialogFooter>
- </div>
+ <FormDialogFooter
+ onCancel={closeDialog}
+ isPending={isPending}
+ saveDisabled={!formState.isDirty}
+ />
</form>
</Form>
</DialogContent>
diff --git a/src/components/profile/AddEducation.tsx b/src/components/profile/AddEducation.tsx
index e048cad..27680f7 100644
--- a/src/components/profile/AddEducation.tsx
+++ b/src/components/profile/AddEducation.tsx
@@ -7,10 +7,10 @@ import { zodResolver } from "@hookform/resolvers/zod";
import {
Dialog,
DialogContent,
- DialogFooter,
DialogHeader,
DialogTitle,
} from "../ui/dialog";
+import { FormDialogFooter } from "../FormDialogFooter";
import {
Form,
FormControl,
@@ -23,10 +23,8 @@ import { Input } from "../ui/input";
import { DatePicker } from "../DatePicker";
import { Switch } from "../ui/switch";
import TiptapEditor from "../TiptapEditor";
-import { Button } from "../ui/button";
import { useCallback, useEffect, useState, useTransition } from "react";
import { toast } from "../ui/use-toast";
-import { Loader } from "lucide-react";
import { Combobox } from "../ComboBox";
import { JobLocation } from "@/models/job.model";
import { addEducation, updateEducation } from "@/actions/profile.actions";
@@ -326,24 +324,11 @@ function AddEducation({
)}
/>
</div>
- <div className="md:col-span-2 mt-4">
- <DialogFooter>
- <div>
- <Button
- type="reset"
- variant="outline"
- className="mt-2 md:mt-0 w-full"
- onClick={closeDialog}
- >
- Cancel
- </Button>
- </div>
- <Button type="submit" disabled={!formState.isDirty}>
- Save
- {isPending && <Loader className="h-4 w-4 shrink-0 spinner" />}
- </Button>
- </DialogFooter>
- </div>
+ <FormDialogFooter
+ onCancel={closeDialog}
+ isPending={isPending}
+ saveDisabled={!formState.isDirty}
+ />
</form>
</Form>
</DialogContent>
diff --git a/src/components/profile/AddExperience.tsx b/src/components/profile/AddExperience.tsx
index 0fb0f81..f578a3a 100644
--- a/src/components/profile/AddExperience.tsx
+++ b/src/components/profile/AddExperience.tsx
@@ -8,12 +8,10 @@ import { z } from "zod";
import {
Dialog,
DialogContent,
- DialogFooter,
DialogHeader,
DialogTitle,
} from "../ui/dialog";
-import { Button } from "../ui/button";
-import { Loader } from "lucide-react";
+import { FormDialogFooter } from "../FormDialogFooter";
import {
Form,
FormControl,
@@ -308,24 +306,11 @@ function AddExperience({
)}
/>
</div>
- <div className="md:col-span-2 mt-4">
- <DialogFooter>
- <div>
- <Button
- type="reset"
- variant="outline"
- className="mt-2 md:mt-0 w-full"
- onClick={closeDialog}
- >
- Cancel
- </Button>
- </div>
- <Button type="submit" disabled={!formState.isDirty}>
- Save
- {isPending && <Loader className="h-4 w-4 shrink-0 spinner" />}
- </Button>
- </DialogFooter>
- </div>
+ <FormDialogFooter
+ onCancel={closeDialog}
+ isPending={isPending}
+ saveDisabled={!formState.isDirty}
+ />
</form>
</Form>
</DialogContent>
diff --git a/src/components/profile/AddResumeSummary.tsx b/src/components/profile/AddResumeSummary.tsx
index 7873fb4..9be57b8 100644
--- a/src/components/profile/AddResumeSummary.tsx
+++ b/src/components/profile/AddResumeSummary.tsx
@@ -2,13 +2,12 @@ import { useForm } from "react-hook-form";
import {
Dialog,
DialogContent,
- DialogFooter,
DialogHeader,
DialogTitle,
} from "../ui/dialog";
+import { FormDialogFooter } from "../FormDialogFooter";
import { AddSummarySectionFormSchema } from "@/models/addSummaryForm.schema";
import { zodResolver } from "@hookform/resolvers/zod";
-import { Button } from "../ui/button";
import {
Form,
FormControl,
@@ -18,7 +17,6 @@ import {
FormMessage,
} from "../ui/form";
import { Input } from "../ui/input";
-import { Loader } from "lucide-react";
import { useEffect, useTransition } from "react";
import { toast } from "../ui/use-toast";
import { z } from "zod";
@@ -141,26 +139,11 @@ function AddResumeSummary({
)}
/>
</div>
- <div className="md:col-span-2 mt-4">
- <DialogFooter
- // className="md:col-span
- >
- <div>
- <Button
- type="reset"
- variant="outline"
- className="mt-2 md:mt-0 w-full"
- onClick={closeDialog}
- >
- Cancel
- </Button>
- </div>
- <Button type="submit" disabled={!formState.isDirty}>
- Save
- {isPending && <Loader className="h-4 w-4 shrink-0 spinner" />}
- </Button>
- </DialogFooter>
- </div>
+ <FormDialogFooter
+ onCancel={closeDialog}
+ isPending={isPending}
+ saveDisabled={!formState.isDirty}
+ />
</form>
</Form>
</DialogContent>
diff --git a/src/components/tasks/TasksTable.tsx b/src/components/tasks/TasksTable.tsx
index 0ffde56..e0d4f88 100644
--- a/src/components/tasks/TasksTable.tsx
+++ b/src/components/tasks/TasksTable.tsx
@@ -380,6 +380,33 @@ function TasksTable({
</TableHeader>
);
+ const renderGroupedTables = (entries: [string, Task[]][]) => (
+ <>
+ {entries.map(([label, groupTasks]) => (
+ <div key={label} className="mb-6">
+ <h3 className="text-sm font-semibold mb-2 px-2 py-1">
+ {label} ({groupTasks.length})
+ </h3>
+ <Table>
+ {renderTableHeader()}
+ <TableBody>{groupTasks.map(renderTaskRow)}</TableBody>
+ </Table>
+ </div>
+ ))}
+ <DeleteAlertDialog
+ pageTitle="task"
+ open={alertOpen}
+ onOpenChange={setAlertOpen}
+ onDelete={() => deleteTask(taskIdToDelete)}
+ />
+ </>
+ );
+
+ const formatDateLabel = (dateStr: string) => {
+ const date = parse(dateStr, "yyyy-MM-dd", new Date());
+ return isToday(date) ? "Today" : format(date, "MMM d, yyyy");
+ };
+
if (tasks.length === 0) {
return (
<div className="text-center py-8 text-muted-foreground">
@@ -399,134 +426,28 @@ function TasksTable({
"No Due Date",
];
- return (
- <>
- {groupOrder.map((group) => {
- const groupTasks = groupedTasks[group];
- if (groupTasks.length === 0) return null;
-
- return (
- <div key={group} className="mb-6">
- <h3
- className={cn(
- "text-sm font-semibold mb-2 px-2 py-1",
- group === "Overdue",
- group === "Today",
- group === "Tomorrow",
- )}
- >
- {group} ({groupTasks.length})
- </h3>
- <Table>
- {renderTableHeader()}
- <TableBody>{groupTasks.map(renderTaskRow)}</TableBody>
- </Table>
- </div>
- );
- })}
- <DeleteAlertDialog
- pageTitle="task"
- open={alertOpen}
- onOpenChange={setAlertOpen}
- onDelete={() => deleteTask(taskIdToDelete)}
- />
- </>
+ return renderGroupedTables(
+ groupOrder
+ .filter((group) => groupedTasks[group].length > 0)
+ .map((group) => [group, groupedTasks[group]]),
);
}
if (groupBy === "activityType") {
- const groupedTasks = groupTasksByActivityType(tasks);
-
- return (
- <>
- {Object.entries(groupedTasks).map(([activityType, groupTasks]) => (
- <div key={activityType} className="mb-6">
- <h3 className="text-sm font-semibold mb-2 px-2 py-1">
- {activityType} ({groupTasks.length})
- </h3>
- <Table>
- {renderTableHeader()}
- <TableBody>{groupTasks.map(renderTaskRow)}</TableBody>
- </Table>
- </div>
- ))}
- <DeleteAlertDialog
- pageTitle="task"
- open={alertOpen}
- onOpenChange={setAlertOpen}
- onDelete={() => deleteTask(taskIdToDelete)}
- />
- </>
- );
- }
-
- if (groupBy === "createdDate") {
- const groupedTasks = groupTasksByCreatedDate(tasks);
- const sortedDates = Object.keys(groupedTasks).sort().reverse();
-
- return (
- <>
- {sortedDates.map((dateStr) => {
- const groupTasks = groupedTasks[dateStr];
- const date = parse(dateStr, "yyyy-MM-dd", new Date());
- const displayDate = isToday(date)
- ? "Today"
- : format(date, "MMM d, yyyy");
-
- return (
- <div key={dateStr} className="mb-6">
- <h3 className="text-sm font-semibold mb-2 px-2 py-1">
- {displayDate} ({groupTasks.length})
- </h3>
- <Table>
- {renderTableHeader()}
- <TableBody>{groupTasks.map(renderTaskRow)}</TableBody>
- </Table>
- </div>
- );
- })}
- <DeleteAlertDialog
- pageTitle="task"
- open={alertOpen}
- onOpenChange={setAlertOpen}
- onDelete={() => deleteTask(taskIdToDelete)}
- />
- </>
- );
+ return renderGroupedTables(Object.entries(groupTasksByActivityType(tasks)));
}
- if (groupBy === "updatedDate") {
- const groupedTasks = groupTasksByUpdatedDate(tasks);
- const sortedDates = Object.keys(groupedTasks).sort().reverse();
-
- return (
- <>
- {sortedDates.map((dateStr) => {
- const groupTasks = groupedTasks[dateStr];
- const date = parse(dateStr, "yyyy-MM-dd", new Date());
- const displayDate = isToday(date)
- ? "Today"
- : format(date, "MMM d, yyyy");
-
- return (
- <div key={dateStr} className="mb-6">
- <h3 className="text-sm font-semibold mb-2 px-2 py-1">
- {displayDate} ({groupTasks.length})
- </h3>
- <Table>
- {renderTableHeader()}
- <TableBody>{groupTasks.map(renderTaskRow)}</TableBody>
- </Table>
- </div>
- );
- })}
- <DeleteAlertDialog
- pageTitle="task"
- open={alertOpen}
- onOpenChange={setAlertOpen}
- onDelete={() => deleteTask(taskIdToDelete)}
- />
- </>
+ if (groupBy === "createdDate" || groupBy === "updatedDate") {
+ const groupedTasks =
+ groupBy === "createdDate"
+ ? groupTasksByCreatedDate(tasks)
+ : groupTasksByUpdatedDate(tasks);
+
+ return renderGroupedTables(
+ Object.keys(groupedTasks)
+ .sort()
+ .reverse()
+ .map((dateStr) => [formatDateLabel(dateStr), groupedTasks[dateStr]]),
);
}
diff --git a/src/components/ui/accordion.tsx b/src/components/ui/accordion.tsx
deleted file mode 100644
index 24c788c..0000000
--- a/src/components/ui/accordion.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-"use client"
-
-import * as React from "react"
-import * as AccordionPrimitive from "@radix-ui/react-accordion"
-import { ChevronDown } from "lucide-react"
-
-import { cn } from "@/lib/utils"
-
-const Accordion = AccordionPrimitive.Root
-
-const AccordionItem = React.forwardRef<
- React.ElementRef<typeof AccordionPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
->(({ className, ...props }, ref) => (
- <AccordionPrimitive.Item
- ref={ref}
- className={cn("border-b", className)}
- {...props}
- />
-))
-AccordionItem.displayName = "AccordionItem"
-
-const AccordionTrigger = React.forwardRef<
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
->(({ className, children, ...props }, ref) => (
- <AccordionPrimitive.Header className="flex">
- <AccordionPrimitive.Trigger
- ref={ref}
- className={cn(
- "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
- className
- )}
- {...props}
- >
- {children}
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
- </AccordionPrimitive.Trigger>
- </AccordionPrimitive.Header>
-))
-AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
-
-const AccordionContent = React.forwardRef<
- React.ElementRef<typeof AccordionPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
->(({ className, children, ...props }, ref) => (
- <AccordionPrimitive.Content
- ref={ref}
- className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
- {...props}
- >
- <div className={cn("pb-4 pt-0", className)}>{children}</div>
- </AccordionPrimitive.Content>
-))
-
-AccordionContent.displayName = AccordionPrimitive.Content.displayName
-
-export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
diff --git a/src/lib/scraper/index.ts b/src/lib/scraper/index.ts
index c111cf9..78dd417 100644
--- a/src/lib/scraper/index.ts
+++ b/src/lib/scraper/index.ts
@@ -2,7 +2,7 @@ export * from "./types";
export * from "./utils";
export * from "./mapper";
export * from "./schedule";
-export { createJSearchProvider, searchJSearchJobs } from "./jsearch";
+export { searchJSearchJobs } from "./jsearch";
export {
fetchBoardJobs,
searchGreenhouseJobs,
diff --git a/src/lib/scraper/jsearch/index.ts b/src/lib/scraper/jsearch/index.ts
index ec3de23..05b58a1 100644
--- a/src/lib/scraper/jsearch/index.ts
+++ b/src/lib/scraper/jsearch/index.ts
@@ -1,9 +1,4 @@
-import type {
- JobSearchResult,
- JobDetails,
- ScraperResult,
- ScraperService,
-} from "../types";
+import type { JobDetails, ScraperResult } from "../types";
const RAPIDAPI_KEY = process.env.RAPIDAPI_KEY;
const JSEARCH_BASE_URL = "https://jsearch.p.rapidapi.com";
@@ -34,98 +29,6 @@ interface JSearchResponse {
data: JSearchJob[];
}
-export function createJSearchProvider(rapidApiKey?: string): ScraperService {
- const apiKey = rapidApiKey || RAPIDAPI_KEY;
- if (!apiKey) {
- throw new Error("RAPIDAPI_KEY environment variable is not set");
- }
-
- return {
- boardId: "jsearch",
- boardName: "JSearch",
-
- async search(
- keywords: string,
- location: string,
- ): Promise<ScraperResult<JobSearchResult[]>> {
- try {
- const url = new URL(`${JSEARCH_BASE_URL}/search`);
- url.searchParams.set("query", `${keywords} in ${location}`);
- url.searchParams.set("page", "1");
- url.searchParams.set("num_pages", "1");
- url.searchParams.set("date_posted", "week");
-
- const response = await fetch(url.toString(), {
- method: "GET",
- headers: {
- "X-RapidAPI-Key": apiKey,
- "X-RapidAPI-Host": "jsearch.p.rapidapi.com",
- },
- });
- console.log("JOBS API RESPONSE: ", response);
-
- if (!response.ok) {
- if (response.status === 429) {
- return {
- success: false,
- error: { type: "rate_limited", retryAfter: 60 },
- };
- }
- if (response.status === 403) {
- return {
- success: false,
- error: {
- type: "blocked",
- reason: "API access denied - check your RapidAPI key",
- },
- };
- }
- return {
- success: false,
- error: {
- type: "network",
- message: `API error: ${response.status} ${response.statusText}`,
- },
- };
- }
-
- const data: JSearchResponse = await response.json();
-
- const jobs: JobSearchResult[] = (data.data || []).map((job) => ({
- title: job.job_title,
- company: job.employer_name,
- location: job.job_location || `${job.job_city}, ${job.job_state}`,
- url: job.job_apply_link,
- snippet: job.job_description?.slice(0, 200),
- }));
-
- return { success: true, data: jobs };
- } catch (error) {
- const message =
- error instanceof Error ? error.message : "Unknown error";
- return { success: false, error: { type: "network", message } };
- }
- },
-
- async extract(url: string): Promise<ScraperResult<JobDetails>> {
- // JSearch returns full job details in search results
- // This method exists for interface compatibility
- // In practice, we use searchWithDetails instead
- return {
- success: false,
- error: {
- type: "parse",
- message: "Use searchWithDetails for JSearch - extract not supported",
- },
- };
- },
-
- async close(): Promise<void> {
- // No cleanup needed for API-based provider
- },
- };
-}
-
// Extended search that returns full job details (no separate extract needed)
export async function searchJSearchJobs(
keywords: string,
diff --git a/src/lib/scraper/types.ts b/src/lib/scraper/types.ts
index 453474b..4368038 100644
--- a/src/lib/scraper/types.ts
+++ b/src/lib/scraper/types.ts
@@ -1,11 +1,3 @@
-export interface JobSearchResult {
- title: string;
- company: string;
- location: string;
- url: string;
- snippet?: string;
-}
-
export interface JobDetails {
title: string;
company: string;
@@ -28,14 +20,3 @@ export type ScraperError =
export type ScraperResult<T> =
| { success: true; data: T }
| { success: false; error: ScraperError };
-
-export interface ScraperService {
- readonly boardId: string;
- readonly boardName: string;
- search(
- keywords: string,
- location: string,
- ): Promise<ScraperResult<JobSearchResult[]>>;
- extract(url: string): Promise<ScraperResult<JobDetails>>;
- close(): Promise<void>;
-}
diff --git a/src/utils/company.ts b/src/utils/company.ts
deleted file mode 100644
index e3d274a..0000000
--- a/src/utils/company.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-// FOLLOWING IS AN EXAMPLE OF ROUTE HANDLER APPROACH (FOR API refer to api/company/route.ts)
-// FUNCTION IS REPLACED BY SERVER ACTION IN job.action.ts
-// ========================================================
-// export const upsertCompanyName = async (label: string) => {
-// const value = label.trim().toLowerCase();
-// const response = await fetch("/api/company", {
-// method: "POST",
-// headers: {
-// "Content-Type": "application/json",
-// },
-// body: JSON.stringify({ label, value }),
-// });
-
-// if (!response.ok) {
-// throw new Error(`HTTP error! status: ${response.status}`);
-// }
-
-// const data = await response.json();
-// return data;
-// };
diff --git a/types/index.t.ts b/types/index.t.ts
deleted file mode 100644
index 2de0fdd..0000000
--- a/types/index.t.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-// declare interface HeaderProps {
-// type?: "title" | "greeting";
-// title: string;
-// subtext: string;
-// user?: string;
-// }
-
-// declare type User = {
-// $id: string;
-// email: string;
-// name: string;
-// };
-
-// declare interface SidebarProps {
-// user: User;
-// }