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.

remove seeding at startup

Khuram Niaz3999edfe3596
diff --git a/package.json b/package.json
index 7bf6736..bd2f702 100644
--- a/package.json
+++ b/package.json
@@ -7,8 +7,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
- "seed": "node ./prisma/seed.js",
- "test": "jest",
+"test": "jest",
"test:e2e": "npx playwright test",
"test:watch": "jest --watch"
},
diff --git a/src/actions/auth.actions.ts b/src/actions/auth.actions.ts
index 70a5d3f..c5608ae 100644
--- a/src/actions/auth.actions.ts
+++ b/src/actions/auth.actions.ts
@@ -5,7 +5,7 @@ import { delay } from "@/utils/delay";
import prisma from "@/lib/db";
import bcrypt from "bcryptjs";
import { SignupFormSchema } from "@/models/signupForm.schema";
-import { JOB_SOURCES } from "@/lib/constants";
+import { JOB_SOURCES, JOB_STATUSES } from "@/lib/constants";
export async function signup(formData: {
name: string;
@@ -41,6 +41,14 @@ export async function signup(formData: {
})),
});
+ for (const status of JOB_STATUSES) {
+ await prisma.jobStatus.upsert({
+ where: { value: status.value },
+ update: {},
+ create: status,
+ });
+ }
+
return { success: true };
}
diff --git a/src/instrumentation.ts b/src/instrumentation.ts
index 6b06111..dc90a71 100644
--- a/src/instrumentation.ts
+++ b/src/instrumentation.ts
@@ -1,8 +1,5 @@
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
- const { runSeed } = await import("@/lib/seed");
- await runSeed();
-
const { startScheduler } = await import("@/lib/scheduler");
startScheduler();
}
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 98f938d..9494d8f 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -33,6 +33,16 @@ export const JOB_SOURCES = [
{ label: "Other", value: "other" },
] as const;
+export const JOB_STATUSES = [
+ { label: "Draft", value: "draft" },
+ { label: "Applied", value: "applied" },
+ { label: "Interview", value: "interview" },
+ { label: "Offer", value: "offer" },
+ { label: "Rejected", value: "rejected" },
+ { label: "Expired", value: "expired" },
+ { label: "Archived", value: "archived" },
+] as const;
+
export const SIDEBAR_LINKS = [
{
icon: LayoutDashboard,
diff --git a/src/lib/seed.ts b/src/lib/seed.ts
deleted file mode 100644
index c986ad5..0000000
--- a/src/lib/seed.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-import prisma from "@/lib/db";
-import { JOB_SOURCES } from "@/lib/constants";
-
-import bcrypt from "bcryptjs";
-
-const STATUS_DATA = [
- { label: "Draft", value: "draft" },
- { label: "Applied", value: "applied" },
- { label: "Interview", value: "interview" },
- { label: "Offer", value: "offer" },
- { label: "Rejected", value: "rejected" },
- { label: "Expired", value: "expired" },
- { label: "Archived", value: "archived" },
-];
-
-async function seedUser() {
- const email = process.env.USER_EMAIL;
- if (!email || email.trim() === "") {
- console.warn(
- "[seed] USER_EMAIL not set, skipping user creation"
- );
- return null;
- }
-
- const existingUser = await prisma.user.findUnique({
- where: { email },
- });
-
- if (!existingUser) {
- const password = await bcrypt.hash(process.env.USER_PASSWORD || "", 10);
- const user = await prisma.user.create({
- data: {
- email,
- name: "Admin",
- password,
- },
- });
- console.log("[seed] Created user:", email);
- return user;
- }
- return existingUser;
-}
-
-async function seedStatuses() {
- const existing = await prisma.jobStatus.findUnique({
- where: { value: "draft" },
- });
- if (existing) return;
-
- for (const status of STATUS_DATA) {
- await prisma.jobStatus.upsert({
- where: { value: status.value },
- update: {},
- create: status,
- });
- }
- console.log("[seed] Statuses seeded");
-}
-
-async function seedJobSources(userId: string) {
- const existing = await prisma.jobSource.findFirst({
- where: { value: "indeed", createdBy: userId },
- });
- if (existing) return;
-
- for (const source of JOB_SOURCES) {
- const found = await prisma.jobSource.findFirst({
- where: { value: source.value, createdBy: userId },
- });
- if (!found) {
- await prisma.jobSource.create({
- data: { label: source.label, value: source.value, createdBy: userId },
- });
- }
- }
- console.log("[seed] Job sources seeded");
-}
-
-export async function runSeed() {
- try {
- const user = await seedUser();
- await seedStatuses();
- if (user) {
- await seedJobSources(user.id);
- }
- console.log("[seed] Database seeding complete");
- } catch (error) {
- console.error("[seed] Error during seeding:", error);
- }
-}